
Apache Httpd on Windows
A guide to installing the Apache Httpd web server on Windows.
1 min read
Contents
With the HTTPd binaries provided by Apache Lounge, running the Apache web server on Windows is quite convenient. Here is a short summary of the installation on one of my lab systems.
Preparation
- Download the Apache binaries: http://www.apachelounge.com/download/ (32-bit or 64-bit distribution available)
- Download the Apache modules you need
- Download and install the matching Microsoft Visual C++ Redistributable (depending on the Apache distribution, the 32-bit or 64-bit version is required!)
Apache Setup
- Unzip Apache httpd-2.x.x-winXX.zip and put the contents in a directory such as D:\Apache.
- Adjust the Apache directory in httpd.conf. The following directives need to be changed:
- ServerRoot
- DocumentRoot and
for the Apache default directory - ScriptAlias and
for the /cgi-bin/ directory
- Test whether Apache starts at all:
- Run
%APACHE_HOME%\bin\httpd.exeon the command line. No errors should be shown. - Open http://localhost/ in a browser. It should show “It works!”.
- Run
- Install Apache as a Windows service:
httpd.exe -k install -n "ApacheHTTPd" - Put a shortcut to %APACHE_HOME%\bin\ApacheMonitor.exe in the All Users Startup folder.
- Create an inbound firewall rule for %APACHE_HOME%\bin\httpd.exe.
Apache Configuration
- In httpd.conf:
- Set ServerAdmin and ServerName
- Adjust the log format if needed (see also the log rotation configuration)
- Configure language settings (httpd-languages.conf), error pages (httpd-multilang-errordoc.conf) and autoindex (httpd-autoindex.conf)
- Adjust the server default values (httpd-default.conf): Timeout 60 ServerTokens Prod ServerSignature Off HostnameLookups Off
- If necessary, disable AcceptFilter (bugfix for Apache 2.4): AcceptFilter https none AcceptFilter http none
Httpd Service Security
For security reasons, the Apache HTTPd service should run under a user with limited privileges.