Installing the Apache Web Server

The version of the Apache web server needed for this class can be downloaded from our class website by clicking here. Follow the detailed instructions below. In addition, you must ensure you use the following options:

If you do not follow the instruction, your account will be suspended.


The following procedure is for reference only and it does not include all the required settings of the assignment.  For more detailed installation procedures, you should read the documentation that comes with the Apache package (see htdocs subdirectory) or the online documentation at http://www.apache.org/docs/.
The following procedure describes how to install the Apache 1.3.26 binary, so that you do not need to compile the software. The procedure may vary for other Apache versions.


Download and Unpack Apache Package

  1. Download the 1.3.26 binary version of the Apache web server from the class website by clicking here or download any version 1.3.xx from http://www.apache.org/dist/httpd/ (do not download version 2.0 as it is too big for your quota on the class machines).
  2. Unpack the server and place it in your home account.

If you are using Netscape and the file downloaded from the Apache website has a name looks like apache_n_n_n_tar.tar, where x is the version number, rename it to apache_n.n.n.tar.gz.
If you download the file from the course website, it is already unzipped and you can go to step 3.
e.g. Assume your user account directory is /home/scf-03/myname/, and your want to unpack apache files there.

    1. place apache_n.n.n.tar.gz under your user directory (not needed when downloading from the class website)
    2. unzip the gzip package by running "gunzip apache_n.n.n.tar.gz" (not needed when downloading from the class website)
    3. unpack the tar package by running "tar xvf apache_n.n.n.tar"
    4. you should delete apache_n.n.n.tar which is no longer needed

          A directory tree /home/scf-03/myname/apache_n.n.n will be created.


Install Apache 1.3.x Binary

  1. In the Apache binary distribution directory just created, e.g. /home/scf-03/myname/apache_n.n.n, type the following command to install the binary files.

install-bindist.sh /absolute/path/to/apache/directory

 

The directory /absolute/path/to/apache/directory/ can be a new directory, e.g. /home/scf-03/myname/apache, or the same as the source distribution, e.g. /home/scf-03/myname/apache_n.n.n. We recommend that you use the same directory for installation since this way no binary distribution directory will need to be deleted.
If instead you use a new directory for installation, you may delete the binary distribution directory after the installation has completed. During installation, which could last as long as 5 minutes, you should see this output:

      csci571b.usc.edu(1): install-bindist.sh /home/scf-03/myname/apache_1.32.26

      Installing binary distribution for platform sun4u-sun-solaris2.280
      into directory /home/scf-03/myname/apache_1.3.26 ..

      [Preserving existing configuration files.]
      [Preserving existing htdocs directory.] 
      Ready.
       +--------------------------------------------------------+
       | You now have successfully installed the Apache 1.3.26  |
       | HTTP server. To verify that Apache actually works      |
       | correctly you should first check the (initially        |
       | created or preserved) configuration files:             |
       |                                                        |
       |   /home/scf-03/myname/apache_1.3.26/conf/httpd.conf
       |                                                        |
       | You should then be able to immediately fire up         |
       | Apache the first time by running:                      |
       |                                                        |
       |   /home/scf-03/myname/apache_1.3.26/bin/apachectl start 
       |                                                        |
       | Thanks for using Apache.       The Apache Group        |
       |                                http://www.apache.org/  |
       +--------------------------------------------------------+

       csci571b.usc.edu(2): 

 

Important Note: Before starting your server you must first configure it as explained below.

Configure Apache

The only configuration file Apache uses is conf/httpd.conf. PLEASE examine the directives shown below and make sure they are properly set.

You probably do not need to modify some parameters if you installed the Apache by its configuration program.  However, you must ensure the paths in the configuration files are correct.

Global Environment

o        ServerRoot /absolute/path/to/apache/directory (this will be automatically set)

o        MinSpareServers 2

o        MaxSpareServers 2

o        StartServers 2

o        MaxClients 2

o        LockFile /var/tmp/httpd.lock  (You need to "uncomment" this line, i.e., remove the '#' sign. If you do not change this value you may encounter a problem with the lock file. Check error_log file for more info)

Main Server Configuration
Again, some pathnames were setup by the configuration program already but you still have to ensure their consistency.

o        Port port_selected (use the last 5 digits of your class ID as the base for this value)

o        ServerAdmin your_email

o        DocumentRoot your_document_root

o        You need an entry for your document root directory.
<Directory your_document_root
...
...
</Directory

The default setting is /absolute/path/to/apache/directory/htdocs/, e.g. /home/scf-03/myname/apache/htdocs/. However, you can change it to any other directory you like. 


Starting and Stopping Apache

To start the server, in directory bin, type apachectl start. The following ouput should be displayed:

      csci571b.usc.edu(47): apachectl start   
      apachectl start: httpd started

It is a good practice to check the error log file, e.g. /home/scf-03/myname/apache/logs/error_log, to ensure your server is properly running. You can also check that the Apache 'httpd' processes are running, using the 'ps' UNIX command:

      csci571b.usc.edu(2): ps -gx
         PID TT       S  TIME COMMAND
       21476 ?        S  0:01 /home/scf-03/myname/apache_1.3.26/bin/httpd -d /home/scf-03/myname/apache_1.3.26 -R /home/scf-03/myname/apache_1.3.26/libexec
       21477 ?        S  0:00 /home/scf-03/myname/apache_1.3.26/bin/httpd -d /home/scf-03/myname/apache_1.3.26 -R /home/scf-03/myname/apache_1.3.26/libexec
       21478 ?        S  0:00 /home/scf-03/myname/apache_1.3.26/bin/httpd -d /home/scf-03/myname/apache_1.3.26 -R /home/scf-03/myname/apache_1.3.26/libexec

Similarly, to stop the server, in director bin, type apachectl stop. The following output should be displayed:

      csci571b.usc.edu(48): apachectl stop   
      apachectl stop: httpd stopped

Testing Your Server

By issuing the URL

http://csci571.usc.edu:port_selected/    session#1
or
     http://csci571b.usc.edu:port_selected/   session#2

you should see the Apache default page. Find the page and replace it by the one you create, to make sure your new server is loading the page you think it is.

Copy the test-cgi script in the Apache package to your cgi directory. Remember to allow EVERYONE to have EXECUTE rights (permissions) to your cgi-bin directory and scripts (chmod go+x). You can test the authentication by

http://csci571.usc.edu:port_selected/scripts/test-cgi   session#1
or
http://csci571b.usc.edu:port_selected/scripts/test-cgi   session#2

Useful Links for Installing and Configuring Apache Server

File Download - http://www.apache.org/dist/
Server Documentation - http://www.apache.org/docs/