How to Install Apache Web Server on Windows?
Updated on July 06, 2024
Apache (HTTP Server) is one of the most widely used webserver in the world. In this article we will discuss how to install Apache on Windows.
How to download Apache?
To download Apache, you won't find a binary release on the official Apache website (https://httpd.apache.org). Instead, you'll need to compile the source code yourself. Luckily, third-party websites like Apache Lounge offer binary versions.
Visit their website at https://www.apachelounge.com/download/
The latest version available at the time of writing is 2.4.61. If you don't have a specific reason to use the win32 bit version, download the one for Win64 bit: httpd-2.4.61-240703-win64-VS17.zip.
How to Install Apache?
Step 1:
Extract the downloaded file: httpd-2.4.61-240703-win64-VS17.zip.
Step 2:
Inside the extracted folder you can find Apache24 folder.
Copy the Apache24 folder to root path (c:\) or any location you wish.
Step 3:
Open Command Prompt in administrator mode. In the search box on the taskbar, type command prompt, then select Run as administrator from the right-side menu.
Step 4:
Go to the installation bin directory (in our case, on the Command Prompt, type: cd C:\Apache24\bin).
Step 5:
Run the program httpd.exe.
Step 6:
The Windows Defender Firewall will prompt a notice noting that some features are being blocked on public and private networks. Click the Allow button.
How to test your Apache installation?
Congratulations, your Apache installation is already finished. To check if everything is working properly, open a web browser and enter your server address: http://localhost. If no error is found, you should see the Apache test page.
How to add Apache server as a Windows service?
To set up Apache to run as a Windows service and start automatically with Windows, follow these steps:
Open Command Prompt in administrator mode and navigate to C:\Apache24\bin. Run the command httpd.exe -k install.
Managing Apache HTTP Server
All of the following commands must be run in the administrator mode:
- To start the Apache HTTP server: httpd.exe -k start
- To stop the Apache HTTP server: httpd.exe -k stop
- To restart the Apache HTTP server httpd.exe -k restart