Setting up an Apache web server with LinuxConf on RedHat 6.0
by Dan Potter
1999.09.13.01
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.
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.
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.
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.
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.
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.
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:
cd /home
chown -R user. httpdNote! Replace "user" in the command above with the user name of the web master, which was setup earlier.
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:
cd /home/httpd/html
mv index.html index_old.html
pico index.html
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 .
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.