configuring.xml revision 3d636d91428f2c0a74012c89a94ec7d5b40aa52e
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 Apache HTTP
654d8eb036bedc99e90e11910ee02d3421417697rbowenServer.</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
654d8eb036bedc99e90e11910ee02d3421417697rbowen <p>Apache HTTP Server is configured by placing <a
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen files. Changes to the main configuration files are only
4c291e02d98a08f4d39944dd30621f1930f92268rbowen 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
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <p>httpd configuration files contain one directive per line.
b20a53da22140b5a3d221a19a12142f89f1b606drjung 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
b20a53da22140b5a3d221a19a12142f89f1b606drjung backslash and the end of the line.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>Directives in the configuration files are case-insensitive,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive but arguments to directives are often case sensitive. Lines
f629fd8f821ed20d16d76733bc19bf5480986220slive that begin with the hash character "#" are considered
6da407b2e43a613ec833f14d8c05d4494a27f17aslive 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
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <p>The values of variables defined with the <directive
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf module="core">Define</directive> of or shell environment variables can
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf be used in configuration file lines using the syntax <code>${VAR}</code>.
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf If "VAR" is the name of a valid variable, the value of that variable is
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf substituted into that spot in the configuration file line, and processing
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf continues as if that text were found directly in the configuration file.
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf Variables defined with <directive module="core">Define</directive> take
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf precedence over shell environment variables.
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf If the "VAR" variable is not found, the characters <code>${VAR}</code>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf are left unchanged, and a warning is logged.
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf Variable names may not contain colon ":" characters, to avoid clashes with
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <p>Only shell environment variables defined before the server is started
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf can be used in expansions. Environment variables defined in the
954857c6508d60fd4e0a8c304698b25a15adbf33poirier configuration file itself, for example with <directive
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf module="mod_env">SetEnv</directive>, take effect too late to be used for
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf expansions in the configuration file.</p>
954857c6508d60fd4e0a8c304698b25a15adbf33poirier
d3a52d99691581fffaf2a375a80808d943807189poirier <p>The maximum length of a line in the configuration file, after
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf variable substitution, joining any continued lines and removing leading
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf and trailing white space, is 8192 characters.</p>
bc91276d454cab5923b4a0fcf94931bd0a6bee34poirier
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>
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf <p>You can use <module>mod_info</module>'s <code>-DDUMP_CONFIG</code> to
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf dump the configuration with all included files and environment
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf variables resolved and all comments and non-matching
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf <directive module="core" type="section">IfDefine</directive> and
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf <directive module="core" type="section">IfModule</directive> sections
3d636d91428f2c0a74012c89a94ec7d5b40aa52esf removed.</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
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <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
199a8ee5984e3708982fab1ba6ebb0a5feaea90cnd href="mod/">modules</a> which can be loaded
4c291e02d98a08f4d39944dd30621f1930f92268rbowen 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.
4c291e02d98a08f4d39944dd30621f1930f92268rbowen Otherwise, httpd must be recompiled to add or remove modules.
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Configuration directives may be included conditional on a
1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6kess presence of a particular module by enclosing them in an <directive
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen module="core" type="section">IfModule</directive> block. However,
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <directive type="section">IfModule</directive> blocks are not
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen required, and in some cases may mask the fact that you're missing an
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen important module.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>To see which modules are currently compiled into the server,
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen you can use the <code>-l</code> command line option. You can also
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen see what modules are loaded dynamically using the <code>-M</code>
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen 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
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <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
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
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <p>httpd 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
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
f629fd8f821ed20d16d76733bc19bf5480986220slive the <a href="howto/htaccess.html">.htaccess tutorial</a>.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </section>
7db9f691a00ead175b03335457ca296a33ddf31bnd</manualpage>