By Craig Buckler

How to Install Apache Web Server on Windows

By Craig Buckler

This article was written in 2009 and remains one of our most popular posts. If you’re keen to learn more about Apache, you may find this recent article on Apache Cloudstack of great interest.

For more on workflows, watch our screencast What is npm and How Can I Use It?.

Apache on WindowsStarting web development is easy: you create a file called something.html, edit it in Notepad, and load it in a browser. Simple sites can be built using this process but, to really explore the possibilities, you need a web server.

What is a Web Server?

(Skip to the next section if necessary…)

A web server is software that listens for requests and returns data (usually a file). When you type “”, the request is forwarded to a machine running web server software which returns a file back to your browser, e.g. the contents of index.html. The browser might then make further requests based on the HTML content, e.g. CSS, JavaScript, and graphic files.

Since the web server sits between your browser and the requested file, it can perform processing that is not possible by opening an HTML file directly. For example, it can parse PHP code which connects to a database and returns data.

You can use your host’s web server for testing, but uploading will become tiresome and changes could go live before they had been fully tested. What you need is a local web server installation.

Why Apache?

In general, I would recommend using the web server software that your web host uses. Unless you are creating ASP.NET applications on Microsoft IIS, your host is likely to use Apache: the most widespread and fully-featured web server available. It is open-source project so it does not cost anything to download or install.

The following instructions describe how to install Apache on Windows. Mac OSX comes with Apache and PHP, although you might need to enable them. Most Linux users will have Apache pre-installed or available in the base repositories.

All-in-One packages

There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. XAMPP (including a Mac version), WampServer and Web.Developer. There is nothing wrong with using these packages, although manually installing Apache will help you learn more about the system and its configuration options.

The Apache Installation Wizard

An excellent official .msi installation wizard is available from the Apache download page. This option is certainly recommended for novice users or perhaps those installing Apache for the first time.

Manual Installation

Manual installation offers several benefits:

  • backing up, reinstalling, or moving the web server can be achieved in seconds (see 8 Tips for Surviving PC Failure)
  • you have more control over how and when Apache starts
  • you can install Apache anywhere, such as a portable USB drive (useful for client demonstrations).

Step 1: configure IIS, Skype and other software (optional)

If you have a Professional or Server version of Windows, you may already have IIS installed. If you would prefer Apache, either remove IIS as a Windows component or disable its services.

Apache listens for requests on TCP/IP port 80. The default installation of Skype also listens on this port and will cause conflicts. To switch it off, start Skype and choose Tools > Options > Advanced > Connection. Ensure you untick “Use port 80 and 443 as alternatives for incoming connections”.

Step 2: download the files

We are going to use the unofficial Windows binary from Apache Lounge. This version has performance and stability improvements over the official Apache distribution, although I am yet to notice a significant difference. However, it is provided as a manually installable ZIP file from

You should also download and install the Windows C++ runtime from You may have this installed already, but there is no harm installing it again.

As always, remember to virus scan all downloads.

Step 2: extract the files

We will install Apache in C:Apache2, so extract the ZIP file to the root of the C: drive.

Apache can be installed anywhere on your system, but you will need to change the configuration file paths accordingly…

Step 3: configure Apache

Apache is configured with the text file confhttpd.conf contained in the Apache folder. Open it with your favourite text editor.

Note that all file path settings use a ‘/’ forward-slash rather than the Windows backslash. If you installed Apache anywhere other than C:Apache2, now is a good time to search and replace all references to “c:/Apache2”.

There are several lines you should change for your production environment:

Line 46, listen to all requests on port 80:

Listen *:80

Line 116, enable mod-rewrite by removing the # (optional, but useful):

LoadModule rewrite_module modules/

Line 172, specify the server domain name:

ServerName localhost:80

Line 224, allow .htaccess overrides:

AllowOverride All

Step 4: change the web page root (optional)

By default, Apache return files found in its htdocs folder. I would recommend using a folder on an another drive or partition to make backups and re-installation easier. For the purposes of this example, we will create a folder called D:WebPages and change httpd.conf accordingly:

Line 179, set the root:

DocumentRoot "D:/WebPages"

and line 204:

<Directory "D:/WebPages">

Step 5: test your installation

Your Apache configuration can now be tested. Open a command box (Start > Run > cmd) and enter:

cd Apache2bin
httpd -t

Correct any httpd.conf configuration errors and retest until none appear.

Step 6: install Apache as a Windows service

The easiest way to start Apache is to add it as a Windows service. From a command prompt, enter:

