How to install Apache2 for win32

This article is something that i went looking for and did not find when i started playing with web stuff. I just needed a simple guide like this that gave me all the info i needed to know and let me know what each of the functions and questions are. Also a bit of a guide to editing the conf file to set up your server. I recommend you run apache on a windows2000 or windows XP machine.

Ok here we go.


Step 1. Download the latest version of apache from here.

Go for the apache2 win32 MSI installer. Its the file that ends in .MSI


Step 2. Ok you have downloaded it. Go and run it. Click next. Click on ACCEPT. Click next again. and again.

Ok this is what you get.

If this is a public server, and you have a proper domain name for it, in my case i will use "rainwulf.com" for the first entry and "www.rainwulf.com" for the second entry. If you are going to be using a dynamic ip service like DynDNS, you can just put "myserver.com" and "www.myserver.com" or anything you want there.

If this is for public usage, its better to install it as a service. You can change the access port later on in the configuration. If this server is for only testing purposes, IE if you are testing your own web pages, make it for the current user on port 8080.

Next step, just click on Typical and then click Next.

Next up is where apache is going to install itself. You can change this if you want. Otherwise its perfectly fine where it is.

Next click Install.

It will install it self and you are set. The program is now installed and you will get this icon on the taskbar.

This is the Apache monitor. Dont worry about that yet, because you have to edit the httpd.conf file to point apache to where your html files are.

Reboot now, so the Apache web server service can be installed.


Step 3. Time for the complicated process.

You will have to edit the httpd.conf file. Navigate your start menu to find "Apache HTTP server", and then navigate to "Configure Apache Server" and then click "Edit the Apache httpd.conf Configuration File"

Up will pop wordpad with the apache configuration file, or the .conf file.

This file controls every aspect of the servers behaviour, and is quiet complex to start with, but it has clearly defined areas. It comes complete, so you only have to change a few areas.

Ok these are the things you will have to change or at least make sure are correct.

Scroll down and you will see a command called "Listen"

Make sure the number after that is either 80 for a public server, or change it to a port number (preferably above 8000) that you can give to the users who you want to have access to the server. For example if you change it to 8080, users can access your web site by using "http://www.[your server name].com:8080 or "http://[your ip address]:8080"

In my case with rainwulf.com with an ip of 202.9.57.186, if i changed listen to 8080, you could access my website with

http://www.rainwulf.com:8080 or http://202.9.57.186:8080

Scroll down and look for "Section 2: 'Main' Server Configuration"

You will find the Main server configuration settings. Each setting is explained and shows an example of what it should be.

As you scroll down you will see different configuration options.

ServerAdmin: make sure that is the right email address.

ServerName : In my case it will be www.rainwulf.com:80

UseCanonicalName : leave this at default.

DocumentRoot: ok this is important. In my case it will be "d:/server" for you, you should put here where your HTML files are store, for example "c:/htmlfiles" or "d:/server_root". You must use FORWARD slashes, and dont end the line with a slash.

Now if you are using this server just as a file storage and want to allow users to browse around your directories and download files at will, move on to the next setting. However if you dont want anyone to browse your folders, and this is what it should be for public webservers, you will need to include this line to stop the directory traverse.

You will see a group of words like this

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>


To disable directory traversing, you must change it to this.

<Directory />
Options FollowSymLinks -indexes
AllowOverride None
</Directory>

The next important thing is

<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

Thats what it looks like by default. Change that to what you put in "DocumentRoot"

The -index switch must also be used in this segment as well.

Where you see

Options Indexes FollowSymLinks

change it to:

Options -Indexes FollowSymLinks

Once that is done, users wont be able to look inside the directories.

Now, save the .conf file and make sure that your server dir has at least an index.html file in it.

Ok now right click the apache monitor and bring up the services monitor. Restart apache.

Now open up your browser and type in the address bar "http://localhost"

If you have got a custom port, add it on the end like this "http://localhost:8080"

Now if in your directory you have got a INDEX.HTML your browser will display that page.

Make a folder inside your server directory, and go back to your browser and type in "http://localhost/foldername"

now if you have DISABLED the index with the "-" you should get a Forbidden error.

If you havent, you should have up a listing of whats in that folder, at this stage nothing. In this way you can use apache to serve files over a lan without the hassle of sharing folders with windows.

Thats it!! If you have any questions email me. This has just been a simple quick guide to getting Apache up and running on your machine. The conf file is documented fully, and contains links to online information sources to help tweak and setup your installation.

Cheers, Rainwulf.

8 June 2003