Installing Apache webserver

Apache is the webserver, which makes sure that your machine becomes capable of serving webpages. You may not want to run a public webserver on your machine, but Apache is good for testing purposes as well, it's very easy to setup, and it works great with PHP. Apache is free software, which, very simply put, means that the source code is available and you don't have to pay for it.

Apache can be downloaded from Giving a direct link to a download would not make sense, since Apache is often updated. Go to the download page, and select the proper download link under the header saying something like "Apache HTTP Server X.X.X is the best available version". As of writing, the current version is 2.2.4. If you're a Windows user, which this tutorial assumes, then please click the download link saying "Win32 Binary (MSI Installer)". Using an installer makes the whole thing much easier.

After downloading it, start the installer and accept the license terms etc. Everything should be very standard, until you reach this screen:

You may enter localhost in the first two fields, like I've done. They are not that important for our purposes, and neither are the e-mail field. The radiobuttons are a bit more important - you should decide whether or not the webserver should be installed as a service, which will be started automatically by Windows, or as a standard application, which you may start manually. The automatic version will operate on port 80, which is the default port for HTTP communication, while the manual version operates on another port, 8080 in this case. As you can see, I have selected the second option. My computer already runs another webserver on port 80, and besides, I only need this for testing, so starting the server manually when I need it works best for me.

On the next screen, simply select Typical, and move on. You will get to the screen where you select a path to install the server to. The default path will work fine. Now go on through the wizard, and let it install the required files. When you're done, you may start the server by selecting Start -> Apache HTTP Server -> Control Apache server -> Start Apache in Console. If you have a firewall, it might ask you whether or not it should unblock Apache. If you wish to be able to access your server from a non-local computer, you should say yes to that.

Now your new server should be running. To test it, point your browser to http://localhost/ if you installed it on port 80, or http://localhost:8080/ if you installed the manual version. You should see a text telling you that everything works fine. Congratulations, you now have a webserver.

In the folder where you installed Apache, usually something like C:\Program Files\Apache Software Foundation\Apache2.2\, you will find a folder called "htdocs". This is very important, since it serves as the root of your webserver. You may try creating a new file, and then access it through http://localhost:8080/filename, e.g. http://localhost:8080/test.html. You may create subfolders as well. When we test stuff through the chapters of this tutorial, we save it to the htdocs folder, to be able to access it through our webserver, so don't forget about it anytime soon.

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!