Apache HTTP Server course

How to Install Apache HTTP Server on Windows

Learn how to install Apache HTTP Server on Windows, choose the correct binary and runtime, register the service, start it, and verify localhost.

Apache HTTP Server is web-server software that accepts HTTP requests and serves web content. On Windows, the usual installation method is to download a compiled Windows binary distribution, install its required Microsoft Visual C++ runtime, extract the ZIP archive, and register Apache as a Windows service.

This guide covers a typical Apache 2.4 installation for local development and testing. Basic Windows file navigation, ZIP extraction, administrator terminals, and local browser URLs are helpful prerequisites.

How Apache Is Distributed for Windows

The Apache HTTP Server project provides source code, but Windows users commonly install Apache from a third-party provider that compiles that source into a Windows binary package. Source code is not the same as a ready-to-run Windows distribution: source code must be compiled, while a binary package includes executables such as httpd.exe.

Apache Lounge is one community source of compiled Apache HTTP Server packages for Windows. Before downloading, evaluate the provider, package integrity, release information, and stated build requirements. Download only from a source you trust, and check any available checksums or signatures according to that provider's instructions.

For background, see What Is Apache HTTP Server and What Is a Web Server.

1. Select the Correct Apache Package

Apache packages are built for a specific processor architecture:

Windows architectureApache packageTypical use
64-bit (x64)64-bit Apache buildThe normal choice for most current Windows installations
32-bit (x86)32-bit Apache buildOlder 32-bit Windows systems or a specific compatibility requirement

To identify the architecture, open Settings, choose System, then About, and inspect System type. You can also search Windows for System Information and inspect the system type there.

  1. Confirm whether Windows is x64 or x86.
  2. Select a matching Apache HTTP Server ZIP distribution from the chosen Windows binary provider.
  3. Read the package notes before installing. They should identify the compiler version and required Microsoft runtime.

2. Install the Microsoft Visual C++ Runtime

Compiled Apache Windows builds may depend on Microsoft Visual C++ Redistributable runtime libraries. If the required runtime is missing, Apache may fail to launch because a runtime DLL cannot be found.

  1. Read the selected binary provider's build requirements.
  2. Install the specified Microsoft Visual C++ Redistributable before starting Apache.
  3. Match the redistributable architecture to Apache: x64 for an x64 build, or x86 for an x86 build.

Newer Apache builds can require a different Visual C++ Redistributable version from older builds. Do not assume that a runtime used by an older package is sufficient; follow the requirements for the exact package you downloaded.

3. Extract Apache to a Simple Directory

Use File Explorer or another Windows-compatible archive utility to extract the downloaded ZIP file. A conventional installation path is:

C:\Apache24

After extraction, the installation should contain directories similar to these:

C:\Apache24
├── bin
├── conf
├── htdocs
├── logs
└── modules

The executable, configuration, document root, and logs should be directly below C:\Apache24. Avoid accidentally creating a duplicated path such as C:\Apache24\Apache24 when the package configuration expects C:\Apache24.

Apache Windows Installation Components
ComponentTypical location or sourcePurpose
Apache ZIP distributionSelected Windows binary providerPrecompiled Apache files for Windows
Visual C++ RedistributableMicrosoft runtime package specified by the build providerRuntime libraries required by the compiled Apache executable
bin\httpd.exeC:\Apache24\bin\httpd.exeApache HTTP Server executable and administration commands
conf\httpd.confC:\Apache24\conf\httpd.confPrimary Apache configuration file
htdocsC:\Apache24\htdocsDefault document root for web files
logs\error.logC:\Apache24\logs\error.logStartup and runtime error information
Windows Services consoleservices.mscGraphical management of the Apache background service

4. Understand the Installation Layout

  • bin: Contains administrative programs, including httpd.exe.
  • conf: Contains Apache configuration files. The main file is httpd.conf.
  • htdocs: The default document root, where Apache looks for a test index.html.
  • logs: Contains request and diagnostic logs. error.log is the primary file for startup problems.
  • modules: Contains loadable Apache modules supplied by the distribution.

Apache's ServerRoot setting identifies the installation base. It must agree with the directory where Apache was extracted. The Listen directive controls the network address and port; the conventional default for unencrypted HTTP is port 80. The document-root setting identifies where local website files are served.

For configuration-file concepts, see Configuration Files.

5. Register Apache as a Windows Service

