configuring.xml revision 1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<?xml version='1.0' encoding='UTF-8' ?>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $Revision: 1.11 $ -->
acc36ab93565d2880447d535da6ca6e5feac7a70nd
acc36ab93565d2880447d535da6ca6e5feac7a70nd<!--
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Copyright 2002-2004 The Apache Software Foundation
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Licensed under the Apache License, Version 2.0 (the "License");
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding you may not use this file except in compliance with the License.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding You may obtain a copy of the License at
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding
acc36ab93565d2880447d535da6ca6e5feac7a70nd http://www.apache.org/licenses/LICENSE-2.0
acc36ab93565d2880447d535da6ca6e5feac7a70nd
acc36ab93565d2880447d535da6ca6e5feac7a70nd Unless required by applicable law or agreed to in writing, software
acc36ab93565d2880447d535da6ca6e5feac7a70nd distributed under the License is distributed on an "AS IS" BASIS,
acc36ab93565d2880447d535da6ca6e5feac7a70nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
acc36ab93565d2880447d535da6ca6e5feac7a70nd See the License for the specific language governing permissions and
acc36ab93565d2880447d535da6ca6e5feac7a70nd limitations under the License.
acc36ab93565d2880447d535da6ca6e5feac7a70nd-->
acc36ab93565d2880447d535da6ca6e5feac7a70nd
acc36ab93565d2880447d535da6ca6e5feac7a70nd<manualpage metafile="configuring.xml.meta">
7db9f691a00ead175b03335457ca296a33ddf31bnd
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Configuration Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<summary>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<p>This document describes the files used to configure the Apache
654d8eb036bedc99e90e11910ee02d3421417697rbowenHTTP server.</p>
654d8eb036bedc99e90e11910ee02d3421417697rbowen</summary>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <section id="main">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Main Configuration Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <modulelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <module>mod_mime</module>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </modulelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">IfDefine</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core">Include</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="mod_mime">TypesConfig</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Apache is configured by placing <a
654d8eb036bedc99e90e11910ee02d3421417697rbowen href="mod/directives.html">directives</a> in plain text
6da407b2e43a613ec833f14d8c05d4494a27f17aslive configuration files. The main configuration file is usually called
f629fd8f821ed20d16d76733bc19bf5480986220slive <code>httpd.conf</code>. The location of this file is set at
f629fd8f821ed20d16d76733bc19bf5480986220slive compile-time, but may be overridden with the <code>-f</code>
f629fd8f821ed20d16d76733bc19bf5480986220slive command line flag. In addition, other configuration files may be
f629fd8f821ed20d16d76733bc19bf5480986220slive added using the <directive module="core">Include</directive>
f629fd8f821ed20d16d76733bc19bf5480986220slive directive, and wildcards can be used to include many configuration
f629fd8f821ed20d16d76733bc19bf5480986220slive files. Any directive may be placed in any of these configuration
f629fd8f821ed20d16d76733bc19bf5480986220slive files. Changes to the main configuration files are only
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen recognized by Apache when it is started or restarted.</p>
4c291e02d98a08f4d39944dd30621f1930f92268rbowen
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>The server also reads a file containing mime document types;
6da407b2e43a613ec833f14d8c05d4494a27f17aslive the filename is set by the <directive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive module="mod_mime">TypesConfig</directive> directive,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive and is <code>mime.types</code> by default.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <section id="syntax">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Syntax of the Configuration Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Apache configuration files contain one directive per line.
4c291e02d98a08f4d39944dd30621f1930f92268rbowen The back-slash "\" may be used as the last character on a line
b20a53da22140b5a3d221a19a12142f89f1b606drjung to indicate that the directive continues onto the next line.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive There must be no other characters or white space between the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive back-slash and the end of the line.</p>
b20a53da22140b5a3d221a19a12142f89f1b606drjung
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Directives in the configuration files are case-insensitive,
2c622f66478e959cbd229a2b56a028153d8b01bbrbowen but arguments to directives are often case sensitive. Lines
2c622f66478e959cbd229a2b56a028153d8b01bbrbowen that begin with the hash character "#" are considered
2c622f66478e959cbd229a2b56a028153d8b01bbrbowen comments, and are ignored. Comments may <strong>not</strong> be
6da407b2e43a613ec833f14d8c05d4494a27f17aslive included on a line after a configuration directive. Blank lines
6da407b2e43a613ec833f14d8c05d4494a27f17aslive and white space occurring before a directive are ignored, so
f629fd8f821ed20d16d76733bc19bf5480986220slive you may indent directives for clarity.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>You can check your configuration files for syntax errors
6da407b2e43a613ec833f14d8c05d4494a27f17aslive without starting the server by using <code>apachectl
6da407b2e43a613ec833f14d8c05d4494a27f17aslive configtest</code> or the <code>-t</code> command line
6da407b2e43a613ec833f14d8c05d4494a27f17aslive option.</p>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </section>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <section id="modules">
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <title>Modules</title>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <related>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <modulelist>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <module>mod_so</module>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </modulelist>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <directivelist>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <directive module="core" type="section">IfModule</directive>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <directive module="mod_so">LoadModule</directive>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </directivelist>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </related>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
954857c6508d60fd4e0a8c304698b25a15adbf33poirier <p>Apache is a modular server. This implies that only the most
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf basic functionality is included in the core server. Extended
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf features are available through <a
954857c6508d60fd4e0a8c304698b25a15adbf33poirier href="mod/">modules</a> which can be loaded
6f3d07d3152232d46eda8f3d97a511bcb1c82d3dsf into Apache. By default, a <a
6f3d07d3152232d46eda8f3d97a511bcb1c82d3dsf href="mod/module-dict.html#Status">base</a> set of modules is
6f3d07d3152232d46eda8f3d97a511bcb1c82d3dsf included in the server at compile-time. If the server is
6f3d07d3152232d46eda8f3d97a511bcb1c82d3dsf compiled to use <a href="dso.html">dynamically loaded</a>
6f3d07d3152232d46eda8f3d97a511bcb1c82d3dsf modules, then modules can be compiled separately and added at
6da407b2e43a613ec833f14d8c05d4494a27f17aslive any time using the <directive module="mod_so">LoadModule</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directive.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Otherwise, Apache must be recompiled to add or remove modules.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Configuration directives may be included conditional on a
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf presence of a particular module by enclosing them in an <directive
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf module="core" type="section">IfModule</directive> block.</p>
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf <p>To see which modules are currently compiled into the server,
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf you can use the <code>-l</code> command line option.</p>
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf </section>
c4e9ed6b7b211388ed42d520562a02f8a7fccf49sf
c4e9ed6b7b211388ed42d520562a02f8a7fccf49sf <section id="scope">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Scope of Directives</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">Directory</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">DirectoryMatch</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">Files</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">FilesMatch</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">Location</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">LocationMatch</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">VirtualHost</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Directives placed in the main configuration files apply to
4c291e02d98a08f4d39944dd30621f1930f92268rbowen the entire server. If you wish to change the configuration for
6da407b2e43a613ec833f14d8c05d4494a27f17aslive only a part of the server, you can scope your directives by
6da407b2e43a613ec833f14d8c05d4494a27f17aslive placing them in <directive module="core"
199a8ee5984e3708982fab1ba6ebb0a5feaea90cnd type="section">Directory</directive>, <directive module="core"
4c291e02d98a08f4d39944dd30621f1930f92268rbowen type="section">DirectoryMatch</directive>, <directive module="core"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive type="section">Files</directive>, <directive module="core"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive type="section">FilesMatch</directive>, <directive module="core"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive type="section">Location</directive>, and <directive module="core"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive type="section">LocationMatch</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive sections. These sections limit the application of the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directives which they enclose to particular filesystem
4c291e02d98a08f4d39944dd30621f1930f92268rbowen locations or URLs. They can also be nested, allowing for very
6da407b2e43a613ec833f14d8c05d4494a27f17aslive fine grained configuration.</p>
1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6kess
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <p>Apache has the capability to serve many different websites
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen simultaneously. This is called <a href="vhosts/">Virtual
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen Hosting</a>. Directives can also be scoped by placing them
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen inside <directive module="core" type="section">VirtualHost</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive sections, so that they will only apply to requests for a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive particular website.</p>
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <p>Although most directives can be placed in any of these
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen sections, some directives do not make sense in some contexts.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive For example, directives controlling process creation can only
6da407b2e43a613ec833f14d8c05d4494a27f17aslive be placed in the main server context. To find which directives
6da407b2e43a613ec833f14d8c05d4494a27f17aslive can be placed in which sections, check the <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive href="mod/directive-dict.html#Context">Context</a> of the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directive. For further information, we provide details on <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive href="sections.html">How Directory, Location and Files sections
6da407b2e43a613ec833f14d8c05d4494a27f17aslive work</a>.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <section id="htaccess">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>.htaccess Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core">AccessFileName</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core">AllowOverride</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Apache allows for decentralized management of configuration
6da407b2e43a613ec833f14d8c05d4494a27f17aslive via special files placed inside the web tree. The special files
6da407b2e43a613ec833f14d8c05d4494a27f17aslive are usually called <code>.htaccess</code>, but any name can be
6da407b2e43a613ec833f14d8c05d4494a27f17aslive specified in the <directive module="core">AccessFileName</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directive. Directives placed in <code>.htaccess</code> files
6da407b2e43a613ec833f14d8c05d4494a27f17aslive apply to the directory where you place the file, and all
6da407b2e43a613ec833f14d8c05d4494a27f17aslive sub-directories. The <code>.htaccess</code> files follow the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive same syntax as the main configuration files. Since
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <code>.htaccess</code> files are read on every request, changes
6da407b2e43a613ec833f14d8c05d4494a27f17aslive made in these files take immediate effect.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>To find which directives can be placed in
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <code>.htaccess</code> files, check the <a
4c291e02d98a08f4d39944dd30621f1930f92268rbowen href="mod/directive-dict.html#Context">Context</a> of the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directive. The server administrator further controls what
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directives may be placed in <code>.htaccess</code> files by
6da407b2e43a613ec833f14d8c05d4494a27f17aslive configuring the <directive module="core">AllowOverride</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive directive in the main configuration files.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>For more information on <code>.htaccess</code> files, see
6da407b2e43a613ec833f14d8c05d4494a27f17aslive the <a href="howto/htaccess.html">.htaccess tutorial</a>.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</manualpage>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive