Installing Apache on Microsoft Windows
Here I describe installation and configuration of Apache. These instructions should be valid for version 2.0.x and above.
- Go to http://www.apache.org/dist/httpd/binaries/win32/
- Choose a mirror.
- Click on the latest MSI Installer Package release. Something like apache_2.2.6-win32-x86-no_ssl.msi
- Double-click on the .msi file you downloaded
- Click on next
- Accept license and click on next
- In the Server Information window, input the following: Network Domain: localhost Server Name: localhost Admin Email: admin@localhost Check for All Users, on Port 80, as a Service and click on next
- Choose Typical and click on next
- Click on change and change Installation directory to c:\Apache2.2\
- Click on next and Install
Starting stopping and restarting Apache
After the installion, Apache2 starts automatically. You should also see the start icon in the system tray. It is composed of a feather and the play symbol. You can click on this icon to start, stop or restart Apache. Alternately you can go to:
Start > All Programs > Apache HTTP Server 2.2.x > Control Apache Server
From here you can choose to start, stop, or restart Apache. Once, you install your server, I recommend that you restart the server to see if there are any errors.
The requested operation has failed! If you get "The requested operation has failed!" error, then you need go to
Start > All Programs > Apache HTTP Server 2.2.x > Configure Apache Server > Test Configuration
to find the error. If nothing else works, uninstall and reinstall Apache.
Another Apache service is already running You get this error message when you have multiple installations of apache. Several pre-configured server packages such as the one provided by http://www.devside.net install Apache. The easiest solution is to remove other apache installations. If you, however, wish to have multiple copies, you can go to http://www.heritage-tech.net/336/setting-up-multiple-apache-local-web-sites-on-your-computer/ to get some guidance.
Checking Apache error log
To check Apache error log, you need do the following:
Start > All Programs > Apache HTTP Server 2.2.x > Review Server log File > Review Server Log
All errors generated by Apache are logged in this file.
Testing the installation Open your browser and type: http://127.0.0.1/ or http://localhost/. If you see the words "It works!", then your server is up and running. If it doesn't, then restart Apache service and try again.
Pointing Apache to your files
By default, Apache points to c:\Apache2_2\htdocs, where c:\Apache2_2 is the installation directory we defined earlier. Suppose we would like to create out website at c:\www, we would have to point Apache to this address. To do so, we need to edit the httpd.conf file. There are two ways to to this. We can either go to:
Start > All Programs > Apache HTTP Server 2.2.x > Configure Apache Server > Edit the httpd.conf Configuration File
or simply open c:\Apache2_2\conf\httpd.conf with notepad.
Before you modify httpd.conf, you MUST create a backup copy of this file.
- create folder c:\www
- create an html file called index.html inside c:\www
- Place the following html inside index.html
<html><body>I see you</body></html>
- Search for DocumentRoot.
- Put a '#' symbol in front of DocumentRoot "c:/Apache2_2" to comment it out
- Type DocumentRoot "c:/www" underneath this line.
- Search for <Directory "c:\Apache2_2\htdocs">
- Put a '#' symbol in front of <Directory "c:\Apache2_2\htdocs"> to comment it out
- Type <Directory "c:\www"> underneath this line.
- Restart Apache service
- Type http://localhost.
If you see you "I see you", you are in business. If it didn't work, go back to httpd.conf and make sure that you made the right modifications.