As always, I suggest that you read through the entire lab before you get started!
In this lab we will configure Apache to handle multiple domains, and install a simple Perl script to support Web chat.
In our installation, apache has been installed as /usr/sbin/httpd with configuration and logging in /etc/httpd. First, start apache by modifying the services on your machine as we did in last lab (e.g., in Programs->System->Service Configuration) to start httpd and make it start at boot. Open a web browser, and visit http://localhost/. You should see a Test page for Apache on Red Hat. Now you know your httpd server is running.
Now let's create some content. The default home directory for Apache's content is in /var/www/html/. There you will find the index.html file containing the test page. Create two subdirectories (choose your own names, such as alpha and beta). Within each subdirectory, create new index.html files (do not just copy the default index.html file as we want to have two different files here). You might visit some website you like and use the browser's Save As menu to make a copy of the HTML.
Create two hostnames that map to your localhost. You can do this by modifying (if necessary) the zone files you created in last lab, or by just adding two new hosts into your /etc/hosts file and have them both map to 127.0.0.1. To test this, you should be able to use these hostnames in your web browswer, and still get the Apache/Red Hat test page.
Now we can create virtual Web sites for each of these hostnames. Apache is configured through /etc/httpd/conf/httpd.conf. Near the end of this long configuration file is a section called VirtualHost. You'll want to enable virtual hosting by uncommenting the NameVirtualHost directive (just above) and specifying the IP address to which it applies (use whatever one you used in your zone files or /etc/hosts file above). Copy the sample twice and modify the copies to match the two hostnames and two directories that you created above. Restart apache, and you should now see the host-specific index.html home pages rather than the test page with your Web browser. However, if you want to have a default host other than your first virtual host, you'll need to create a third entry (to go first). (If no Host: header is included, or doesn't match an existing VirtualHost entry, the Web server will serve using the first VirtualHost that matches.)
Fortunately for this exercise, Apache is already configured to support CGI scripts. The default directory for them is /var/www/cgi-bin/. As a demonstration of using a Perl script for CGI, we will use a simple chat application called EveryChat. Check out the local installation at http://wume.cse.lehigh.edu/~brian/chat/chatframes.html so that you know what to expect.
Download this free application from http://www.everysoft.com/everychat.html and use unzip to uncompress this zip archive and extract its contents. Take a look at the readme.txt file --- it has instructions on how to install EveryChat, and those instructions include needing to edit multiple files. This package was written on a Windows machine, and so all of the files are written with DOS-style end-of-line markers rather than UNIX end-of-line markers. For text and HTML this might not matter, but it sometimes matters for scripts. If you have problems running the Perl script, you may need to translate the format. I used the dos2unix utility; there are likely other methods. The package documentation does not mention this (potential) problem.