MIDAS Knowledge Base MIDAS Knowledge Base

How to install & configure Apache on Windows

This article outlines how to install an Apache web server on Windows.

The steps below apply to current 64-bit editions of Windows, including Windows 10, Windows 11, and Windows Server (2016, 2019, 2022, and 2025). They'll also work on older versions of Windows, although you may need to download an older Apache build with a matching Visual C++ Redistributable (see Step 1).

Other http web server options are available for Windows too, including Microsoft's built-in Internet Information Services (IIS) server. We also have a guide to enabling IIS on Windows.

Please note that this article is provided "as is" and is correct at time of writing. For further assistance installing or configuring Apache, please refer to the vendor's own documentation or support channels.

Table of Contents:


Step 1 - Download Apache for Windows

Apache for Windows may be freely downloaded from Apache Lounge.

Note that the Apache Software Foundation doesn't provide an official Windows binary, installer, or MSI package. Instead, ready-to-run Windows builds are produced by trusted third parties. Throughout this guide we'll use the popular builds from Apache Lounge, which are supplied as a simple ZIP archive rather than an installer.

Both 32-bit (Win32 / x86) and 64-bit (Win64 / x64) versions are available, depending upon whether your Windows server runs a 32 or 64-bit version of Windows:

Download Apache for Windows
Apache Lounge Download Page

For this guide, we'll assume that the Windows server is running a 64-bit operating system, and so we'll download the current Apache 2.4 Win64 build. Apache is updated regularly, so the exact version number and filename will change over time. At the time of writing this was Apache 2.4.67 Win64 (httpd-2.4.67-260504-Win64-VS18.zip), but you should always download the latest available build. The rest of this guide refers to that example filename, so adjust it to match whichever version you actually download.

As per the information on the Apache Lounge download page, you'll also need to ensure that you have the relevant C++ Redistributable for Visual Studio installed on your server too. It's possible that this may already be installed on your system, but if in doubt, download and run "vc_redist_x64.exe" (for a 64-bit operating system), or "vc_redist_x86.exe" (for a 32-bit system) from the links on the Apache Lounge site first.


Step 2 - Unzip

Once the download has completed, open the downloaded "httpd-2.4.67-260504-Win64-VS18.zip" file (or whichever version you downloaded), and extract its contents to a suitable location on your server i.e. C:\Apache24 or D:\Apache, etc


Step 3 - Configure Apache

Once you've extracted Apache, we'll need to configure it. Start by locating the file "httpd.conf" (which will be in the "conf" subdirectory), and open this in a standard text editor.

By default, this configuration file assumes that you've extracted Apache to C:\Apache24. If however you've extracted Apache to a different location (i.e. D:\Apache), you'll need to update the ${SRVROOT} variable within in the httpd.conf file to point to the new location accordingly, i.e:

Define SRVROOT "C:/Apache24"Define SRVROOT "D:/Apache"

If there is no SRVROOT variable present in your httpd.conf file, then instead you'll need to manually update all instances of "C:/Apache24", i.e.:

ServerRoot "C:/Apache24"ServerRoot "D:/Apache"
DocumentRoot "C:/Apache24/htdocs"DocumentRoot "D:/Apache/htdocs"
<Directory "C:/Apache24/htdocs"><Directory "D:/Apache/htdocs">
ScriptAlias /cgi-bin/ "C:/Apache24/cgi-bin/"ScriptAlias /cgi-bin/ "D:/Apache/cgi-bin/"

Note: the remaining changes in this step add CGI/Perl support to Apache, which is required if you're installing Apache in order to run MIDAS. If you're installing Apache for another purpose and don't need CGI/Perl support, you can skip the rest of this step and continue to Step 4.

Regardless of where you extracted Apache to, you'll also need to make the following modifications to the httpd.conf file:


Step 4 - Start Apache

The Apache executable is named "httpd.exe" and is located in the "bin" subfolder of the location where you extracted Apache. (In older Apache 2.0 / 2.2 releases this executable was named "apache.exe", but current 2.4 builds use "httpd.exe".)

Open a Command or PowerShell prompt in the "bin" folder at the location where you extracted Apache.

To do this, hold down "Shift" whilst right-clicking and then select either "Open command window here", "Open PowerShell window here", or "Open in Windows Terminal" (depending upon your version of Windows):

Open a command prompt in current folder
Open a command or PowerShell prompt in the selected folder

If you opened a command prompt, start Apache by entering the following command:

httpd.exe

If you opened a PowerShell prompt, start Apache by entering the following command:

