How to Install Apache Web Server on Windows

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.

How to Install Apache Web Server on Windows
Starting 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:

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

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:

  • How to Install PHP
  • How to Install MySQL
  • MySQL: the Pros and Cons of MyISAM Tables
  • MySQL: the Pros and Cons of InnoDB Tables
  • How to Use MySQL Foreign Keys for Quicker Database Development

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

If you enjoyed reading this post, you’ll love Learnable; the place to learn fresh skills and techniques from the masters. Members get instant access to all of SitePoint’s ebooks and interactive online courses, like PHP & MySQL Web Development for Beginners.


Category: programming Time: 2009-04-07 Views: 3

Related post

  • How to install Apache Web Server from OSGeo4W? 2014-08-20

    Good morning, I'm trying to create a QGIS web client on my Windows 8 But with OSGEO4W not appear the option to make Apache installs Web Server, as of this writing in several tutorials and documentations. A print screen of my Windows 8 Should this wel

  • Is it easy to install Apache web server on Ubuntu desktop? 2012-05-17

    So I have decided to build a Ubuntu computer, for now I am going to dual boot with Win7, and then install apache web server. Figured I would give the whole web thing a try. Did some searching but didn't find something powerful enough, I will continue

  • How to access apache web server on Ubuntu from windows 2015-08-14

    I have Ubuntu server installed along with apache web server for php development. I have configured local network with ip and setup domain as mylocal.loc for the ubuntu server. And I have another system installed with ubuntu desktop having

  • How to use Apache web server through proxy (hide real ip) on windows? 2015-12-26

    What I want to do is: (1) internet -> domain name -> proxyip:port -> apache web server (and) (2) apache web server -> proxyip:port -> internet Looks like I have already set (1) with the help of dynamic dns service, but how to do (2) ? And I

  • Help with installing Apache Web Server! 2011-07-26

    Okay, so up until recently, I've been hosted by someone else. Now, I'm trying out Apache web server (which is restating the obvious, given the title). I downloaded this one: httpd-2.2.19-win32-x86-openssl-0.9.8r.msi Is it the correct version? I'm run

  • When Installing Apache Web Server 2011-07-26

    And you go to http://localhost, are you supposed to see a message that says "It works!" If not, how do you fix this? Operating system: Windows 7 Apache Web Server:Win32 Binary including OpenSSL 0.9.8r (MSI Installer): httpd-2.2.19-win32-x86-open

  • How to configure Apache web server to redirect the requests it receives without modifying the source IP? 2015-06-11

    Unfortunately I don't know about web servers but I'm trying to help a colleague. We have an Apache web server setup and we need it to redirect resend the requests it gets to an application server while keeping the source ip the same it was when apach

  • How to get Apache web server to run on other computers? 2010-04-16

    I have been using Apache Web Server for a while now and one thing I have noticed is that outside of my computer I can not access it. I use my Apache server for PHP development on my computer, but I would like to access stuff I have made outside of my

  • Configuration of QGIS Server with Apache Web Server on Windows 7 (64 bit) 2014-05-07

    I have installed QGIS Server(version 2.X) on my machine (Win. 7 64 bit OS & installed on C:\OSGeo4W64) while installing I found that for 64 bit Apache web server was not available hence its separately installed on C drive (C:\Apache24) Now tested Apa

  • How to install LiteSpeed web server on CentOS 7 2015-12-26

    LiteSpeed web server is a popular choice for replacing Apache web server. Its features include an optimization of the web content and content delivery which maximizes the download speed and combines better performance with a smaller memory footprint.

  • How to install MS SQL Server on Windows Server 2012 with virtual environment? 2015-06-08

    I am working in SharePoint content publishing and branding. Now I am interested to learn more about central administration site , search and so on. I don't have full access in the office. So I decide to set-up share point environment in my laptop. I

  • Installing Apache Web Server 2011-07-05

    Total beginner, but need to run some coldfusion scripts, and from what I gather need to have Apache HTTP server installed along with ColdFusion trial edition to do so. I'm installing Apache HTTP Server 2.2 using the installation wizard, and it's aski

  • Linux - Apache Web Server behind Windows Network 2010-02-10

    We have a local Windows Server 2003 DNS server that handles all incoming requests. We used to host our website locally on IIS, which our local DNS server would point to for incoming requests. We recently ditched our IIS server for a hosted VPS runnin

  • How to install a web server on Ubuntu 14.04? 2014-04-22

    :~$ sudo apt-get install tasksel Reading package lists... Done Building dependency tree Reading state information... Done Package tasksel is not available, but is referred to by another package. This may mean that the package is missing, has been obs

  • How to install Cherokee web server on Debian Wheezy? 2013-07-12

    I'm trying to install Cherokee webserver on Debian Wheezy. All the docs and websites that I've visited suggest that apt-get install cherokee will do it, but when I do that, I see: $ apt-get install cherokee Reading package lists... Done Building depe

  • How to Install PHP 5.3 on Windows 2009-07-07

    With all the excitement surrounding Firefox 3.5, it may have escaped your attention that PHP 5.3 has also been released. This is the most significant update since version 5.0 and several features that were originally scheduled for version 6.0 have be

  • How can I configure /etc/hosts file to point to apache web server? 2012-04-08

    I have installed apache web server and I need to point with alias (www.someaddress.lan) to local apache. What is the proper way to do it? How to point someaddress.lan to default apache page and www.someaddress.lan to /var/www/wordpress/? --

  • Apache web server and accessing my website outside local machine 2011-04-04

    So I installed Apache web server/MySQL/myPhpAdmin on my windows machine. It's on my desktop. Everything works where if I go to http://localhost, localhost/phpinfo.php and localhost/phpmyadmin.index.php they all show up on my machine. Now I want other

  • Apache Web Server Problem 2009-10-27

    In my office, I have a newly installed server machine and 15 client machines. In my server machine I installed apache web server which is running without any inturuption. But the client machines did not find my server's apache web server. Here is the

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.644 (s). 13 q(s)