November 20, 2008

How To Install Apache 2.2

NOTE: The instructions that follow are for installs on a Windows Operating system. Before installing, ensure that IIS is not installed or at least running.

Installing Apache

If you are new to server side scripting, you may have heard that you need a web server. No, you don’t need to have a big corporate sized computer. A web server a computer program that is responsible for accepting HTTP requests from web clients (your browser) and returning an HTML page and the Apache HTTP Server is just what you need.


  1. Go to http://httpd.apache.org/download.cgi to get the latest released version. At the time I wrote this, Apache 2.2.10 was the latest.

  2. Download the Win32 Binary without crypto (MSI Installer) by Right clicking on the apache_2 link and select Save Target As. The other files available are not relevant to you right now.

  3. Double click the MSI Installer you just downloaded and start to run through the Install Wizard.

  4. When you get to the Server Information section, enter the following:
    • Network Domain - localhost (Not Important; Used during initialization only)
    • Server's Name - localhost (This is standard)
    • Administrator’s Email Address - YOUR EMAIL

      NOTE: The word localhost refers to your PC. When using the browser on your PC, you can either use localhost or your PC name. If you use a PC that is on the same network, you will have to use the PC name to access the website.
  5. Choose the Typical installation then change the install directory to C:\Apache\Apache2.2\. It is not necessary to change the installation directory, but in the future it will be more convenient to do so.

  6. Finish going through the Install Wizard.
  7. After the installation is complete and you see that Apache is started (look in the system tray by the clock for the Apache Monitor to be green not red)
  8. Open your favorite browser and type: http://localhost/
  9. A page that says, "It Works!" should pop up. If this does not happen, there was a problem with the installation.
  10. Go to C:\Apache\Apache2.2\conf directory (or wherever you install Apache) and open the httpd.conf file. This file contains all the information that Apache uses to be configured. Take some time and read over this file. There is great documentation all throughout it and it will give you a better understanding of what Apache can do.
  11. The main thing you need to change is the DocumentRoot (Not the ServerRoot). You will notice that right now by default, it is pointing to /htdocs. This is the starting directory for your web site. Inside you will find a file called index.html. With the Apache default configuration, if there is not a file specified in the URL (http://localhost/), Apache will return the page marked index.html. If you want to store your Web Site in a different location on your PC, you will need to change the DocumentRoot and the directive below it that is pointing to /htdocs.
    NOTE: Remove the '#' in front of ServerName (ServerName localhost), otherwise it will generate a Warning in the Apache error log everytime it restarts. (It complains that it can't resolve the Domain Name)
  12. After you have made any changes, you must restart the Apache Service for the changes to take effect.
  13. Right now, you are configured only to run HTML pages from your PC. If you are going to run PHP pages, Read the How to Install PHP 5.2 installation post.

If you have any question or comments, don't hesitate to leave a comment.

No comments:

Post a Comment