configuring.html.en revision 9f0a19b58dacd195b044c5989afedb67903d74f2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Configuration Files</TITLE>
</HEAD>
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
<BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#000080"
ALINK="#FF0000"
>
<!--#include virtual="header.html" -->
<H1 ALIGN="CENTER">Configuration Files</H1>
<ul>
<li><a href="#main">Main Configuration Files</a></li>
<li><a href="#syntax">Syntax of the Configuration Files</a></li>
<li><a href="#modules">Modules</a></li>
<li><a href="#scope">Scope of Directives</a></li>
<li><a href="#htaccess">.htaccess Files</a></li>
<li><a href="#logs">Log Files</a></li>
</ul>
<hr>
<H2><a name="main">Main Configuration Files</a></H2>
<table border="1"><tr><td valign="top">
<strong>Related Modules</strong><br><br>
</td>
<td valign="top">
<strong>Related Directives</strong><br><br>
</td></tr></table>
>directives</A> in plain text configuration files. The main
location of this file is set at compile-time, but may be overridden
with the <CODE>-f</CODE> command line flag. In addition, other
configuration files may be added using the <CODE><A
directive may be placed in any of these configuration files. Changes
to the main configuration files are only recognized by Apache when it
is started or restarted.</p>
<P>
The server also reads a file containing mime document types; the
filename is set by the <A HREF="mod/mod_mime.html#typesconfig"
<hr>
<H2><a name="syntax">Syntax of the Configuration Files</a></H2>
<P>Apache configuration files contain one directive per line. The
back-slash "\" may be used as the last character on a line to indicate
that the directive continues onto the next line. There must be no
other characters or white space between the back-slash and the end of
the line.
<P>Directives in the configuration files are case-insensitive, but
arguments to directives are often case sensitive. Lines which begin
with the hash character "#" are considered comments, and are ignored.
Comments may <STRONG>not</STRONG> be included on a line after a
configuration directive. Blank lines and white space occurring before
a directive are ignored, so you may indent directives for clarity.
<P>You can check your configuration files for syntax errors without
starting the server by using <CODE>apachectl configtest</CODE>
or the <CODE>-t</CODE> command line option.
<hr>
<H2><a name="modules">Modules</a></H2>
<table border="1"><tr><td valign="top">
<strong>Related Modules</strong><br><br>
</td>
<td valign="top">
<strong>Related Directives</strong><br><br>
</td></tr></table>
<P>Apache is a modular server. This implies that only the most basic
functionality is included in the core server. Extended features are
can be loaded into Apache. By default, a <A
HREF="mod/module-dict.html#Status">base</A> set of modules is
included in the server at compile-time. If the server is compiled to
can be compiled separately and added at any time using the <A
HREF="mod/mod_so.html#loadmodule">LoadModule</A> directive.
Otherwise, Apache must be recompiled to add or remove modules.
Configuration directives may be included conditional on a presence of
a particular module by enclosing them in an <A
<P>To see which modules are currently compiled into the server,
you can use the <CODE>-l</CODE> command line option.
<hr>
<H2><a name="scope">Scope of Directives</a></H2>
<table border="1"><tr><td valign="top">
<strong>Related Directives</strong><br><br>
</td></tr></table>
<P>Directives placed in the main configuration files apply to the entire
server. If you wish to change the configuration for only a part of
the server, you can scope your directives by placing them in
</CODE> and <CODE>
</CODE>
sections. These sections limit the application of the directives
which they enclose to particular filesystem locations or URLs. They
can also be nested, allowing for very fine grained configuration.
<P>Apache has the capability to serve many different websites
simultaneously. This is called <A HREF="vhosts/">Virtual Hosting</A>.
Directives can also be scoped by placing them inside
sections, so that they will only apply to requests for a particular
website.
<P>Although most directives can be placed in any of these sections,
some directives do not make sense in some contexts. For example,
directives controlling process creation can only be placed in the main
server context. To find which directives can be placed in which
sections, check the <A
HREF="mod/directive-dict.html#Context">Context</A> of the directive.
For further information, we provide details on <A
HREF="sections.html">How Directory, Location and Files sections
work</A>.
<hr>
<H2><a name="htaccess">.htaccess Files</a></H2>
<table border="1"><tr><td valign="top">
<strong>Related Directives</strong><br><br>
</td></tr></table>
<P>Apache allows for decentralized management of configuration via
special files placed inside the web tree. The special files are
usually called <CODE>.htaccess</CODE>, but any name can be specified
>AccessFileName</CODE></A> directive. Directives placed in
<CODE>.htaccess</CODE> files apply to the directory where you place
the file, and all sub-directories. The <CODE>.htaccess</CODE> files
follow the same syntax as the main configuration files. Since
<CODE>.htaccess</CODE> files are read on every request, changes made
in these files take immediate effect.
<P>To find which directives can be placed in <CODE>.htaccess</CODE>
of the directive. The server administrator further controls what
directives may be placed in <CODE>.htaccess</CODE> files by
configuring the <A
directive in the main configuration files.
<hr>
<H2><a name="logs">Log files</a></H2>
<!-- XXX: This section should be moved to its own file -->
<H3>security warning</H3>
Anyone who can write to the directory where Apache is writing a
log file can almost certainly gain access to the uid that the server is
started as, which is normally root. Do <EM>NOT</EM> give people write
access to the directory the logs are stored in without being aware of
document for details.
<H3>pid file</H3>
<P>On startup, Apache saves the process id of the parent httpd process to
process-id is for use by the administrator in restarting and
terminating the daemon: on Unix, a HUP or USR1 signal causes the
daemon to re-read its configuration files and a TERM signal causes it
to die gracefully; on Windows, use the -k command line option instead.
For more information see the <A HREF="stopping.html">Stopping and
Restarting</A> page.
<P>
If the process dies (or is killed) abnormally, then it will be necessary to
kill the children httpd processes.
<H3>Error log</H3>
<P>The server will log error messages to a log file, by default
Windows and OS/2. The filename can be set using the <A
logs can be set for different <A
<H3>Transfer log</H3>
<P>The server will typically log each request to a transfer file, by
directive; different transfer logs can be set for different <A
<!--#include virtual="footer.html" -->
</BODY>
</HTML>