WWW Server Setup Tips
Donnie Barnes, djb@redhat.com
V1.0, March 27, 1996
1. Preface
``Red Hat Tips'' are documentation meant to help Red Hat users with
specific tasks. Some of these documents are for new users, some are
for advanced users. Hopefully each document will also be of help for
both new and advanced users. If you have contributions to make,
please send them to tech-sup@redhat.com. If you have changes that
need to be made to individual Tips, send them to the author of that
document.
2. Introduction
The basic text of this document was donated by Mark Cornick (thanks
Mark!). This Red Hat Tips file will help you with the basics of
setting up the Apache WWW server. You'll need to be root during this
entire process.
3. Getting Started
First, install the apache RPM. This will install the Apache binary,
create needed directories, and set up Apache to start automatically
when the system is booted.
Since Apache was released, a security hole has been found in the
``phf'' CGI program included. You should remove it:
rm /home/httpd/cgi-bin/phf
4. Setting up the Server
After the apache RPM is installed, several directories will be created
on your system:
/etc/httpd/conf - configuration files
/var/log/httpd - log files
/home/httpd/html - where your HTML files will go
/home/httpd/cgi-bin - where CGI programs go
/home/httpd/icons - some icons used for directory indexing, etc.
A sample home page will be installed in /home/httpd/html, and several
sample CGI programs will be installed in /home/httpd/cgi-bin.
Before starting up the server, you may want to take a look at some of
the configuration files in /etc/httpd/conf. These include:
o access.conf: This file controls access to your WWW server. One of
the things you might want to change here are the ``allow'' and
``deny'' lines, which restrict who can get WWW pages. By default,
all hosts are allowed. You may, for instance, want to change this
so that all hosts are allowed, except for one problem host:
order allow,deny
allow from all
deny from b1ff.eleet.com
This will prohibit the host b1ff.eleet.com from accessing the server,
but allow all other hosts. Another example is to restrict access to
only your own domain (for an internal WWW server):
order deny,allow
deny from all
allow from gizmonics.edu
This allows only hosts in the gizmonics.edu domain to access to
server.
o httpd.conf: This file has some general configuration information
for your WWW server. One thing you should change here is the
ServerAdmin line, which should have the address of your site's
``webmaster'':
ServerAdmin webmantis@spaceghost.com
If you want to run ``virtual hosts'', this is where you'll set up that
information. Virtual hosts are beyond the scope of this document -
consult the Apache documentation at http://www.apache.org/ for more on
this.
o mime.types: You shouldn't change anything in here.
o srm.conf: This file contains information about directories, files,
and file types on your server. Most of this can be left as is;
however, if you want to support server-side includes on your
server, you should uncomment some of the AddType lines, as
indicated in the file's comments. Server-side includes are a
potential security risk, so they are disabled by default.
5. Starting up a Web Site
Now you're ready to start adding pages to your WWW server. Just move
any HTML files, graphics, etc. you want to appear on your server into
the /home/httpd/html directory. You can create subdirectories in here
as well. Make sure that any files intended for public viewing are set
to be world readable:
chmod a+r (name-of-file)
The file named index.html will be loaded by default if no file name is
specified in the URL; that is,
http://yourhost.com/index.html
is the same as
http://yourhost.com/
So, you should name the main home page of your server as index.html.
You should be all set to go now; to start up the server, just type as
root:
httpd
(The next time you boot your system, the server will start
automatically.)
Try using a WWW browser to access your server. From X you could use:
arena http://localhost/
If you get your home page, you're all set! If not, you may get some
errors. These are common:
o ``File Not Found: the file index.html was not found on this
server'' means you need to create an index.html file, as indicated
above.
o ``Forbidden: you're not allowed to access index.html on this
server'' means you need to make the index.html file world-readable:
chmod a+r /home/httpd/html/index.html
6. Further Reading
You now have a basic WWW server running. There are several books that
can help you do more advanced things like use CGI to process forms,
use imagemaps, etc. ``Managing Internet Information Services'' by Liu,
Peek, Jones, Buus, and Nye (O'Reilly, 1994) has several chapters on
WWW servers, and also covers FTP, Gopher, and other services you may
wish to provide.
7. Copyright Notice
This document is Copyright (C) 1996 by Red Hat Software.
Redistribution of this document is permitted as long as the content
remains completely intact and unchanged. In other words, you may
reformat and reprint or redistribute only.