& "D:\Apache\bin\httpd.exe"
(Replace D:\Apache\ with the location where you previously extracted your Apache server)

If you see a Windows Firewall prompt, allow access as appropriate. If you fail to allow Apache access through your server's firewall, other computers/devices will be unable to connect to your web server, so be sure to allow access accordingly:

Allow Apache through Windows Firewall
Allow Apache httpd through the Windows firewall

If Apache (httpd.exe) fails to start with a "could not bind to address" error, this will likely be due to another service already running on Apache's default port (80).

Check that you don't currently have an IIS (Internet Information Services) server already running. If you do, you'll need to stop/disable IIS in order to run Apache (or change the listening port on either IIS or Apache to allow both services to run concurrently. You may need to refer to the vendor's own documentation for assistance changing server listening ports). See Troubleshooting below for more detail on this and other common errors.


Step 5 - Check Apache

With the previous command window still open, open your web browser and navigate to http://127.0.0.1

If Apache is running, you should see the words "It works!" displayed in your browser:

Check if Apache is running correctly
Default "It works!" Apache test page


Step 6 - Install as a Windows service:

When you close the command/PowerShell window, Apache will exit.

However, to ensure that Apache is running all the time, it can quickly be installed as a Windows service. That way, Apache will start whenever Windows starts.

Simply open an administrative command prompt or PowerShell prompt again, and this time enter the following, for a Command Prompt:

httpd.exe -k install

...or in a PowerShell Prompt:

Start-Process PowerShell -Verb RunAs

This ensures that PowerShell is running as an administrator. Then enter:

& "D:\Apache\bin\httpd.exe" -k install

(Replace D:\Apache\ with the location where you previously extracted your Apache server)

You should then see a message that the Apache2.4 service has been successfully installed.

You can then start the service by typing:

net start Apache2.4

Install Apache as a Windows Service
Install Apache as a Windows Service

Should you ever need to remove the Apache service in future, first stop it and then uninstall it by entering the following from an administrative prompt:

net stop Apache2.4
httpd.exe -k uninstall


Step 7 - Monitor Apache (optional)

To allow you to monitor the current state of your Apache server, as well as allow you to quickly start/stop/restart the server, Apache comes with a small utility called "Apache Monitor".

Double click ApacheMonitor.exe from the bin folder to run the utility, or place a shortcut to, in your Startup folder so that it automatically runs whenever Windows starts.

To quickly locate your Startup folder on Windows 10/11, press WinKey + R and then type "shell:startup" (current user) or "shell:common startup" (all users)

Monitor Apache State on Windows
The optional Apache Monitor offers a quick way to start, stop, or restart the web server


Troubleshooting common errors

If Apache won't start, or you encounter an error whilst installing it, the cause is usually one of the following:

"VCRUNTIME140.dll was not found" (or a similar "api-ms-win-crt..." error)

Apache for Windows is compiled with Microsoft Visual C++ and requires the matching Visual C++ Redistributable to be installed. If httpd.exe fails to launch with a missing DLL error, download and run the relevant "vc_redist_x64.exe" (64-bit) or "vc_redist_x86.exe" (32-bit) from the Apache Lounge download page, as described in Step 1, then try starting Apache again.

"make_sock: could not bind to address 0.0.0.0:80" / "no listening sockets available, shutting down"

Another program is already using port 80. The most common culprits on Windows are IIS (the "World Wide Web Publishing Service"), another web server, or occasionally applications such as Skype. Either stop and disable the conflicting service, or change the port Apache listens on by editing the Listen directive in httpd.conf, for example:

Listen 80

...changed to:

Listen 8080

If you change the port, remember to include it in the address when testing, e.g. http://127.0.0.1:8080

"(OS 5)Access is denied" when installing or starting the service

Installing or starting a Windows service requires elevated privileges. Make sure you've opened the Command Prompt or PowerShell "as administrator" before running httpd.exe -k install or net start Apache2.4.

"The Apache2.4 service is already installed"

The service has been installed previously. Remove it first by running httpd.exe -k uninstall from an administrative prompt, then re-run the install command.

httpd.exe opens and immediately closes

This usually indicates an error in your configuration. Test your httpd.conf for syntax errors by running:

httpd.exe -t

Apache will report the first line it objects to. You can also check the "logs\error.log" file within your Apache folder for further detail.


Other articles in this series...

This article is the first part of our "How to install prerequisites needed for running a self-hosted edition of MIDAS from a Windows server" series.

It applies to self-hosted installations of a MIDAS room booking and resource scheduling system on Windows-based servers only.



Further Reading


← Return to the Knowledge Base