Setting up an Apache web server with LinuxConf on RedHat 6.0
by Dan Potter
1999.09.13.01


  1. Apache Software Installation

    The installation of the Apache software itself should have occured during initial RedHat setup; the relevant RPM file is apache-1.3.6-7.

  2. Finding the apache section in Linuxconf

    As with most other things in this course, we'll be configuring Apache the easy way, with Linuxconf. To get to the Apache section of Linuxconf, you'll need to page down a few pages. It is under Config, Networking, Server Tasks, Apache Web Server. If there is not a "-" beside the Apache Web Server heading, then press ENTER on it to expand that tree. Under there you will find Defaults, Virtual Domains, and Sub-directory specs. We will deal with each of these in turn.

  3. Defaults

    Following is a short explanation of each relevant field, and an example of the kind of information that would be entered in that field. You'll need to substitute the info from the machine you are actually setting up.

    1. Administrator email. The email address of the administrator of this box; generally that's you! This address will show up if the servers gets an error during operations. You'll probably want to use the email address that you're going to setup for yourself on the server box. If your company already has internal email of some kind, then you'll probably want to put your address here.
    2. Server name. The DNS name of the machine you're creating. This was decided upon earlier in the setup, during the basic host information setup. This name will be sent to the client during redirects, so it needs to be a valid name (listed in your DNS records and accessable by clients).
    3. Document root. The location on the local filesystem where your web files will live. For example, if you access a page on your server as http://box.foobar.com/page.html then the page will actually live on the server as /home/httpd/html/page.html by default. Changing this value will change the "/home/httpd/html" part of that path. Generally you should leave this as is.
    4. Misc settings under "Features". These settings let you tune various aspects of the web server. Some of these may be of interest to you as a webmaster, so some info on them is included here. These will not be discussed during class, however. For further information, you should do some homework on the Apache site. If anything below goes over your head, don't worry! You don't need these for the basic setup.
      • Server side includes allow you to write .shtml files; these files allow you to do a primitive form of dynamic content by constructing files on the fly as they are served to clients.
      • Indexes controls whether the server will provide a directory listing for a URL if there is no index.html file there.
      • May follow symlinks allows the web server to follow symbolic links when loading files. For example, if you put a symbolic link from the /home/httpd directory to somewhere outside (like your home directory), this directive would allow you to access it through a web browser (instead of producing an error).
      • Follow symlink if owner matches is like the above option, but it checks to make sure that the directory where the symlink resides belongs to the same person as the destination of the link.
  4. Virtual Domains

    Virtual Domains is a powerful feature of Apache that lets you run a server that serves multiple domains on a single machine. This feature is useful but is outside the scope of this course; please see the Apache site for more information.

  5. Sub-directory specs

    Sub-directory specs let you take the global settings that you setup above in "Defaults" and apply small changes to those to specific directories. For example, you may want to allow dynamic (.shtml) files only within the /news directory on your web server. You would then add a sub-directory spec for /home/httpd/news that has the "Server side includes" checkbox turned on. This feature is useful but is outside the scope of this course; please see the Apache site for more information.

  6. Testing the server

    Select "Act/Changes" on Linuxconf to activate your web server changes. Confirm the actions and let it restart Apache.

    Use a web browser on another machine to access your server. For example, if your server's name is "www", then try the following URL: "http://www/" You should then see the RedHat default congratulations page. If you don't see this, then check the settings you entered above to make sure it's all correct.

  7. Setting up your web site

    Now that Apache is configured, you may place your web pages on the server. Unless you changed the defaults above, the files will go in /home/httpd/html on the server filesystem. Note that this directory is only writable by root by default; it is often convienent to make these directories owned by the maintainer so that one doesn't have to use root access to edit the pages. You can do that when logged in as root with the following commands from a shell prompt:

    If you want to post CGI scripts, those should go in /home/httpd/cgi-bin.

    Note that when you load up your own HTML files, you'll need to rename or erase the default RedHat files. Let's run through a little example so you can see how this works. Type each of the following commands from a shell prompt:

    Now that you're in Pico, type a few words of wisdom and save the file. You should now see your page instead of the old RedHat page, and the old page will be accessable as "index_old.html". You can use FTP in the future to get the files onto the server with less hassle.

    You may also place files in each user's home directory. You simply need to create a directory called "public_html" under the home directory and place files in there. You may also need to make the user's directory traversable; to do that, navigate to that directory and execute this command:

    chmod a+x .

  8. Relevant information for further investigation

    Like other parts of this course, you may want to explore the inner workings of Apache more closely than we cover in class. Here are some relevant files and directories for editing the Apache config directly. Please exercise caution when exploring these files, should you decide to do that.