CIT 042 Index > Setting up Apache

Setting up Apache


  1. Go to About halfway down the page is a link for “Win32 Binary (MSI Installer).” It has a filename like apache_2.0.nn-win32-x86-no_ssl.msi (the nn stands for the version number. Download it. (Or, you can just use the one on the Perl CD that you got in class.)
  2. Now doubleclick the icon of the file you downloaded.
  3. Click Next to start the installation.
  4. Accept the terms of the license agreement; you may actually want to read it first.
  5. Read the explanatory text page that appears; it tells you where the documentation and installation readme files are.
  6. You will now see the “Server Information” page. For network domain, make up a name like; for server name, use; use your email address for the administrator’s email.
  7. Choose a “Typical” installation.
  8. Keep the suggested install directory (it doesn’t cause any problems on Windows–I tried it).
  9. Start the install.
  10. Click “Finish” to exit.


  1. From the Start menu, choose Programs->Apache HTTPD Server 2.0.nn->Control Apache Server->Start Apache in Console
  2. Go into your favorite browser and enter this URL: or http://localhost:8080. If you see the Apache welcome page, congratulations; it’s up and running.
  3. You may stop the server by pressing CTRL-C in the window that you opened in step 1 above.

Where HTML files go

Put your HTML files in the C:\Program Files\Apache Group\Apache2\htdocs directory. Let’s say you put file test.html there. You can then access it from the browser by typing http://localhost:8080/test.html in the URL area.

Where CGI files go

Put your CGI files in the C:\Program Files\Apache Group\Apache2\cgi-bin directory. Your CGI files must have the location of Perl on your system as their first line; instead of


you would put something like this:


Relative Addressing

Let’s say you have put file report.cgi into the cgi-bin directory, and test.html into the htdocs directory. To invoke the CGI script from the HTML file, you would have a tag like this in your HTML:

<form name="myForm" method="get"


If you don’t want to have to type the :8080 in the URL area, you can set Apache to listen on the standard port (port 80). First, stop Apache (if it’s running) by pressing CTRL-C in its console window.

Next, edit file C:\Program Files\Apache Group\Apache2\conf\httpd.conf. Look for a line that starts with Listen 8080 (about line 120). Change that line to Listen 80, and save the file.

Look for a line that starts with ServerName (about line 210) and get rid of the :8080 at the end of that line.

Start Apache again from the Start menu. Now you can type in the URL area of your browser, and it should take you to the main Apache page without having to use the :8080.

Running CGI from anywhere

It is a good idea to keep CGI files in their own directory, but if you want to be able to run them from any directory at all, change the configuration file as follows:

Save the configuration file and restart Apache.

Here There Be Tygers

Leave the rest of the configuration file alone unless you really know what you’re doing. If you want to see the Apache documentation, start the server and go to (or if you have changed the configuration).