configuring.html.en revision 33f5e027b85636ab978d3f8e2c74b07e260f60b4
842ae4bd224140319ae7feec1872b93dfd491143fielding<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
842ae4bd224140319ae7feec1872b93dfd491143fielding<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
842ae4bd224140319ae7feec1872b93dfd491143fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
842ae4bd224140319ae7feec1872b93dfd491143fielding This file is generated from xml source: DO NOT EDIT
842ae4bd224140319ae7feec1872b93dfd491143fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb --><title>Configuration Files - Apache HTTP Server</title><link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="/images/favicon.ico" rel="shortcut icon" /></head><body id="manual-page"><div id="page-header"><p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="/images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="./">Version 2.0</a></div><div id="page-content"><div id="preamble"><h1>Configuration Files</h1>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<p>This document describes the files used to configure the Apache
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbHTTP server.</p>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd</div><div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#main">Main Configuration Files</a></li><li><img alt="" src="/images/down.gif" /> <a href="#syntax">Syntax of the Configuration Files</a></li><li><img alt="" src="/images/down.gif" /> <a href="#modules">Modules</a></li><li><img alt="" src="/images/down.gif" /> <a href="#scope">Scope of Directives</a></li><li><img alt="" src="/images/down.gif" /> <a href="#htaccess">.htaccess Files</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div><div class="section"><h2><a name="main" id="main">Main Configuration Files</a></h2>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="/mod/mod_mime.html">mod_mime</a></code></li></ul></td><td><ul><li><code class="directive"><a href="/mod/core.html#ifdefine"><IfDefine></a></code></li><li><code class="directive"><a href="/mod/core.html#include">Include</a></code></li><li><code class="directive"><a href="/mod/mod_mime.html#typesconfig">TypesConfig</a></code></li></ul></td></tr></table>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd <p>Apache is configured by placing <a href="mod/directives.html">directives</a> in plain text
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb configuration files. The main configuration file is usually
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb called <code>httpd.conf</code>. The location of this file is
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb set at compile-time, but may be overridden with the
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh configuration files may be added using the <code class="directive"><a href="/mod/core.html#include">Include</a></code> directive. Any
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb directive may be placed in any of these configuration files.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh Changes to the main configuration files are only recognized by
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb Apache when it is started or restarted.</p>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <p>New with Apache 1.3.13 is a feature where if any
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb configuration file is actually a directory, Apache will enter
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb that directory and parse any files (and subdirectories) found
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb there as configuration files. One possible use for this would
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb be to add VirtualHosts by creating small configuration files
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb for each host, and placing them in such a configuration
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb directory. Thus, you can add or remove VirtualHosts without
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb editing any files at all, simply adding or deleting them. This
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb makes automating such processes much easier.</p>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <p>The server also reads a file containing mime document types;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb the filename is set by the <code class="directive"><a href="/mod/mod_mime.html#typesconfig">TypesConfig</a></code> directive,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div><div class="section"><h2><a name="syntax" id="syntax">Syntax of the Configuration Files</a></h2>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <p>Apache configuration files contain one directive per line.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb The back-slash "\" may be used as the last character on a line
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb to indicate that the directive continues onto the next line.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb There must be no other characters or white space between the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb back-slash and the end of the line.</p>
f888346b48f5e5b5e3f0a47dedb8cefd2759a4e2gregames <p>Directives in the configuration files are case-insensitive,
750d12c59545dbbac70390988de94f7e901b08f2niq but arguments to directives are often case sensitive. Lines
82632a19f2f9c346fee2b28a65920ba9737b3973minfrin which begin with the hash character "#" are considered
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb comments, and are ignored. Comments may <strong>not</strong> be
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb included on a line after a configuration directive. Blank lines
db455cbc662c98dbbf53175393c50086ff63370cchrisd and white space occurring before a directive are ignored, so
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb you may indent directives for clarity.</p>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <p>You can check your configuration files for syntax errors
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb without starting the server by using <code>apachectl
36ef8f77bffe75d1aa327882be1b5bdbe2ff567asf option.</p>
36ef8f77bffe75d1aa327882be1b5bdbe2ff567asf </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div><div class="section"><h2><a name="modules" id="modules">Modules</a></h2>
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="/mod/mod_so.html">mod_so</a></code></li></ul></td><td><ul><li><code class="directive"><a href="/mod/core.html#ifmodule"><IfModule></a></code></li><li><code class="directive"><a href="/mod/mod_so.html#loadmodule">LoadModule</a></code></li></ul></td></tr></table>
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz <p>Apache is a modular server. This implies that only the most
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz basic functionality is included in the core server. Extended
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz features are available through <a href="mod/">modules</a> which can be loaded
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz into Apache. By default, a <a href="mod/module-dict.html#Status">base</a> set of modules is
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz included in the server at compile-time. If the server is
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz compiled to use <a href="dso.html">dynamically loaded</a>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb modules, then modules can be compiled separately and added at
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb any time using the <code class="directive"><a href="/mod/mod_so.html#loadmodule">LoadModule</a></code>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb directive.
4f9c22c4f27571d54197be9674e1fc0d528192aestriker Otherwise, Apache must be recompiled to add or remove modules.
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe Configuration directives may be included conditional on a
4f9c22c4f27571d54197be9674e1fc0d528192aestriker presence of a particular module by enclosing them in an<code class="directive"><a href="/mod/core.html#ifmodule"><IfModule></a></code> block.</p>
4f9c22c4f27571d54197be9674e1fc0d528192aestriker <p>To see which modules are currently compiled into the server,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb you can use the <code>-l</code> command line option.</p>
4f9c22c4f27571d54197be9674e1fc0d528192aestriker </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div><div class="section"><h2><a name="scope" id="scope">Scope of Directives</a></h2>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td /><td><ul><li><code class="directive"><a href="/mod/core.html#directory"><Directory></a></code></li><li><code class="directive"><a href="/mod/core.html#directorymatch"><DirectoryMatch></a></code></li><li><code class="directive"><a href="/mod/core.html#files"><Files></a></code></li><li><code class="directive"><a href="/mod/core.html#filesmatch"><FilesMatch></a></code></li><li><code class="directive"><a href="/mod/core.html#location"><Location></a></code></li><li><code class="directive"><a href="/mod/core.html#locationmatch"><LocationMatch></a></code></li><li><code class="directive"><a href="/mod/core.html#virtualhost"><VirtualHost></a></code></li></ul></td></tr></table>
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb <p>Directives placed in the main configuration files apply to
4f9c22c4f27571d54197be9674e1fc0d528192aestriker the entire server. If you wish to change the configuration for
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb only a part of the server, you can scope your directives by
4f9c22c4f27571d54197be9674e1fc0d528192aestriker placing them in <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code>, <code class="directive"><a href="/mod/core.html#directorymatch"><DirectoryMatch></a></code>, <code class="directive"><a href="/mod/core.html#files"><Files></a></code>, <code class="directive"><a href="/mod/core.html#filesmatch"><FilesMatch></a></code>, <code class="directive"><a href="/mod/core.html#location"><Location></a></code>, and <code class="directive"><a href="/mod/core.html#locationmatch"><LocationMatch></a></code>
4f9c22c4f27571d54197be9674e1fc0d528192aestriker sections. These sections limit the application of the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb directives which they enclose to particular filesystem
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd locations or URLs. They can also be nested, allowing for very
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd fine grained configuration.</p>
a72211e92bab814bfa28ee086ca9b2a1a6095c92chrisd <p>Apache has the capability to serve many different websites
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe simultaneously. This is called <a href="vhosts/">Virtual
963f8b44ac95132458ea3b6aaa8ebc135188e473takashi Hosting</a>. Directives can also be scoped by placing them
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe inside <code class="directive"><a href="/mod/core.html#virtualhost"><VirtualHost></a></code>
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe sections, so that they will only apply to requests for a
2d399cd7535887fceaa9f8f116eb98ce68ddd602trawick particular website.</p>
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe <p>Although most directives can be placed in any of these
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe sections, some directives do not make sense in some contexts.
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar For example, directives controlling process creation can only
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe be placed in the main server context. To find which directives
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar can be placed in which sections, check the <a href="mod/directive-dict.html#Context">Context</a> of the
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe directive. For further information, we provide details on <a href="sections.html">How Directory, Location and Files sections
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div><div class="section"><h2><a name="htaccess" id="htaccess">.htaccess Files</a></h2>
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td /><td><ul><li><code class="directive"><a href="/mod/core.html#accessfilename">AccessFileName</a></code></li><li><code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code></li></ul></td></tr></table>
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe <p>Apache allows for decentralized management of configuration
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe via special files placed inside the web tree. The special files
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames are usually called <code>.htaccess</code>, but any name can be
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe specified in the <code class="directive"><a href="/mod/core.html#accessfilename">AccessFileName</a></code>
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe directive. Directives placed in <code>.htaccess</code> files
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe apply to the directory where you place the file, and all
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe sub-directories. The <code>.htaccess</code> files follow the
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar same syntax as the main configuration files. Since
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar <code>.htaccess</code> files are read on every request, changes
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar made in these files take immediate effect.</p>
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar <p>To find which directives can be placed in
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar <code>.htaccess</code> files, check the <a href="mod/directive-dict.html#Context">Context</a> of the
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar directive. The server administrator further controls what
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar directives may be placed in <code>.htaccess</code> files by
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz configuring the <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code>
2a6e98ba4ffa30ded5d8831664c5cb2a170a56b6coar directive in the main configuration files.</p>
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar <p>For more information on <code>.htaccess</code> files, see
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar Ken Coar's tutorial on <a href="http://apache-server.com/tutorials/ATusing-htaccess.html">
8419e6f8bff1a3617933f3ba760d2bdec7442f44coar </div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div></body></html>