1261N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
970N/A<
TITLE>Configuring Apache</
TITLE>
970N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 970N/A<
H1 ALIGN="CENTER">Configuring Apache</
H1>
970N/A<
H2>Main Configuration Files</
H2>
970N/A>directives</
A> in plain text configuration files. The main
1207N/Alocation of this file is set at compile-time, but may be overridden
970N/Awith the <
CODE>-f</
CODE> command line flag. Some sites also have
982N/Areasons</
A>. In addition, other configuration files may be added using
982N/Adirective. Any directive may be placed in any of these configuration
1153N/Afiles. Changes to the main configuration files are only recognized by
982N/AApache when it is started or restarted.
1261N/AThe server also reads a file containing mime document types; the
1261N/A<
H2>Syntax of the Configuration Files</
H2>
1261N/A<
P>Directives in the configuration files are case-insensitive, but
1261N/Aarguments to directives are often case sensitive. Lines which begin
1261N/Awith the hash character "#" are considered comments, and are ignored.
970N/AComments may <
STRONG>not</
STRONG> be included on a line after a configuration
1261N/Adirective. White space occurring before a directive
1261N/Ais ignored, so you may indent directives for clarity.
970N/A<
P>You can check your configuration files for syntax errors without
1169N/Astarting the server by using <
CODE>apachectl configtest</
CODE>
1207N/Aor the <
CODE>-t</
CODE> command line option.
1169N/A<
P>Apache is a modular server. This implies that only the most basic
1169N/Afunctionality is included in the core server. Extended features are
1169N/Abe loaded into Apache. By default, a <
A 1207N/Aincluded in the server at compile-time. If the server is compiled to
970N/Ause <
A HREF="dso.html">dynamically loaded</
A> modules, then modules
970N/Acan be compiled separately and added at any time using the <
A 1207N/AOtherwise, apache must be recompiled to add or remove modules.
970N/A<
P>To see which modules are currently compiled into the server,
1207N/Ayou can use the <
CODE>-l</
CODE> command line option.
1123N/A<
H2>Scope of Directives</
H2>
970N/A<
P>Directives placed in the main configuration files apply to the entire
970N/Aserver. If you wish to change the configuration for only a part of
1207N/Athe server, you can scope your directives by placing them in
1207N/Asections. These sections limit the application of the directives
1207N/Awhich they enclose to particular filesystem locations or URLs. They
970N/Acan also be nested, allowing for very fine grained configuration.
1207N/A<
P>Apache has the capability to serve many different websites
970N/Asimultaneously. This is called <
A HREF="vhosts/">Virtual Hosting</
A>.
970N/ADirectives can also be scoped by placing them inside
970N/Asections, so that they will only apply to requests for a particular
970N/A<
P>Although most directives can be placed in any of these sections,
1123N/Asome directives do not make sense in some contexts. For example,
1207N/Adirectives controlling process creation can only be placed in the main
1123N/Aserver context. To find which directives can be placed in which
970N/AFor further information, we provide details on <
A 970N/A<
H2>.htaccess Files</
H2>
970N/A<
P>Apache allows for decentralized management of configuration via
1123N/Aspecial files placed inside the web tree. The special files are
1123N/Ausually called <
CODE>.htaccess</
CODE>, but any name can be specified
1123N/A>AccessFileName</
CODE></
A> directive. Directives placed in
970N/A<
CODE>.htaccess</
CODE> files apply to the directory where you place
1207N/Athe file, and all sub-directories. The <
CODE>.htaccess</
CODE> files
970N/Afollow the same syntax as the main configuration files. Since
970N/A<
CODE>.htaccess</
CODE> files are read on every request, rather than
1207N/Aonly at server startup, changes made in these files take immediate
1207N/A<
P>To find which directives can be placed in <
CODE>.htaccess</
CODE>
1169N/Aof the directive. The server administrator further controls what
1207N/Adirectives may be placed in <
CODE>.htaccess</
CODE> files by
1169N/Adirective in the main configuration files.
970N/AAnyone who can write to the directory where Apache is writing a
1261N/Alog file can almost certainly gain access to the uid that the server is
1261N/Astarted as, which is normally root. Do <
EM>NOT</
EM> give people write
970N/Aaccess to the directory the logs are stored in without being aware of
1261N/A<
P>On startup, Apache saves the process id of the parent httpd process to
970N/Aprocess-id is for use by the administrator in restarting and
1261N/Aterminating the daemon: on Unix, a HUP or USR1 signal causes the
1261N/Adaemon to re-read its configuration files and a TERM signal causes it
1261N/Ato die gracefully; on Windows, use the -k command line option instead.
1169N/AIf the process dies (or is killed) abnormally, then it will be necessary to
1207N/Akill the children httpd processes.
1169N/A<
P>The server will log error messages to a log file, by default
1261N/AWindows and OS/2. The filename can be set using the <
A 970N/Alogs can be set for different <
A 1207N/A<
P>The server will typically log each request to a transfer file, by
1261N/Adirective; different transfer logs can be set for different <
A