A Windows service is a background process registered with Windows. Once Apache is registered, it can be controlled from the Services console and can optionally be configured to start automatically with Windows.

  1. Open Command Prompt or PowerShell with Run as administrator. An elevated terminal is required for service registration.
  2. Change to the Apache executable directory:
cd C:\Apache24\bin

In an elevated Command Prompt, register the service:

httpd.exe -k install

The command must be run where httpd.exe is present, unless its full path is supplied. After successful registration, Apache should appear in Windows Services. The service name and display name can depend on the package and installation state.

6. Start and Manage Apache

Open the Services management console by pressing Windows + R, entering the following command, and pressing Enter:

services.msc
  1. Locate the Apache service created during registration.
  2. Open its context menu and choose Start.
  3. Confirm that its status changes to Running.

You can also control a registered Apache service from an elevated terminal in C:\Apache24\bin:

httpd.exe -k start
httpd.exe -k stop
httpd.exe -k restart
  • -k start requests that the service start.
  • -k stop requests that the service stop.
  • -k restart restarts Apache so configuration changes can take effect.

7. Verify the Installation

  1. Start the Apache service.
  2. Open a browser on the same computer.
  3. Request:
http://localhost/

localhost refers to the computer running the browser. A default Apache welcome page or test response shows that Apache is listening and serving content.

To test the document root, create or replace this file:

C:\Apache24\htdocs\index.html

For example:

<!doctype html>
<html>
  <head><title>Local Apache Test</title></head>
  <body><h1>Apache is serving this page</h1></body>
</html>

Refresh http://localhost/. If the new page appears, Apache is serving files from the expected document root.

Common Installation Checks

Common Installation Checks
CheckHow to perform itSuccessful outcome
Correct architecture selectedCompare Windows system type with the Apache package architectureThe package and operating system are compatible
Required Visual C++ runtime installedReview the provider's requirements and installed Microsoft runtimesApache can load its required runtime libraries
Apache configuration syntax validRun httpd.exe -t from C:\Apache24\binApache reports Syntax OK
Apache service runningCheck the service in services.mscThe service status is Running
Local HTTP response availableOpen http://localhost/The default or custom page is returned

Troubleshooting

Apache reports a missing runtime DLL

Review the binary provider's runtime requirement and confirm whether the package is x86 or x64. Install the matching Microsoft Visual C++ Redistributable, then try starting Apache again.

The service cannot be installed

  • Confirm that the terminal was opened with administrator privileges.
  • Run cd C:\Apache24\bin and verify that httpd.exe is present.
  • Open services.msc and check whether a service with the same name already exists.

Correct the permissions, path, or service-name conflict before repeating httpd.exe -k install.

The service stops immediately

Test the configuration syntax:

cd C:\Apache24\bin
httpd.exe -t

Fix any reported syntax error. Also inspect C:\Apache24\logs\error.log, verify that ServerRoot matches C:\Apache24, and check the Listen directive. Another application may already be using port 80.

Localhost does not open

  • Verify that the Apache service is running in services.msc.
  • Check whether Apache listens on port 80 or another port.
  • If the configured port is different, request it explicitly, for example http://localhost:8080/.
  • Review error.log, local firewall settings, and other web servers that might interfere.

The browser displays an unexpected site

A different web server may own port 80, or the Apache document root may contain different files than expected. Check which service owns the HTTP port, inspect the document-root setting, and review the contents of C:\Apache24\htdocs.

Basic Post-Installation Awareness

The main configuration file is C:\Apache24\conf\httpd.conf. You do not need to redesign it for a basic installation, but three settings are especially important:

  • ServerRoot: Must point to the actual Apache installation directory.
  • Listen: Defines the address and port where Apache accepts HTTP connections. Port 80 is the conventional default.
  • Document root: Identifies the directory from which web files are served; the default is commonly C:\Apache24\htdocs.

Make a backup before editing configuration files. After changes, run httpd.exe -t and restart Apache. Apache access and error logs are useful for diagnosing requests and startup failures; see Log Files: Access Log and Error Log.

Installation Summary

  1. Identify whether Windows is x64 or x86.
  2. Download a matching Apache HTTP Server ZIP binary from a trusted Windows provider.
  3. Install the Visual C++ Redistributable required by that build and match its architecture.
  4. Extract Apache so its files are directly under C:\Apache24.
  5. Open an elevated terminal and run httpd.exe -k install from C:\Apache24\bin.
  6. Start the Apache service through services.msc or httpd.exe -k start.
  7. Open http://localhost/ and replace C:\Apache24\htdocs\index.html with a test page if desired.