cd Apache2bin
httpd -k install

Open the Control Panel, Administrative Tools, then Services and double-click Apache2.2. Set the Startup type to “Automatic” to ensure Apache starts every time you boot your PC.

Alternatively, set the Startup type to “Manual” and launch Apache whenever you choose using the command “net start Apache2.2”.

Step 7: test the web server

Create a file named index.html in Apache’s web page root (either htdocs or D:WebPages) and add a little HTML code:

<head><title>testing Apache</title></head>
<body><p>Apache is working!</p></body>

Ensure Apache has started successfully, open a web browser and enter the address http://localhost/. If all goes well, your test page should appear.

In general, most problems will be caused by an incorrect setting in the httpd.conf configuration file. Refer to the Apache documentation if you require further information.

Coming soon…

  • installing PHP as an Apache module
  • running multiple websites from one server

See also:

Have you installed Apache? Do you use an alternative web server?

For more on workflows, watch our screencast What is npm and How Can I Use It?.

  • Anonymous

    Does this work with Vista?

  • Vadim P.

    I just copy/pasted some apt-get command which installed apache, php, mysql and configured them all.

    One problem though is that I have to be root in order to edit the files – they’re in /var/www :

  • Does this work with Vista?

    Yes it does … I’m using it now! In fact, manual installation often throws fewer issues than Windows installers. If you have the UAC enabled, you might want to start the command line as an administrator just to make sure nothing quirky occurs.

  • wwb_99

    No reason you have to remove IIS to get Apache running–they both co-exist nicely, you just need to get them listening on different IPs and/or ports. Ports is easiest–just set the Listen *:80 to something other than port 80.

  • That is a good point – IIS and Apache will run concurrently. However, for the sake of sanity, most people are likely to choose one and stick with it. Apache is more powerful than the Windows Professional or VS.NET versions of IIS unless you’re doing ASP.NET or Classic ASP development.

  • transparent_opa

    Nice picture of a Mac Book to go with the article :P

  • RedTalon


    Nice article.

    I wonder if there are any issues with running Apache on Windows as opposed to Linux.

    I’m thinking why bother with Windows when I can just set the whole server up with Linux. Using the mod_mono module for Apache I can even run ASP.Net apps on my LAMP server.

    Any thoughts?

  • RedTalon: Because it’s nice to be able to test websites on your desktop PC, without having to upload them to a server, and most desktop PCs are running Windows.

  • @RedTalon
    I’ve been running Apache, PHP and MySQL on Windows for several years without any obvious problems. I suppose the only problem you might encounter is mods that work on one OS but not another – but all ones I’ve tested are fine.

    As Dan pointed out, it’s often more convenient to develop and test on your main PC.

    With regard to .NET, I’d still recommend using the server your host does. If they’re using IIS then testing on Apache/Mono is likely to throw the odd incompatibility issue.

  • Just a sidenote, some CMS packages can be downloaded, packed with a webserver. They’ve done this with Drupal (dont know of any others) and you can download a single package containing the webserver stack and Drupal on top of it:
    I reckon you can also use the packed webserver with other systems but I’m not sure, as I haven’t tried it yet.

  • @peach
    Thanks for the link to Acquia. It looks interesting, although it could be configured to just run Drupal. Once you have Apache, PHP and MySQL on your PC, installing Drupal or any other LAMP application is not difficult.

  • Good article.

    You may like to add the following information also:

    1. Just as using the command “net start apache”, you may stop the Apache service by using “net stop apache”. It will be useful if you intend to free the memory and cpu resources.

    2. In addition to “localhost”, you may point your browser to the computer name (as set in the system information), or, or you may map any fancy name (even “Google”) to your localhost by editing the Windows “Hosts” file which resides in %SystemRoot%system32driversetc.

    3. Running Apache in your local system would be especially useful in testing new themes and plugins if you use a popular blog/cms package like WordPress and/or when you wish to try your hand in programming with PHP.

    My dos pesos!


  • You forgot to mention wampserver that can be found here.


    It includes the latest Php, MySql, and Apache server.
    Works on Vista and has a forum.

    I use it on XP to work with Elxis CMS.

    One tip, load the server before programs like skype, messenger, etc..

  • One option for getting Apache, PHP & MySQL up and running very quickly is EasyPHP:

    I often recommend this to newbies’s looking at learning PHP or just wanting to easily test code locally.

    It’s obviously not a good option for power users or for running a production server, but is a useful tool that does exactly what it claims, :)

    Best Wishes,

Get the latest in Front-end, once a week, for free.