configuring.html revision e062fc6828fd09a9d45ee879d4f6c2dac8d37385
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa BGCOLOR="#FFFFFF"
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksa TEXT="#000000"
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksa LINK="#0000FF"
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa VLINK="#000080"
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa ALINK="#FF0000"
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa<!--#include virtual="header.html" -->
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<li><a href="#main">Main Configuration Files</a></li>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<li><a href="#syntax">Syntax of the Configuration Files</a></li>
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa<li><a href="#scope">Scope of Directives</a></li>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<H2><a name="main">Main Configuration Files</a></H2>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#ifdefine"><IfDefine></A><br>
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa<A HREF="mod/mod_mime.html#typesconfig">TypesConfig</A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Apache is configured by placing <A HREF="mod/directives.html"
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa>directives</A> in plain text configuration files. The main
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaconfiguration file is usually called <CODE>httpd.conf</CODE>. The
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksalocation of this file is set at compile-time, but may be overridden
2007ce65c0947e10e337f55f7168590e4f7f6365Eugen Kuksawith the <CODE>-f</CODE> command line flag. Some sites also have
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksa<CODE>srm.conf</CODE> and <CODE>access.conf</CODE> files for <A
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen KuksaHREF="http://www.apache.org/info/three-config-files.html">historical
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksareasons</A>. In addition, other configuration files may be added using
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksathe <CODE><A HREF="mod/core.html#include">Include</A></CODE>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksadirective. Any directive may be placed in any of these configuration
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksafiles. Changes to the main configuration files are only recognized by
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaApache when it is started or restarted.</p>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>New with Apache 1.3.13 is a feature where if any configuration
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksafile is actually a directory, Apache will enter that directory
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksaand parse any files (and subdirectories) found there as configuration
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksafiles. One possible use for this would be to add VirtualHosts
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksaby creating small configuration files for each host, and placing
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksathem in such a configuration directory. Thus, you can add or
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaremove VirtualHosts without editing any files at all, simply
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaadding or deleting them. This makes automating such processes
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaThe server also reads a file containing mime document types; the
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksafilename is set by the <A HREF="mod/mod_mime.html#typesconfig"
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa>TypesConfig</A> directive, and is <CODE>mime.types</CODE> by default.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<H2><a name="syntax">Syntax of the Configuration Files</a></H2>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Apache configuration files contain one directive per line. The
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaback-slash "\" may be used as the last character on a line to indicate
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksathat the directive continues onto the next line. There must be no
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaother characters or white space between the back-slash and the end of
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Directives in the configuration files are case-insensitive, but
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaarguments to directives are often case sensitive. Lines which begin
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksawith the hash character "#" are considered comments, and are ignored.
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen KuksaComments may <STRONG>not</STRONG> be included on a line after a
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksaconfiguration directive. Blank lines and white space occurring before
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksaa directive are ignored, so you may indent directives for clarity.
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksa<P>You can check your configuration files for syntax errors without
97669a2ab79fef55a04bd6f0e51267e5119ddab7Eugen Kuksastarting the server by using <CODE>apachectl configtest</CODE>
cb08b6bacfcb9c0de6d66222071adbefba898097Eugen Kuksa<A HREF="mod/core.html#addmodule">AddModule</A><br>
cb08b6bacfcb9c0de6d66222071adbefba898097Eugen Kuksa<A HREF="mod/core.html#clearmodulelist">ClearModuleList</A><br>
cb08b6bacfcb9c0de6d66222071adbefba898097Eugen Kuksa<A HREF="mod/core.html#ifmodule"><IfModule></A><br>
cb08b6bacfcb9c0de6d66222071adbefba898097Eugen Kuksa<a href="mod/mod_so.html#loadmodule">LoadModule</a><br>
cb08b6bacfcb9c0de6d66222071adbefba898097Eugen Kuksa<P>Apache is a modular server. This implies that only the most basic
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksafunctionality is included in the core server. Extended features are
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaavailable through <A HREF="mod/index-bytype.html">modules</A> which
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksacan be loaded into Apache. By default, a <A
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaHREF="mod/module-dict.html#Status">base</A> set of modules is
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaincluded in the server at compile-time. If the server is compiled to
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graefuse <A HREF="dso.html">dynamically loaded</A> modules, then modules
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graefcan be compiled separately and added at any time using the <A
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaHREF="mod/mod_so.html#loadmodule">LoadModule</A> directive.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaOtherwise, Apache must be recompiled to add or remove modules.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaConfiguration directives may be included conditional on a presence of
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaa particular module by enclosing them in an <A
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaHREF="mod/core.html#ifmodule"><IfModule></A> block.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>To see which modules are currently compiled into the server,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksayou can use the <CODE>-l</CODE> command line option.
5a102b3c56d4ac75632c7e9244ee0ce5bdbbf13aSascha Graef<H2><a name="scope">Scope of Directives</a></H2>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#directory"><Directory></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#directorymatch"><DirectoryMatch></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#files"><Files></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#filesmatch"><FilesMatch></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#location"><Location></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#locationmatch"><LocationMatch></A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<a href="mod/core.html#virtualhost"><VirtualHost></a><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Directives placed in the main configuration files apply to the entire
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaserver. If you wish to change the configuration for only a part of
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksathe server, you can scope your directives by placing them in
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<CODE><A HREF="mod/core.html#directory"><Directory></A>,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#directorymatch"><DirectoryMatch></A>,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#filesmatch"><FilesMatch></A>,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<A HREF="mod/core.html#location"><Location></A>,
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa<A HREF="mod/core.html#locationmatch"><LocationMatch></A>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksasections. These sections limit the application of the directives
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksawhich they enclose to particular filesystem locations or URLs. They
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksacan also be nested, allowing for very fine grained configuration.
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksa<P>Apache has the capability to serve many different websites
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksasimultaneously. This is called <A HREF="vhosts/">Virtual Hosting</A>.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaDirectives can also be scoped by placing them inside
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<CODE><A HREF="mod/core.html#virtualhost"><VirtualHost></A></CODE>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksasections, so that they will only apply to requests for a particular
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Although most directives can be placed in any of these sections,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksasome directives do not make sense in some contexts. For example,
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksadirectives controlling process creation can only be placed in the main
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaserver context. To find which directives can be placed in which
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksasections, check the <A
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaHREF="mod/directive-dict.html#Context">Context</A> of the directive.
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaFor further information, we provide details on <A
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen KuksaHREF="sections.html">How Directory, Location and Files sections
e8ec59dda8f903e81cb5cceaef93d20a0812fc77Eugen Kuksa<A HREF="mod/core.html#accessfilename">AccessFileName</A><br>
e8ec59dda8f903e81cb5cceaef93d20a0812fc77Eugen Kuksa<A HREF="mod/core.html#allowoverride">AllowOverride</A><br>
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<P>Apache allows for decentralized management of configuration via
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksaspecial files placed inside the web tree. The special files are
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksausually called <CODE>.htaccess</CODE>, but any name can be specified
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksain the <A HREF="mod/core.html#accessfilename"><CODE
aeee7f45fea603773fa9aa176ca54683af4c08bcEugen Kuksa>AccessFileName</CODE></A> directive. Directives placed in
aeee7f45fea603773fa9aa176ca54683af4c08bcEugen Kuksa<CODE>.htaccess</CODE> files apply to the directory where you place
89a44b1ca5aa6007b102831cc4a4e306fd32507bEugen Kuksathe file, and all sub-directories. The <CODE>.htaccess</CODE> files
aeee7f45fea603773fa9aa176ca54683af4c08bcEugen Kuksafollow the same syntax as the main configuration files. Since
006de713cc0c62dc3dd8549f4d74c00e8b822dd2Eugen Kuksa<CODE>.htaccess</CODE> files are read on every request, changes made
<!--#include virtual="footer.html" -->