configuring.xml revision 4c291e02d98a08f4d39944dd30621f1930f92268
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<!-- $LastChangedRevision$ -->
acc36ab93565d2880447d535da6ca6e5feac7a70nd
acc36ab93565d2880447d535da6ca6e5feac7a70nd<!--
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding the License. You may obtain a copy of the License at
acc36ab93565d2880447d535da6ca6e5feac7a70nd
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
7db9f691a00ead175b03335457ca296a33ddf31bnd<manualpage metafile="configuring.xml.meta">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Configuration Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<summary>
654d8eb036bedc99e90e11910ee02d3421417697rbowen<p>This document describes the files used to configure the Apache HTTP server (httpd).</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>The Apache HTTP Server 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
f629fd8f821ed20d16d76733bc19bf5480986220slive recognized by httpd 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>httpd 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,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive but arguments to directives are often case sensitive. Lines
6da407b2e43a613ec833f14d8c05d4494a27f17aslive that begin with the hash character "#" are considered
f629fd8f821ed20d16d76733bc19bf5480986220slive 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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive you may indent directives for clarity.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>The values of shell environment variables can be used in
d3a52d99691581fffaf2a375a80808d943807189poirier configuration file lines using the syntax <code>${ENVVAR}</code>.
d3a52d99691581fffaf2a375a80808d943807189poirier If "ENVVAR" is the name of a valid environment variable, the value
d3a52d99691581fffaf2a375a80808d943807189poirier of that variable is substituted into that spot in the
d3a52d99691581fffaf2a375a80808d943807189poirier configuration file line, and processing continues as if that text
d3a52d99691581fffaf2a375a80808d943807189poirier were found directly in the configuration file. (If the ENVVAR
d3a52d99691581fffaf2a375a80808d943807189poirier variable is not found, the characters "${ENVVAR}" are left
d3a52d99691581fffaf2a375a80808d943807189poirier unchanged for use by later stages in the config file
d3a52d99691581fffaf2a375a80808d943807189poirier processing.)</p>
d3a52d99691581fffaf2a375a80808d943807189poirier
d3a52d99691581fffaf2a375a80808d943807189poirier <p>Only environment variables defined before the server is started
954857c6508d60fd4e0a8c304698b25a15adbf33poirier can be used in expansions. Variables defined in the
954857c6508d60fd4e0a8c304698b25a15adbf33poirier configuration file itself, for example with <directive
954857c6508d60fd4e0a8c304698b25a15adbf33poirier module="mod_env">SetEnv</directive>, take effect too late to be
954857c6508d60fd4e0a8c304698b25a15adbf33poirier used for expansions in the configuration file.</p>
954857c6508d60fd4e0a8c304698b25a15adbf33poirier
954857c6508d60fd4e0a8c304698b25a15adbf33poirier <p>The maximum length of a line in the configuration file, after
d3a52d99691581fffaf2a375a80808d943807189poirier environment-variable substitution, joining any continued lines and
d3a52d99691581fffaf2a375a80808d943807189poirier removing leading and trailing white space, is 8192 characters.</p>
d3a52d99691581fffaf2a375a80808d943807189poirier
bc91276d454cab5923b4a0fcf94931bd0a6bee34poirier <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>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <section id="modules">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Modules</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <modulelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <module>mod_so</module>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </modulelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">IfModule</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="mod_so">LoadModule</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </directivelist>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </related>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>httpd is a modular server. This implies that only the most
4c291e02d98a08f4d39944dd30621f1930f92268rbowen basic functionality is included in the core server. Extended
6da407b2e43a613ec833f14d8c05d4494a27f17aslive features are available through <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive href="mod/">modules</a> which can be loaded
199a8ee5984e3708982fab1ba6ebb0a5feaea90cnd into httpd. By default, a <a
4c291e02d98a08f4d39944dd30621f1930f92268rbowen href="mod/module-dict.html#Status">base</a> set of modules is
6da407b2e43a613ec833f14d8c05d4494a27f17aslive included in the server at compile-time. If the server is
6da407b2e43a613ec833f14d8c05d4494a27f17aslive compiled to use <a href="dso.html">dynamically loaded</a>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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, httpd must be recompiled to add or remove modules.
4c291e02d98a08f4d39944dd30621f1930f92268rbowen Configuration directives may be included conditional on a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive presence of a particular module by enclosing them in an <directive
1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6kess module="core" type="section">IfModule</directive> block.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>To see which modules are currently compiled into the server,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive you can use the <code>-l</code> command line option.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive type="section">Directory</directive>, <directive module="core"
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive locations or URLs. They can also be nested, allowing for very
6da407b2e43a613ec833f14d8c05d4494a27f17aslive fine grained configuration.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>httpd has the capability to serve many different websites
4c291e02d98a08f4d39944dd30621f1930f92268rbowen simultaneously. This is called <a href="vhosts/">Virtual
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Hosting</a>. Directives can also be scoped by placing them
6da407b2e43a613ec833f14d8c05d4494a27f17aslive inside <directive module="core" type="section">VirtualHost</directive>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive sections, so that they will only apply to requests for a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive particular website.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Although most directives can be placed in any of these
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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>httpd allows for decentralized management of configuration
4c291e02d98a08f4d39944dd30621f1930f92268rbowen 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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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>
f629fd8f821ed20d16d76733bc19bf5480986220slive </section>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</manualpage>
7db9f691a00ead175b03335457ca296a33ddf31bnd