configuring.xml revision a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94
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<!--
6fbd2e53c97ea6976d93e0ac521adabc55e0fb73nd Licensed to the Apache Software Foundation (ASF) under one or more
acc36ab93565d2880447d535da6ca6e5feac7a70nd contributor license agreements. See the NOTICE file distributed with
acc36ab93565d2880447d535da6ca6e5feac7a70nd this work for additional information regarding copyright ownership.
acc36ab93565d2880447d535da6ca6e5feac7a70nd The ASF licenses this file to You under the Apache License, Version 2.0
acc36ab93565d2880447d535da6ca6e5feac7a70nd (the "License"); you may not use this file except in compliance with
acc36ab93565d2880447d535da6ca6e5feac7a70nd 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-->
7db9f691a00ead175b03335457ca296a33ddf31bnd
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<manualpage metafile="configuring.xml.meta">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <title>Configuration Files</title>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<summary>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<p>This document describes the files used to configure Apache HTTP
6da407b2e43a613ec833f14d8c05d4494a27f17asliveServer.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</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 HTTP Server is configured by placing <a
f629fd8f821ed20d16d76733bc19bf5480986220slive href="mod/directives.html">directives</a> in plain text
f629fd8f821ed20d16d76733bc19bf5480986220slive 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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive recognized by httpd when it is started or restarted.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
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.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive The backslash "\" may be used as the last character on a line
6da407b2e43a613ec833f14d8c05d4494a27f17aslive to indicate that the directive continues onto the next line.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive There must be no other characters or white space between the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive backslash and the end of the line.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Arguments to directives are separated by whitespace. If an
f629fd8f821ed20d16d76733bc19bf5480986220slive argument contains spaces, you must enclose that argument in quotes.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive comments, and are ignored. Comments may <strong>not</strong> be
6da407b2e43a613ec833f14d8c05d4494a27f17aslive included on the same line as a configuration directive.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive White space occurring before a directive is ignored, so
6da407b2e43a613ec833f14d8c05d4494a27f17aslive you may indent directives for clarity. Blank lines are also ignored.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>The values of variables defined with the <directive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive module="core">Define</directive> of or shell environment variables can
6da407b2e43a613ec833f14d8c05d4494a27f17aslive be used in configuration file lines using the syntax <code>${VAR}</code>.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive If "VAR" is the name of a valid variable, the value of that variable is
6da407b2e43a613ec833f14d8c05d4494a27f17aslive substituted into that spot in the configuration file line, and processing
6da407b2e43a613ec833f14d8c05d4494a27f17aslive continues as if that text were found directly in the configuration file.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Variables defined with <directive module="core">Define</directive> take
6da407b2e43a613ec833f14d8c05d4494a27f17aslive precedence over shell environment variables.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive If the "VAR" variable is not found, the characters <code>${VAR}</code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive are left unchanged, and a warning is logged.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Variable names may not contain colon ":" characters, to avoid clashes with
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Only shell environment variables defined before the server is started
6da407b2e43a613ec833f14d8c05d4494a27f17aslive can be used in expansions. Environment variables defined in the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive configuration file itself, for example with <directive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive module="mod_env">SetEnv</directive>, take effect too late to be used for
6da407b2e43a613ec833f14d8c05d4494a27f17aslive expansions in the configuration file.</p>
199a8ee5984e3708982fab1ba6ebb0a5feaea90cnd
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>The maximum length of a line in normal configuration files, after
6da407b2e43a613ec833f14d8c05d4494a27f17aslive variable substitution and joining any continued lines, is approximately
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 16 MiB. In <a href="configuring.html#htaccess">.htaccess files</a>, the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive maximum length is 8190 characters.</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>
1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6kess
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>You can use <module>mod_info</module>'s <code>-DDUMP_CONFIG</code> to
6da407b2e43a613ec833f14d8c05d4494a27f17aslive dump the configuration with all included files and environment
6da407b2e43a613ec833f14d8c05d4494a27f17aslive variables resolved and all comments and non-matching
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">IfDefine</directive> and
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive module="core" type="section">IfModule</directive> sections
6da407b2e43a613ec833f14d8c05d4494a27f17aslive removed. However, the output does not reflect the merging or overriding
6da407b2e43a613ec833f14d8c05d4494a27f17aslive that may happen for repeated directives.</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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive basic functionality is included in the core server. Extended
6da407b2e43a613ec833f14d8c05d4494a27f17aslive features are available through <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive href="mod/">modules</a> which can be loaded
6da407b2e43a613ec833f14d8c05d4494a27f17aslive into httpd. By default, a <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Configuration directives may be included conditional on a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive presence of a particular module by enclosing them in an <directive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive module="core" type="section">IfModule</directive> block. However,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <directive type="section">IfModule</directive> blocks are not
6da407b2e43a613ec833f14d8c05d4494a27f17aslive required, and in some cases may mask the fact that you're missing an
6da407b2e43a613ec833f14d8c05d4494a27f17aslive important module.</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. You can also
6da407b2e43a613ec833f14d8c05d4494a27f17aslive see what modules are loaded dynamically using the <code>-M</code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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
f629fd8f821ed20d16d76733bc19bf5480986220slive <p>Although most directives can be placed in any of these
6da407b2e43a613ec833f14d8c05d4494a27f17aslive sections, some directives do not make sense in some contexts.
7db9f691a00ead175b03335457ca296a33ddf31bnd 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>.</p>
</section>
<section id="htaccess">
<title>.htaccess Files</title>
<related>
<directivelist>
<directive module="core">AccessFileName</directive>
<directive module="core">AllowOverride</directive>
</directivelist>
</related>
<p>httpd 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 in the <directive module="core">AccessFileName</directive>
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>
<p>To find which directives can be placed in
<code>.htaccess</code> files, check the <a
href="mod/directive-dict.html#Context">Context</a> of the
directive. The server administrator further controls what
directives may be placed in <code>.htaccess</code> files by
configuring the <directive module="core">AllowOverride</directive>
directive in the main configuration files.</p>
<p>For more information on <code>.htaccess</code> files, see
the <a href="howto/htaccess.html">.htaccess tutorial</a>.</p>
</section>
</manualpage>