During the installtion of the apache RPM, 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 will want to take a look at some of
the configuration files in /etc/httpd/conf
. These include:
NOTE:Newer versions of Apache use a single configuration file. At the present time (10-18-99) Red Hat has NOT shipped a version in this format but plans to for future releases.
access.conf
: This file controls access to your web server. One of
the things you might want to change here are the ``allow'' and ``deny''
lines, which restrict who can get web 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:
<Limit GET>
order deny,allow
allow from all
deny from b1ff.eleet.com
</Limit>
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 web server):
<Limit GET>
order deny,allow
deny from all
allow from gizmonics.edu
<Limit GET>
This allows only hosts in the gizmonics.edu domain to access to
server.
httpd.conf
: This is the main file for configuration information for
your web server. Below are some of the entries you will need to modify to fit your
site.
The first things you will want to look through and modify for your web server will be the modules that are loaded. These are all based on your prefernce or need, a general rule is: If you don't know what it does, you probably don't need it. Read the documentation to learn more about each module, the features and problems of it and decide if you need it below is what this section looks like on my server, yours may vary.
# Documentation for modules is in "/home/httpd/manual/mod" in HTML format.
#LoadModule mmap_static_module modules/mod_mmap_static.so
LoadModule env_module modules/mod_env.so
LoadModule config_log_module modules/mod_log_config.so
LoadModule agent_log_module modules/mod_log_agent.so
LoadModule referer_log_module modules/mod_log_referer.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module modules/mod_status.so
LoadModule info_module modules/mod_info.so
LoadModule includes_module modules/mod_include.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule asis_module modules/mod_asis.so
LoadModule imap_module modules/mod_imap.so
LoadModule action_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule proxy_module modules/libproxy.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule anon_auth_module modules/mod_auth_anon.so
#LoadModule dbm_auth_module modules/mod_auth_dbm.so
LoadModule db_auth_module modules/mod_auth_db.so
LoadModule digest_module modules/mod_digest.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule example_module modules/mod_example.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
# Extra Modules
#LoadModule php_module modules/mod_php.so
#LoadModule php3_module modules/libphp3.so
LoadModule perl_module modules/libperl.so
# Reconstruction of the complete module list from all available modules
# (static and shared ones) to achieve correct module execution order.
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
#AddModule mod_mmap_static.c
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_log_agent.c
AddModule mod_log_referer.c
AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_proxy.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_auth_anon.c
#AddModule mod_auth_dbm.c
AddModule mod_auth_db.c
AddModule mod_digest.c
#AddModule mod_cern_meta.c
AddModule mod_expires.c
AddModule mod_headers.c
AddModule mod_usertrack.c
#AddModule mod_example.c
#AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
# Extra Modules
#AddModule mod_php.c
#AddModule mod_php3.c
AddModule mod_perl.c
The apache web server can be run from either /etc/inetd.conf
or as a standalone
server. I recommend running it as a standalone for performance and resource reasons, however
this is simply a matter of preference and need.
ServerType standalone
Now you get to choose what port you want your web server to listen for connections on, port 80 is the standard port, you can however move it to another port if you would like, just remember to give the port number to people when giving out your website. Note: For ports < 1023 you will need to be root to start the server.
Port 80
It is probably a good idea to leave the web server on port 80.
The HostnamesLookups feature is turned off by default, you can enable this by changing off to on on the line like the one below.
HostnameLookups off
This is off so that you will have to turn it on, it will reduce performance slightly as it looks up the host when it gets a connection, but will log the hostname of the client as opposed to just the ip of the client.
The next thing you need to edit is the user and group the webserver it runs as, the default is user nobody and group nobody it is probably a good idea to leave it this way for security reasons. This can be changed to run as a user by changing the lines similar to the ones below.
User nobody
Group nobody
One thing you'll need to edit will be the server admin.
ServerAdmin webmaster@spaceghost.com
The server admin is going to be the person in charge of handling your webserver, typically it is
a good idea to set this to webmaster@yourdomain.com, and then alias webmaster to the person
responsiable in the /etc/aliases
and then run the
/usr/bin/newaliases
The next thing you need to check will be the ServerRoot settings. This is the top of the directory tree under which the server's configuration, error, and log files are kept. NOTE! If you intend to place this on an NFS (or otherwise network) mounted filesystem then please read the LockFile documentation available at Apache
The Default for Red Hat Linux systems are:
ServerRoot "/etc/httpd"
You dont really need to change this, as the Apache is compiled for this path, but you can recompile Apache and move it somewhere else.
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
Apache
for more on
this.
mime.types
: You shouldn't change anything in here.
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.