The
Apache Configuration Files
The
two key configuration files for the Apache web server are httpd.conf
in the
/etc/httpd/conf directory and ssl.conf in the
/etc/httpd/conf.d directory. The default
versions of these files
create a generic web server service. There are other configuration
files in two directories: /etc/httpd/conf and /etc/httpd/conf.d.
Apache
can work with a lot of other software, such as Python, PHP, the
Squid
Proxy server, and more. If installed, associated configuration
files can generally be
found in the /etc/httpd/conf directory.
To
configure a regular and a secure web server, you’ll need to
understand the httpd.conf and ssl.conf configuration files in some
detail.
Analyze
the Default Apache Configuration
Apache
comes with a well-commented set of default configuration files. In
this
section, you’ll examine some key directives in the httpd.conf
configuration file.
Browse through this file in your favorite text
editor or using a command pager such
as less. Before beginning this
analysis, remember that the main Apache configuration
file
incorporates the files in the /etc/httpd/conf.d directory with the
following
directive:
Include
conf.d/*.conf
There
are a couple of basic constructs in httpd.conf. First, directories,
files, and
modules are configured in “containers.” The beginning
of the container starts with
the name of the directory, file, or
module to be configured, contained in directional
brackets (< >).
Examples of this include
<Directory
"/var/www/icons">
<Files
~ "^\.ht">
<IfModule
mod_mime_magic.c>
The
end of the container is also an expression inside brackets (<>),
which starts
with a forward slash (/). For the same examples, the
ends of the containers would
look like
</Directory>
</Files>
</IfModule>
Next,
Apache includes a
substantial number of directives—commands that
Apache can understand that have some resemblance to English. For
example, the
ExecCGI directive supports executable CGI scripts.
While
this provides an overview, the devil is often in the details, which
are
analyzed (briefly) in the next section. If you’ve installed
the httpd-manual RPM, get
the Apache server going, and navigate to
http://localhost/manual.