How to Install Apache on Windows
This guide provides a straightforward, step-by-step walkthrough for installing and configuring the Apache HTTP Server on a Windows operating system. You will learn how to download the correct binaries, configure Apache as a Windows service, and test your installation to ensure your local web server is running correctly.
Step 1: Download the Apache Binaries
Because the Apache Software Foundation does not provide official binary installers for Windows, you need to download a compiled version from a trusted third-party vendor.
- Visit the official Apache Lounge website (apachelounge.com), which is the widely recommended source for Windows binaries.
- Navigate to the downloads section and select the latest Apache 2.4 Win64 ZIP file.
- Ensure you have the required Visual C++ Redistributable installed on your system, which is typically linked on the same download page.
Step 2: Extract the Files
Once the ZIP file has finished downloading, you need to place the files in their permanent location on your hard drive.
- Right-click the downloaded ZIP folder and select Extract All.
- Set the extraction path to the root of your C drive:
C:\. - After extraction, you should have a folder structure that looks like
C:\Apache24.
Note: While you can install Apache to a different directory,
C:\Apache24is the default configuration path. Installing it here saves you from editing multiple lines of configuration files later.
Step 3: Configure the Apache Server
Before running Apache, you need to make a quick adjustment to the configuration file to ensure it recognizes your server.
- Open the folder
C:\Apache24\confand locate the httpd.conf file. - Open httpd.conf using a text editor like Notepad or Notepad++.
- Scroll down or search for the
ServerNamedirective (around line 225). - Remove the
#symbol at the beginning of the line to uncomment it, and change it to:ServerName localhost:80 - Save and close the file.
Step 4: Install Apache as a Windows Service
Installing Apache as a service ensures that it runs automatically in the background when your computer boots up.
- Click the Windows Start menu, type cmd, right-click on Command Prompt, and select Run as administrator.
- Change your directory to the Apache bin folder by typing the
following command and pressing Enter:
cd C:\Apache24\bin - Install the service by entering:
httpd.exe -k install - If successful, you will see a message stating that the “Apache2.4” service has been successfully installed.
Step 5: Start the Server and Verify Installation
With the service installed, you can now start your web server and test it using a web browser.
- In the same administrator command prompt, start the Apache service
by running:
httpd.exe -k start - Open any web browser and type
http://localhostinto the address bar, then press Enter. - If everything is configured correctly, your browser will display a simple web page that says “It works!”