20.3 Objective 3: Operate and
Perform Basic Configuration of Apache
Apache is
a phenomenal open source success story. Despite the
availability of commercial web servers, Apache continues to be
the most popular web server on the Internet. It is also widely
deployed inside corporate networks for managing internal
communications. Apache is known as an HTTP daemon, or httpd .
Because it is so popular and likely to be
found on just about every Linux server, understanding the
basics of Apache administration is required for Exam 102.
20.3.1 Configuring Apache
Apache is
configured using one or more text files. The names and
locations of Apache configuration files vary by distribution.
If you acquire Apache as source code, compile it, and install
it, you get the default setup as provided with the software.
If you use the preconfigured Apache version that came with a
Linux distribution, things may be somewhat different. A
typical Apache configuration is controlled by three files located in
/etc/httpd/conf or
/usr/local/apache/conf,
depending on how Apache is installed:
- httpd.conf
-
This file
contains general attributes about the Apache server, such as
the name of the administrator, the username under which the
server should execute, how logging is handled, and others.
- srm.conf
-
This file
is used to specify some local parameters about your system
and your web site. Included here are definitions for the top
of the HTML tree, where CGI programs are located, languages,
and more.
- access.conf
-
This is a
security definition file, which controls access to the
server by client browsers.
Configuration is managed through configuration directives, one per line, in each of the files.
The configuration files can also contain comments, which begin
with a #. Directives are in the form: DirectiveName [argument-list]
For example, the DocumentRoot
directive, which tells Apache where the top of the HTML tree
is located, might look like this: DocumentRoot /home/httpd/html
Here are some basic Apache configuration directives:
- ServerType
-
This directive can be either
standalone or inetd. If you prefer
to have inetd listen for inbound HTTP requests, set
this to inetd and configure inetd.conf as
needed. For web servers that see a significant amount of
traffic, standalone is often specified, making
Apache independent of inetd, and running
indefinitely.
- Port
-
This parameter defines the port to which
Apache listens. The default HTTP port is 80.
- User and Group
-
These two parameters determine the name and
group, respectively, that Apache executes under. Typical
examples are nobody, www, and
httpd.
- ServerAdmin
-
This directive specifies the email address
of the administrator, such as root@localhost.
- DocumentRoot
-
This directive tells Apache where to find
the top of the HTML tree, such as /home/httpd/html.
- UserDir
-
System users may use a standard personal
subdirectory for their own HTML documents. This directive
determines the name of that directory. It is often set to
public_html. Files for user jdean would be
accessed using a URL of http://localhost/~jdean.
Of course, there are many more, and
additional syntax is used when necessary. In
access.conf, groups can be delineated by keywords that
look like HTML. Directives in such a group affect only a
subset of the content served by Apache. For example, the
following group of directives controls CGI execution in
/home/httpd/cgi-bin: <Directory /home/httpd/cgi-bin>
AllowOverride None
Options ExecCGI
</Directory>
The LPI exam Objectives don't specify
particular Apache configuration directives, but you
should be prepared to interpret various configuration
examples and have knowledge of the three configuration
files and their likely locations.
|
20.3.2 Starting and Stopping
Apache
Typically, Apache
is managed through the runlevel system and the series of
scripts and links in /etc/rc.d. See Chapter
5 for information on starting and stopping services such
as Apache.
|