How to Install The Latest Apache Server (httpd) on Windows

Please note that this post is over a year old and may contain outdated information.
This is a quick and easy guide for installing the latest Apache server (httpd) on your Windows computer. This guide was written specifically for Windows 7, but the steps should be similar for Windows 8 and other versions.

Step 1

If you do not already have it, download the Visual C++ Redistributable for Visual Studio 2012 and install it. You can check if you already have it by going to the Programs and Features control panel, and looking for "Microsoft Visual C++ 2012 Redistributable". This Microsoft software package contains dependencies for the Windows version of Apache server.

Step 2

Download the latest Apache server (httpd) from Apache Lounge. If you are not sure if you need the Win64 or Win32 version, click on your Start Menu, right-click on Computer, and click Properties. Under System Type, it will tell you if you have a 32-bit or 64-bit system.

You might wonder why you are downloading from Apache Lounge and not the official Apache site. Apache Lounge distributes Windows versions of the latest Apache build. You can download from the official Apache site, but will then need to compile your own build, which is well beyond the scope of this guide.

At the time of writing, the latest version of Apache server (httpd) available at Apache Lounge is 2.4.7, so that version will be referenced in this guide. If you have a newer version, you should be able to simply substitute it, unless major changes have been made.

Step 3

You should now have a zip file named httpd-2.4.7-win32-VC11.zip or similar in your download folder. Extract the Apache24 folder it contains to your desired location for your server to run. I simply put it in the Program Files folder, so my path to it looks like:

C:/Program Files/Apache24
From this point on I'll assume you have your Apache server in the same folder. If not, adjust accordingly.

Step 4

Now to configure your server. Inside the Apache24 folder is a conf folder, with a file called httpd.conf. That is the main configuration file. Open it in a text editor as you'll need to make a handful of edits:

Find the line that starts with ServerRoot (approximately line 37). Change it to:

ServerRoot "C:/Program Files/Apache24"
Find the line that contains ServerName (approximately line 217). Remove the pound sign (#) that precedes it. Then change it to:

ServerName localhost:80
This will mean that you access your web server by typing localhost into your browser (http://localhost/).

The document root is where Apache looks for your website files. Find the line that starts with DocumentRoot (approximately line 241). Change it to reflect the position of your document root, which should be:

DocumentRoot "C:/Program Files/Apache24/htdocs"
Then change the line directly below it to match the new position:

<Directory "C:/Program Files/Apache24/htdocs">
Scroll down to the line that has DirectoryIndex index.html (approximately line 275). Add index.php in there or any other files you need your server to recognize as index files. For example:

DirectoryIndex index.php index.html

Step 5

Navigate to the following folder:

Open the hosts file with a text editor and add the following line before everything (on its own line): localhost
This tells windows that when you try to navigate to localhost in a browser, it should direct the requests to your own computer (which your server now resides on). Learn more about the hosts file here.

Step 6

Your server is now configured and should be functional. Start it by opening the following file:

C:/Program Files/Apache24/bin/httpd.exe
It should be a blank black window. This is good, meaning there were no error messages. Keep it minimized while you want your server to be running. You can stop your server by closing the window.

With your server running, you can use localhost (type it into your browser, like: http://localhost/) to access your web files. Your server uses the web files in your htdocs folder, which is here:

C:/Program Files/Apache24/htdocs
There will already be a simple HTML file in there.

Additional Configuration

You my want to move your document root somewhere other than the default htdocs folder. To do this, open the httpd.conf file again and change the location for the DocumentRoot and the following line (approximately lines 241 and 242).

I use wwwroot for my document root because I originally started on IIS. So my document root is at:

You can have it anywhere you want.

If you want to enable mod_rewrite on your Apache server, search for the line that contains mod_rewrite.so (in httpd.conf) and remove the preceding pound sign (#).

One last thing. Any changes you make to the httpd.conf file will require a restart of the web server (close it and open it again) to take effect.
Share This Post
Windows Operating System
Windows 7 Pro 64-Bit
Windows 7 Pro 64-Bit
See More Details
Windows Manuals & Books
Windows Manuals & Books
See More Details

Comments (3)

Al Airone   Jun 25, 2018
The procedural information shown here is essentially still correct and very useful. As of June 2018, just keep in mind that some components have been updated: the "Redistributable" mentioned in step one is now for 2015, not 2012 the latest version of Apache Server is 2.4.33 the zip file you download should reflect "2.4.33" or "2-4-33" in its name
McKan   Jun 04, 2018
Very well documented. Easy to follow
Sharon Bhalla   Nov 30, 2017
Very nice document
Share This Post
Windows Operating System
Windows 7 Pro 64-Bit
Windows 7 Pro 64-Bit
See More Details
Windows Manuals & Books
Windows Manuals & Books
See More Details
H3XED © Nick Vogt   RSS   Policies   Twitter