• Configure a virtual host.
  • Configure private directories.
  • Deploy a basic CGI application.
  • Configure group-managed content.

Install apache:

yum -y install httpd httpd-manual links

The httpd-manual is a great resource for information, but isn’t needed. The links package is needed for the server-status utilities.

First, let’s create our virtual hosts. We’ll need to create our DocumentRoot directories.


Next, you’ll need to edit the /etc/httpd/conf/httpd.conf


When you enable virtual hosts in apache, the default website in /var/www/html will not work. You will have to add another virtual host if you want to serve content from that directory. In this configuration, apache will intercept the http headers and look at the destination url and direct traffic based upon that information.

Now that the httpd.conf has been modified, we’ll need to restart apache.


You’ll notice that you can use the ‘httpd -S’ command to show the virtual hosts residing on the server. Let’s create some content to view in the virtual hosts.


Now, let’s try to view the content.


A quick peak at the error_log shows why we can’t view the page(s).

Notice, that I labeled the index files index.htm. Be default, index.html and index.html.var are the default index pages AND apache, by default, doesn’t print a directory listing as a default index page if a index.html or index.html.var page doesn’t exist. So, to fix this, I had to add index.htm to the “DirectoryIndex” directive in the httpd.conf

Now, let’s try this again.

Now, the sites are working. So, let’s go on to the next objective of configuring private directories.

We’ll set up vhost.server1.example.com to create a private directory with.


Now, let’s go ahead and set up group managed content, then we’ll deploy a cgi application.


This time, the user ‘james’ was allowed because the user was in the ‘sysadmin’ group. Now the cgi application.

The last and final objective, though not on the RHCE offical list, it’s a useful tool for working with httpd servers. Setting up the server-status tool.

First, you’ll need to edit the httpd.conf.

You can use ‘apachectl status|fullstatus’ to get real time statistics of the web server utilization.

October 27, 2012

Posted In: Apache, http, Linux, RHCE Study Notes