This popular article was updated in 2020.
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 you prefer …)
A web server is software that listens for requests and returns data (usually a file). When you type “www.mysite.com”, the request is forwarded to a machine running web server software which returns a file back to your browser — such as the contents of
Since the web server sits between your browser and the requested file, it can perform processing that’s 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’ve been fully tested. What you need is a local web server installation.
In general, it’s good to use the web server software that your web host uses. Unless you’re creating ASP.NET applications on Microsoft IIS, your host is likely to use Apache — the most widespread and fully-featured web server available. It’s an open-source project, so it doesn’t cost anything to download or install.
The following instructions describe how to install Apache on Windows. macOS comes with Apache and PHP. Most Linux users will have Apache pre-installed or available in the base repositories.
There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file — such as XAMPP (for Windows, Linux and macOS), WampServer and WampDeveloper Pro. There’s 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 offers several benefits:
- Backing up, reinstalling, or moving the web server can be achieved in seconds.
- 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
Apache listens for requests on TCP/IP port 80. You need to uninstall or disable any program that uses that port. 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.
Step 2: Download the files
We’re going to use the unofficial Windows binary from Apache Lounge. This version has performance and stability improvements over the official Apache distribution, although I’m yet to notice a significant difference. However, it’s provided as a manually installable ZIP file from www.apachelounge.com/download/.
You should also download and install the Windows C++ runtime from Microsoft.com. You may have this installed already, but there is no harm installing it again.
As always, remember to virus scan all downloads.
Step 3: Extract the Files
We’ll install Apache in
C:/Apache24, so extract the ZIP file to the root of the
C:/ drive. Apache can be installed anywhere on your system, but you’ll need to change
SVROOT configuration to point to your unzipped location — suh as
Step 4: Configure Apache
Apache is configured with the text file
conf/httpd.conf contained in the Apache folder. Open it with your favorite 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:/Apache24, now is a good time to search and replace all references to
There are several lines you should change for your production environment:
Line 60, listen to all requests on port 80:
Line 162, enable mod-rewrite by removing the # (optional, but useful):
LoadModule rewrite_module modules/mod_rewrite.so
Line 227, specify the server domain name:
Line 224, allow
How to Install Apache Web Server on Windows