1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
4 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>core - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.gif" /></div>
23 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
25 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Core Features</h1>
29 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
30 <a href="../en/mod/core.html" title="English"> en </a> |
31 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
32 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
33 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
34 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
36 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
38 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
40 <div id="quickview"><h3 class="directives">Directives</h3>
42 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverridelist">AllowOverrideList</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#cgipassauth">CGIPassAuth</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#defaultruntimedir">DefaultRuntimeDir</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#directory"><Directory></a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#else"><Else></a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#elseif"><ElseIf></a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#error">Error</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#errorlogformat">ErrorLogFormat</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#gprofdir">GprofDir</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#if"><If></a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#includeoptional">IncludeOptional</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#logleveloverride">LogLevelOverride</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangeoverlaps">MaxRangeOverlaps</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangereversals">MaxRangeReversals</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#maxranges">MaxRanges</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#mergetrailers">MergeTrailers</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#protocols">Protocols</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#protocolshonororder">ProtocolsHonorOrder</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#registerhttpmethod">RegisterHttpMethod</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
107 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
108 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
109 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
110 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
111 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
112 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
113 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
114 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
115 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
116 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
117 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
118 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
119 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
120 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
121 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
122 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
123 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
124 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
125 <li><img alt="" src="../images/down.gif" /> <a href="#warning">Warning</a></li>
127 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
129 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
130 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
131 <table class="directive">
132 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
133 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
134 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
135 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
136 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
138 <p>This directive enables operating system specific optimizations for a
139 listening socket by the <code class="directive">Protocol</code> type.
140 The basic premise is for the kernel to not send a socket to the server
141 process until either data is received or an entire HTTP Request is buffered.
142 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
143 FreeBSD's Accept Filters</a>, Linux's more primitive
144 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
145 are currently supported.</p>
147 <p>Using <code>none</code> for an argument will disable any accept filters
148 for that protocol. This is useful for protocols that require a server
149 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
150 <pre class="prettyprint lang-config">AcceptFilter nntp none</pre>
153 <p>The default protocol names are <code>https</code> for port 443
154 and <code>http</code> for all other ports. To specify that another
155 protocol is being used with a listening port, add the <var>protocol</var>
156 argument to the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
159 <p>The default values on FreeBSD are:</p>
160 <pre class="prettyprint lang-config">AcceptFilter http httpready
161 AcceptFilter https dataready</pre>
164 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
165 the kernel level. Once an entire request is received, the kernel then
166 sends it to the server. See the
167 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
168 accf_http(9)</a> man page for more details. Since HTTPS requests are
169 encrypted, only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
170 accf_data(9)</a> filter is used.</p>
172 <p>The default values on Linux are:</p>
173 <pre class="prettyprint lang-config">AcceptFilter http data
174 AcceptFilter https data</pre>
177 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
178 requests. Any value besides <code>none</code> will enable
179 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
181 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
182 tcp(7)</a> man page.</p>
184 <p>The default values on Windows are:</p>
185 <pre class="prettyprint lang-config">AcceptFilter http data
186 AcceptFilter https data</pre>
189 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
190 API, and does not support http protocol buffering. There are two values
191 which utilize the Windows AcceptEx() API and will recycle network
192 sockets between connections. <code>data</code> waits until data has
193 been transmitted as documented above, and the initial data buffer and
194 network endpoint addresses are all retrieved from the single AcceptEx()
195 invocation. <code>connect</code> will use the AcceptEx() API, also
196 retrieve the network endpoint addresses, but like <code>none</code>
197 the <code>connect</code> option does not wait for the initial data
200 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
201 and will not recycle sockets between connections. This is useful for
202 network adapters with broken driver support, as well as some virtual
203 network providers such as vpn drivers, or spam, virus or spyware
209 <li><code class="directive"><a href="#protocol">Protocol</a></code></li>
212 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
213 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
214 <table class="directive">
215 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
216 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
217 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
218 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
219 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
220 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
221 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
224 <p>This directive controls whether requests that contain trailing
225 pathname information that follows an actual filename (or
226 non-existent file in an existing directory) will be accepted or
227 rejected. The trailing pathname information can be made
228 available to scripts in the <code>PATH_INFO</code> environment
231 <p>For example, assume the location <code>/test/</code> points to
232 a directory that contains only the single file
233 <code>here.html</code>. Then requests for
234 <code>/test/here.html/more</code> and
235 <code>/test/nothere.html/more</code> both collect
236 <code>/more</code> as <code>PATH_INFO</code>.</p>
238 <p>The three possible arguments for the
239 <code class="directive">AcceptPathInfo</code> directive are:</p>
241 <dt><code>Off</code></dt><dd>A request will only be accepted if it
242 maps to a literal path that exists. Therefore a request with
243 trailing pathname information after the true filename such as
244 <code>/test/here.html/more</code> in the above example will return
245 a 404 NOT FOUND error.</dd>
247 <dt><code>On</code></dt><dd>A request will be accepted if a
248 leading path component maps to a file that exists. The above
249 example <code>/test/here.html/more</code> will be accepted if
250 <code>/test/here.html</code> maps to a valid file.</dd>
252 <dt><code>Default</code></dt><dd>The treatment of requests with
253 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
254 The core handler for normal files defaults to rejecting
255 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a href="mod_cgi.html">cgi-script</a> and <a href="mod_isapi.html">isapi-handler</a>, generally accept
256 <code>PATH_INFO</code> by default.</dd>
259 <p>The primary purpose of the <code>AcceptPathInfo</code>
260 directive is to allow you to override the handler's choice of
261 accepting or rejecting <code>PATH_INFO</code>. This override is required,
262 for example, when you use a <a href="../filter.html">filter</a>, such
263 as <a href="mod_include.html">INCLUDES</a>, to generate content
264 based on <code>PATH_INFO</code>. The core handler would usually reject
265 the request, so you can use the following configuration to enable
268 <pre class="prettyprint lang-config"><Files "mypaths.shtml">
270 SetOutputFilter INCLUDES
277 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
278 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
279 <table class="directive">
280 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
281 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
282 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
283 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
284 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
285 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
287 <p>While processing a request, the server looks for
288 the first existing configuration file from this list of names in
289 every directory of the path to the document, if distributed
290 configuration files are <a href="#allowoverride">enabled for that
291 directory</a>. For example:</p>
293 <pre class="prettyprint lang-config">AccessFileName .acl</pre>
296 <p>Before returning the document
297 <code>/usr/local/web/index.html</code>, the server will read
298 <code>/.acl</code>, <code>/usr/.acl</code>,
299 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
300 for directives unless they have been disabled with:</p>
302 <pre class="prettyprint lang-config"><Directory "/">
304 </Directory></pre>
309 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
310 <li><a href="../configuring.html">Configuration Files</a></li>
311 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
314 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
315 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
316 <table class="directive">
317 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
318 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
319 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
320 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
321 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
322 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
323 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
324 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
326 <p>This directive specifies a default value for the media type
327 charset parameter (the name of a character encoding) to be added
328 to a response if and only if the response's content-type is either
329 <code>text/plain</code> or <code>text/html</code>. This should override
330 any charset specified in the body of the response via a <code>META</code>
331 element, though the exact behavior is often dependent on the user's client
332 configuration. A setting of <code>AddDefaultCharset Off</code>
333 disables this functionality. <code>AddDefaultCharset On</code> enables
334 a default charset of <code>iso-8859-1</code>. Any other value is assumed
335 to be the <var>charset</var> to be used, which should be one of the
336 <a href="http://www.iana.org/assignments/character-sets">IANA registered
337 charset values</a> for use in Internet media types (MIME types).
340 <pre class="prettyprint lang-config">AddDefaultCharset utf-8</pre>
343 <p><code class="directive">AddDefaultCharset</code> should only be used when all
344 of the text resources to which it applies are known to be in that
345 character encoding and it is too inconvenient to label their charset
346 individually. One such example is to add the charset parameter
347 to resources containing generated content, such as legacy CGI
348 scripts, that might be vulnerable to cross-site scripting attacks
349 due to user-provided data being included in the output. Note, however,
350 that a better solution is to just fix (or delete) those scripts, since
351 setting a default charset does not protect users that have enabled
352 the "auto-detect character encoding" feature on their browser.</p>
356 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
359 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
360 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
361 <table class="directive">
362 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
363 be passed through</td></tr>
364 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off|NoDecode</code></td></tr>
365 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
366 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
367 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
368 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
369 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>
370 NoDecode option available in 2.3.12 and later.</td></tr>
372 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
373 which contain encoded path separators (<code>%2F</code> for <code>/</code>
374 and additionally <code>%5C</code> for <code>\</code> on accordant systems)
375 to be used in the path info.</p>
377 <p>With the default value, <code>Off</code>, such URLs are refused
378 with a 404 (Not found) error.</p>
380 <p>With the value <code>On</code>, such URLs are accepted, and encoded
381 slashes are decoded like all other encoded characters.</p>
383 <p>With the value <code>NoDecode</code>, such URLs are accepted, but
384 encoded slashes are not decoded but left in their encoded state.</p>
386 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
387 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
389 <div class="note"><h3>Note</h3>
390 <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
391 strongly recommended as a security measure. Allowing slashes
392 to be decoded could potentially allow unsafe paths.</p>
397 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
400 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
401 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
402 <table class="directive">
403 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
404 <code>.htaccess</code> files</td></tr>
405 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
406 [<var>directive-type</var>] ...</code></td></tr>
407 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</code></td></tr>
408 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
409 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
410 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
412 <p>When the server finds an <code>.htaccess</code> file (as
413 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>),
414 it needs to know which directives declared in that file can override
415 earlier configuration directives.</p>
417 <div class="note"><h3>Only available in <Directory> sections</h3>
418 <code class="directive">AllowOverride</code> is valid only in
419 <code class="directive"><a href="#directory"><Directory></a></code>
420 sections specified without regular expressions, not in <code class="directive"><a href="#location"><Location></a></code>, <code class="directive"><a href="#directorymatch"><DirectoryMatch></a></code> or
421 <code class="directive"><a href="#files"><Files></a></code> sections.
424 <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code> is set to
425 <code>None</code>, <a href="#accessfilename">.htaccess</a> files are
426 completely ignored. In this case, the server will not even attempt
427 to read <code>.htaccess</code> files in the filesystem.</p>
429 <p>When this directive is set to <code>All</code>, then any
430 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
431 <code>.htaccess</code> files.</p>
433 <p>The <var>directive-type</var> can be one of the following
434 groupings of directives.</p>
441 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authz_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
442 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
443 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
444 <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
445 <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code>, <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code>, <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>, <em>etc.</em>).</dd>
450 Allow use of the directives controlling document types
451 (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
452 <code class="directive"><a href="#forcetype">ForceType</a></code>,
453 <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
454 <code class="directive"><a href="#sethandler">SetHandler</a></code>,
455 <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
456 <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
457 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
458 document meta data (<code class="directive"><a href="../mod/mod_headers.html#header">Header</a></code>, <code class="directive"><a href="../mod/mod_headers.html#requestheader">RequestHeader</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#setenvifnocase">SetEnvIfNoCase</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#browsermatch">BrowserMatch</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookieexpires">CookieExpires</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiedomain">CookieDomain</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiestyle">CookieStyle</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookietracking">CookieTracking</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiename">CookieName</a></code>),
459 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> directives (<code class="directive"><a href="../mod/mod_rewrite.html#rewriteengine">RewriteEngine</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriteoptions">RewriteOptions</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>),
460 <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> directives (<code class="directive"><a href="../mod/mod_alias.html#redirect">Redirect</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirecttemp">RedirectTemp</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirectpermanent">RedirectPermanent</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirectmatch">RedirectMatch</a></code>), and
461 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
462 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
468 Allow use of the directives controlling directory indexing
469 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
470 <code class="directive"><a href="../mod/mod_autoindex.html#addicon">AddIcon</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#addiconbyencoding">AddIconByEncoding</a></code>,
471 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
472 <code class="directive"><a href="../mod/mod_autoindex.html#defaulticon">DefaultIcon</a></code>, <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>, <code class="directive"><a href="../mod/mod_dir.html#fallbackresource">FallbackResource</a></code>, <a href="mod_autoindex.html#indexoptions.fancyindexing"><code>FancyIndexing</code></a>, <code class="directive"><a href="../mod/mod_autoindex.html#headername">HeaderName</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexignore">IndexIgnore</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexoptions">IndexOptions</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#readmename">ReadmeName</a></code>,
478 Allow use of the directives controlling host access (<code class="directive"><a href="../mod/mod_access_compat.html#allow">Allow</a></code>, <code class="directive"><a href="../mod/mod_access_compat.html#deny">Deny</a></code> and <code class="directive"><a href="../mod/mod_access_compat.html#order">Order</a></code>).</dd>
483 <dt>Nonfatal=[Override|Unknown|All]</dt>
486 Allow use of AllowOverride option to treat syntax errors in
487 .htaccess as nonfatal. Instead of causing an Internal Server
488 Error, disallowed or unrecognised directives will be ignored
489 and a warning logged:
491 <li><strong>Nonfatal=Override</strong> treats directives
492 forbidden by AllowOverride as nonfatal.</li>
493 <li><strong>Nonfatal=Unknown</strong> treats unknown directives
494 as nonfatal. This covers typos and directives implemented
495 by a module that's not present.</li>
496 <li><strong>Nonfatal=All</strong> treats both the above as nonfatal.</li>
498 <p>Note that a syntax error in a valid directive will still cause
499 an internal server error.</p>
500 <div class="warning"><h3>Security</h3>
501 Nonfatal errors may have security implications for .htaccess users.
502 For example, if AllowOverride disallows AuthConfig, users'
503 configuration designed to restrict access to a site will be disabled.
507 <dt>Options[=<var>Option</var>,...]</dt>
510 Allow use of the directives controlling specific directory
511 features (<code class="directive"><a href="#options">Options</a></code> and
512 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
513 An equal sign may be given followed by a comma-separated list, without
514 spaces, of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.
516 <div class="note"><h3>Implicit disabling of Options</h3>
517 <p>Even though the list of options that may be used in .htaccess files
518 can be limited with this directive, as long as any <code class="directive"><a href="#options">Options</a></code> directive is allowed any
519 other inherited option can be disabled by using the non-relative
520 syntax. In other words, this mechanism cannot force a specific option
521 to remain <em>set</em> while allowing any others to be set.
524 <div class="example"><p><code>
525 AllowOverride Options=Indexes,MultiViews
532 <pre class="prettyprint lang-config">AllowOverride AuthConfig Indexes</pre>
535 <p>In the example above, all directives that are neither in the group
536 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
539 <div class="note"><p>For security and performance reasons, do not set
540 <code>AllowOverride</code> to anything other than <code>None</code>
541 in your <code><Directory "/"></code> block. Instead, find (or
542 create) the <code><Directory></code> block that refers to the
543 directory where you're actually planning to place a
544 <code>.htaccess</code> file.</p>
549 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
550 <li><code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code></li>
551 <li><a href="../configuring.html">Configuration Files</a></li>
552 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
555 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
556 <div class="directive-section"><h2><a name="AllowOverrideList" id="AllowOverrideList">AllowOverrideList</a> <a name="allowoverridelist" id="allowoverridelist">Directive</a></h2>
557 <table class="directive">
558 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Individual directives that are allowed in
559 <code>.htaccess</code> files</td></tr>
560 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverrideList None|<var>directive</var>
561 [<var>directive-type</var>] ...</code></td></tr>
562 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverrideList None</code></td></tr>
563 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
564 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
565 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
567 <p>When the server finds an <code>.htaccess</code> file (as
568 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>),
569 it needs to know which directives declared in that file can override
570 earlier configuration directives.</p>
572 <div class="note"><h3>Only available in <Directory> sections</h3>
573 <code class="directive">AllowOverrideList</code> is valid only in
574 <code class="directive"><a href="#directory"><Directory></a></code>
575 sections specified without regular expressions, not in <code class="directive"><a href="#location"><Location></a></code>, <code class="directive"><a href="#directorymatch"><DirectoryMatch></a></code> or
576 <code class="directive"><a href="#files"><Files></a></code> sections.
579 <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverride">AllowOverride</a></code> is set to <code>None</code>,
580 then <a href="#accessfilename">.htaccess</a> files are completely
581 ignored. In this case, the server will not even attempt to read
582 <code>.htaccess</code> files in the filesystem.</p>
586 <pre class="prettyprint lang-config">AllowOverride None
587 AllowOverrideList Redirect RedirectMatch</pre>
590 <p>In the example above, only the <code>Redirect</code> and
591 <code>RedirectMatch</code> directives are allowed. All others will
592 cause an internal server error.</p>
596 <pre class="prettyprint lang-config">AllowOverride AuthConfig
597 AllowOverrideList CookieTracking CookieName</pre>
600 <p>In the example above, <code class="directive"><a href="#allowoverride">AllowOverride
601 </a></code> grants permission to the <code>AuthConfig</code>
602 directive grouping and <code class="directive">AllowOverrideList</code> grants
603 permission to only two directives from the <code>FileInfo</code> directive
604 grouping. All others will cause an internal server error.</p>
608 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
609 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
610 <li><a href="../configuring.html">Configuration Files</a></li>
611 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
614 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
615 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
616 <table class="directive">
617 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
619 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
620 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
621 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
622 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
623 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
624 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
626 <p>This directive is used to control how Apache httpd finds the
627 interpreter used to run CGI scripts. For example, setting
628 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
629 cause all CGI script files with a <code>.foo</code> extension to
630 be passed to the FOO interpreter.</p>
633 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
634 <div class="directive-section"><h2><a name="CGIPassAuth" id="CGIPassAuth">CGIPassAuth</a> <a name="cgipassauth" id="cgipassauth">Directive</a></h2>
635 <table class="directive">
636 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables passing HTTP authorization headers to scripts as CGI
638 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIPassAuth On|Off</code></td></tr>
639 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CGIPassAuth Off</code></td></tr>
640 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
641 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
643 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
644 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.13 and later</td></tr>
646 <p><code class="directive">CGIPassAuth</code> allows scripts access to HTTP
647 authorization headers such as <code>Authorization</code>, which is
648 required for scripts that implement HTTP Basic authentication.
649 Normally these HTTP headers are hidden from scripts. This is to disallow
650 scripts from seeing user ids and passwords used to access the server when
651 HTTP Basic authentication is enabled in the web server. This directive
652 should be used when scripts are allowed to implement HTTP Basic
655 <p>This directive can be used instead of the compile-time setting
656 <code>SECURITY_HOLE_PASS_AUTHORIZATION</code> which has been available
657 in previous versions of Apache HTTP Server.</p>
659 <p>The setting is respected by any modules which use
660 <code>ap_add_common_vars()</code>, such as <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>,
661 <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code>, <code class="module"><a href="../mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a></code>,
662 <code class="module"><a href="../mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code>, and so on. Notably, it affects
663 modules which don't handle the request in the usual sense but
664 still use this API; examples of this are <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
665 and <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>. Third-party modules that don't
666 use <code>ap_add_common_vars()</code> may choose to respect the setting
670 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
671 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
672 <table class="directive">
673 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
675 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
676 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
677 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
678 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
679 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
680 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
682 <p>This directive enables the generation of
683 <code>Content-MD5</code> headers as defined in RFC1864
684 respectively RFC2616.</p>
686 <p>MD5 is an algorithm for computing a "message digest"
687 (sometimes called "fingerprint") of arbitrary-length data, with
688 a high degree of confidence that any alterations in the data
689 will be reflected in alterations in the message digest.</p>
691 <p>The <code>Content-MD5</code> header provides an end-to-end
692 message integrity check (MIC) of the entity-body. A proxy or
693 client may check this header for detecting accidental
694 modification of the entity-body in transit. Example header:</p>
696 <div class="example"><p><code>
697 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
700 <p>Note that this can cause performance problems on your server
701 since the message digest is computed on every request (the
702 values are not cached).</p>
704 <p><code>Content-MD5</code> is only sent for documents served
705 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
706 SSI documents, output from CGI scripts, and byte range responses
707 do not have this header.</p>
710 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
711 <div class="directive-section"><h2><a name="DefaultRuntimeDir" id="DefaultRuntimeDir">DefaultRuntimeDir</a> <a name="defaultruntimedir" id="defaultruntimedir">Directive</a></h2>
712 <table class="directive">
713 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server run-time files</td></tr>
714 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultRuntimeDir <var>directory-path</var></code></td></tr>
715 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</code></td></tr>
716 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
717 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
718 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
719 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.2 and later</td></tr>
721 <p>The <code class="directive">DefaultRuntimeDir</code> directive sets the
722 directory in which the server will create various run-time files
723 (shared memory, locks, etc.). If set as a relative path, the full path
724 will be relative to <code class="directive">ServerRoot</code>.</p>
726 <p><strong>Example</strong></p>
727 <pre class="prettyprint lang-config">DefaultRuntimeDir scratch/</pre>
730 <p>The default location of <code class="directive">DefaultRuntimeDir</code> may be
731 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
734 <p>Note: <code class="directive">ServerRoot</code> should be specified before this
735 directive is used. Otherwise, the default value of <code class="directive">ServerRoot</code>
736 would be used to set the base directory.</p>
741 <li><a href="../misc/security_tips.html#serverroot">the
742 security tips</a> for information on how to properly set
743 permissions on the <code class="directive">ServerRoot</code></li>
746 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
747 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
748 <table class="directive">
749 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
750 if the value is not <code>none</code>. In prior versions, DefaultType
751 would specify a default media type to assign to response content for
752 which no other media type configuration could be found.
754 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
755 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
756 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
757 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
758 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
759 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
760 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>All choices except <code>none</code> are DISABLED for 2.3.x and later.
763 <p>This directive has been disabled. For backwards compatibility
764 of configuration files, it may be specified with the value
765 <code>none</code>, meaning no default media type. For example:</p>
767 <pre class="prettyprint lang-config">DefaultType None</pre>
770 <p><code>DefaultType None</code> is only available in
771 httpd-2.2.7 and later.</p>
773 <p>Use the mime.types configuration file and the
774 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
775 type assignments via file extensions, or the
776 <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
777 the media type for specific resources. Otherwise, the server will
778 send the response without a Content-Type header field and the
779 recipient may attempt to guess the media type.</p>
782 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
783 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
784 <table class="directive">
785 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a variable</td></tr>
786 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Define <var>parameter-name</var> [<var>parameter-value</var>]</code></td></tr>
787 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
788 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
789 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
791 <p>In its one parameter form, <code class="directive">Define</code> is equivalent
792 to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>. It
793 can be used to toggle the use of
794 <code class="directive"><a href="#ifdefine"><IfDefine></a></code> sections
795 without needing to alter <code>-D</code> arguments in any startup
798 <p>In addition to that, if the second parameter is given, a config variable
799 is set to this value. The variable can be used in the configuration using
800 the <code>${VAR}</code> syntax. The variable is always globally defined
801 and not limited to the scope of the surrounding config section.</p>
803 <pre class="prettyprint lang-config"><IfDefine TEST>
804 Define servername test.example.com
806 <IfDefine !TEST>
807 Define servername www.example.com
811 DocumentRoot "/var/www/${servername}/htdocs"</pre>
814 <p>Variable names may not contain colon ":" characters, to avoid clashes
815 with <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>'s syntax.</p>
817 <p>While this directive is supported in virtual host context,
818 the changes it makes are visible to any later configuration
819 directives, beyond any enclosing virtual host</p>
822 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
823 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
824 <table class="directive">
825 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
826 named file-system directory, sub-directories, and their contents.</td></tr>
827 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
828 ... </Directory></code></td></tr>
829 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
830 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
831 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
833 <p><code class="directive"><Directory></code> and
834 <code></Directory></code> are used to enclose a group of
835 directives that will apply only to the named directory,
836 sub-directories of that directory, and the files within the respective
837 directories. Any directive that is allowed
838 in a directory context may be used. <var>Directory-path</var> is
839 either the full path to a directory, or a wild-card string using
840 Unix shell-style matching. In a wild-card string, <code>?</code> matches
841 any single character, and <code>*</code> matches any sequences of
842 characters. You may also use <code>[]</code> character ranges. None
843 of the wildcards match a `/' character, so <code><Directory
844 "/*/public_html"></code> will not match
845 <code>/home/user/public_html</code>, but <code><Directory
846 "/home/*/public_html"></code> will match. Example:</p>
848 <pre class="prettyprint lang-config"><Directory "/usr/local/httpd/htdocs">
849 Options Indexes FollowSymLinks
850 </Directory></pre>
853 <p>Directory paths <em>may</em> be quoted, if you like, however, it
854 <em>must</em> be quoted if the path contains spaces. This is because a
855 space would otherwise indicate the end of an argument.</p>
858 <p>Be careful with the <var>directory-path</var> arguments:
859 They have to literally match the filesystem path which Apache httpd uses
860 to access the files. Directives applied to a particular
861 <code><Directory></code> will not apply to files accessed from
862 that same directory via a different path, such as via different symbolic
866 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
867 expressions</a> can also be used, with the addition of the
868 <code>~</code> character. For example:</p>
870 <pre class="prettyprint lang-config"><Directory ~ "^/www/[0-9]{3}">
872 </Directory></pre>
875 <p>would match directories in <code>/www/</code> that consisted of
878 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
879 match the directory (or one of its parents) containing a document,
880 then the directives are applied in the order of shortest match
881 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
884 <pre class="prettyprint lang-config"><Directory "/">
888 <Directory "/home">
889 AllowOverride FileInfo
890 </Directory></pre>
893 <p>for access to the document <code>/home/web/dir/doc.html</code>
897 <li>Apply directive <code>AllowOverride None</code>
898 (disabling <code>.htaccess</code> files).</li>
900 <li>Apply directive <code>AllowOverride FileInfo</code> (for
901 directory <code>/home</code>).</li>
903 <li>Apply any <code>FileInfo</code> directives in
904 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
905 <code>/home/web/dir/.htaccess</code> in that order.</li>
908 <p>Regular expressions are not considered until after all of the
909 normal sections have been applied. Then all of the regular
910 expressions are tested in the order they appeared in the
911 configuration file. For example, with</p>
913 <pre class="prettyprint lang-config"><Directory ~ "abc$">
914 # ... directives here ...
915 </Directory></pre>
918 <p>the regular expression section won't be considered until after
919 all normal <code class="directive"><Directory></code>s and
920 <code>.htaccess</code> files have been applied. Then the regular
921 expression will match on <code>/home/abc/public_html/abc</code> and
922 the corresponding <code class="directive"><Directory></code> will
925 <p><strong>Note that the default access for
926 <code><Directory "/"></code> is to permit all access.
927 This means that Apache httpd will serve any file mapped from an URL. It is
928 recommended that you change this with a block such
931 <pre class="prettyprint lang-config"><Directory "/">
933 </Directory></pre>
936 <p><strong>and then override this for directories you
937 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
938 details.</strong></p>
940 <p>The directory sections occur in the <code>httpd.conf</code> file.
941 <code class="directive"><Directory></code> directives
942 cannot nest, and cannot appear in a <code class="directive"><a href="#limit"><Limit></a></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section.</p>
946 <li><a href="../sections.html">How <Directory>,
947 <Location> and <Files> sections work</a> for an
948 explanation of how these different sections are combined when a
949 request is received</li>
952 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
953 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
954 <table class="directive">
955 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
956 the contents of file-system directories matching a regular expression.</td></tr>
957 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
958 ... </DirectoryMatch></code></td></tr>
959 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
960 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
961 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
963 <p><code class="directive"><DirectoryMatch></code> and
964 <code></DirectoryMatch></code> are used to enclose a group
965 of directives which will apply only to the named directory (and the files within),
966 the same as <code class="directive"><a href="#directory"><Directory></a></code>.
967 However, it takes as an argument a
968 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>. For example:</p>
970 <pre class="prettyprint lang-config"><DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
972 </DirectoryMatch></pre>
975 <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
976 that consist of three numbers.</p>
978 <div class="note"><h3>Compatability</h3>
979 Prior to 2.3.9, this directive implicitly applied to sub-directories
980 (like <code class="directive"><a href="#directory"><Directory></a></code>) and
981 could not match the end of line symbol ($). In 2.3.9 and later,
982 only directories that match the expression are affected by the enclosed
986 <div class="note"><h3>Trailing Slash</h3>
987 This directive applies to requests for directories that may or may
988 not end in a trailing slash, so expressions that are anchored to the
989 end of line ($) must be written with care.
992 <p>From 2.4.8 onwards, named groups and backreferences are captured and
993 written to the environment with the corresponding name prefixed with
994 "MATCH_" and in upper case. This allows elements of paths to be referenced
995 from within <a href="../expr.html">expressions</a> and modules like
996 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
997 (unnamed) backreferences are ignored. Use named groups instead.</p>
999 <pre class="prettyprint lang-config"><DirectoryMatch "^/var/www/combined/(?<sitename>[^/]+)">
1000 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1001 </DirectoryMatch></pre>
1006 <li><code class="directive"><a href="#directory"><Directory></a></code> for
1007 a description of how regular expressions are mixed in with normal
1008 <code class="directive"><Directory></code>s</li>
1009 <li><a href="../sections.html">How <Directory>, <Location> and
1010 <Files> sections work</a> for an explanation of how these different
1011 sections are combined when a request is received</li>
1014 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1015 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
1016 <table class="directive">
1017 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
1018 from the web</td></tr>
1019 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
1020 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
1021 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1022 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1023 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1025 <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1026 will serve files. Unless matched by a directive like <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>, the server appends the
1027 path from the requested URL to the document root to make the
1028 path to the document. Example:</p>
1030 <pre class="prettyprint lang-config">DocumentRoot "/usr/web"</pre>
1033 <p>then an access to
1034 <code>http://my.example.com/index.html</code> refers to
1035 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
1036 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1038 <p>The <code class="directive">DocumentRoot</code> should be specified without
1039 a trailing slash.</p>
1043 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1047 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1048 <div class="directive-section"><h2><a name="Else" id="Else"><Else></a> <a name="else" id="else">Directive</a></h2>
1049 <table class="directive">
1050 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if the condition of a
1051 previous <code class="directive"><a href="#if"><If></a></code> or
1052 <code class="directive"><a href="#elseif"><ElseIf></a></code> section is not
1053 satisfied by a request at runtime</td></tr>
1054 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Else> ... </Else></code></td></tr>
1055 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1056 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1057 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1058 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1060 <p>The <code class="directive"><Else></code> applies the enclosed
1061 directives if and only if the most recent
1062 <code class="directive"><If></code> or
1063 <code class="directive"><ElseIf></code> section
1064 in the same scope has not been applied.
1065 For example: In </p>
1067 <pre class="prettyprint lang-config"><If "-z req('Host')">
1075 <p> The <code class="directive"><If></code> would match HTTP/1.0
1076 requests without a <var>Host:</var> header and the
1077 <code class="directive"><Else></code> would match requests
1078 with a <var>Host:</var> header.</p>
1083 <li><code class="directive"><a href="#if"><If></a></code></li>
1084 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
1085 <li><a href="../sections.html">How <Directory>, <Location>,
1086 <Files> sections work</a> for an explanation of how these
1087 different sections are combined when a request is received.
1088 <code class="directive"><If></code>,
1089 <code class="directive"><ElseIf></code>, and
1090 <code class="directive"><Else></code> are applied last.</li>
1093 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1094 <div class="directive-section"><h2><a name="ElseIf" id="ElseIf"><ElseIf></a> <a name="elseif" id="elseif">Directive</a></h2>
1095 <table class="directive">
1096 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is satisfied
1097 by a request at runtime while the condition of a previous
1098 <code class="directive"><a href="#if"><If></a></code> or
1099 <code class="directive"><ElseIf></code> section is not
1101 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><ElseIf <var>expression</var>> ... </ElseIf></code></td></tr>
1102 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1103 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1104 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1105 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1107 <p>The <code class="directive"><ElseIf></code> applies the enclosed
1108 directives if and only if both the given condition evaluates to true and
1109 the most recent <code class="directive"><If></code> or
1110 <code class="directive"><ElseIf></code> section in the same scope has
1111 not been applied. For example: In </p>
1113 <pre class="prettyprint lang-config"><If "-R '10.1.0.0/16'">
1116 <ElseIf "-R '10.0.0.0/8'">
1124 <p>The <code class="directive"><ElseIf></code> would match if
1125 the remote address of a request belongs to the subnet 10.0.0.0/8 but
1126 not to the subnet 10.1.0.0/16.</p>
1131 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1132 for a complete reference and more examples.</li>
1133 <li><code class="directive"><a href="#if"><If></a></code></li>
1134 <li><code class="directive"><a href="#else"><Else></a></code></li>
1135 <li><a href="../sections.html">How <Directory>, <Location>,
1136 <Files> sections work</a> for an explanation of how these
1137 different sections are combined when a request is received.
1138 <code class="directive"><If></code>,
1139 <code class="directive"><ElseIf></code>, and
1140 <code class="directive"><Else></code> are applied last.</li>
1143 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1144 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
1145 <table class="directive">
1146 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
1147 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
1148 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
1149 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1150 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1151 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1152 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1154 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
1155 memory-mapping if it needs to read the contents of a file during
1156 delivery. By default, when the handling of a request requires
1157 access to the data within a file -- for example, when delivering a
1158 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache httpd
1159 memory-maps the file if the OS supports it.</p>
1161 <p>This memory-mapping sometimes yields a performance improvement.
1162 But in some environments, it is better to disable the memory-mapping
1163 to prevent operational problems:</p>
1166 <li>On some multiprocessor systems, memory-mapping can reduce the
1167 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
1168 <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1169 has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1170 crash with a segmentation fault.
1174 <p>For server configurations that are vulnerable to these problems,
1175 you should disable memory-mapping of delivered files by specifying:</p>
1177 <pre class="prettyprint lang-config">EnableMMAP Off</pre>
1180 <p>For NFS mounted files, this feature may be disabled explicitly for
1181 the offending files by specifying:</p>
1183 <pre class="prettyprint lang-config"><Directory "/path-to-nfs-files">
1185 </Directory></pre>
1189 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1190 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
1191 <table class="directive">
1192 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use the kernel sendfile support to deliver files to the client</td></tr>
1193 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
1194 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile Off</code></td></tr>
1195 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1196 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1197 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1198 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1199 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Default changed to Off in
1200 version 2.3.9.</td></tr>
1202 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
1203 sendfile support from the kernel to transmit file contents to the client.
1204 By default, when the handling of a request requires no access
1205 to the data within a file -- for example, when delivering a
1206 static file -- Apache httpd uses sendfile to deliver the file contents
1207 without ever reading the file if the OS supports it.</p>
1209 <p>This sendfile mechanism avoids separate read and send operations,
1210 and buffer allocations. But on some platforms or within some
1211 filesystems, it is better to disable this feature to avoid
1212 operational problems:</p>
1215 <li>Some platforms may have broken sendfile support that the build
1216 system did not detect, especially if the binaries were built on
1217 another box and moved to such a machine with broken sendfile
1219 <li>On Linux the use of sendfile triggers TCP-checksum
1220 offloading bugs on certain networking cards when using IPv6.</li>
1221 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1222 files over 2GB in size.</li>
1223 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS, SMB, CIFS, FUSE),
1224 the kernel may be unable to serve the network file through
1228 <p>For server configurations that are not vulnerable to these problems,
1229 you may enable this feature by specifying:</p>
1231 <pre class="prettyprint lang-config">EnableSendfile On</pre>
1234 <p>For network mounted files, this feature may be disabled explicitly
1235 for the offending files by specifying:</p>
1237 <pre class="prettyprint lang-config"><Directory "/path-to-nfs-files">
1239 </Directory></pre>
1241 <p>Please note that the per-directory and .htaccess configuration
1242 of <code class="directive">EnableSendfile</code> is not supported by
1243 <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>.
1244 Only global definition of <code class="directive">EnableSendfile</code>
1245 is taken into account by the module.
1249 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1250 <div class="directive-section"><h2><a name="Error" id="Error">Error</a> <a name="error" id="error">Directive</a></h2>
1251 <table class="directive">
1252 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Abort configuration parsing with a custom error message</td></tr>
1253 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Error <var>message</var></code></td></tr>
1254 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1255 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1256 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1257 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.3.9 and later</td></tr>
1259 <p>If an error can be detected within the configuration, this
1260 directive can be used to generate a custom error message, and halt
1261 configuration parsing. The typical use is for reporting required
1262 modules which are missing from the configuration.</p>
1264 <pre class="prettyprint lang-config"># Example
1265 # ensure that mod_include is loaded
1266 <IfModule !include_module>
1267 Error "mod_include is required by mod_foo. Load it with LoadModule."
1270 # ensure that exactly one of SSL,NOSSL is defined
1271 <IfDefine SSL>
1272 <IfDefine NOSSL>
1273 Error "Both SSL and NOSSL are defined. Define only one of them."
1276 <IfDefine !SSL>
1277 <IfDefine !NOSSL>
1278 Error "Either SSL or NOSSL must be defined."
1280 </IfDefine></pre>
1285 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1286 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
1287 <table class="directive">
1288 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
1289 in case of an error</td></tr>
1290 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
1291 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1292 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1293 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1294 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1296 <p>In the event of a problem or error, Apache httpd can be configured
1297 to do one of four things,</p>
1300 <li>output a simple hardcoded error message</li>
1302 <li>output a customized message</li>
1304 <li>internally redirect to a local <var>URL-path</var> to handle the
1307 <li>redirect to an external <var>URL</var> to handle the
1311 <p>The first option is the default, while options 2-4 are
1312 configured using the <code class="directive">ErrorDocument</code>
1313 directive, which is followed by the HTTP response code and a URL
1314 or a message. Apache httpd will sometimes offer additional information
1315 regarding the problem/error.</p>
1317 <p>From 2.4.13, <a href="../expr.html">expression syntax</a> can be
1318 used inside the directive to produce dynamic strings and URLs.</p>
1320 <p>URLs can begin with a slash (/) for local web-paths (relative
1321 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1322 full URL which the client can resolve. Alternatively, a message
1323 can be provided to be displayed by the browser. Note that deciding
1324 whether the parameter is an URL, a path or a message is performed
1325 before any expression is parsed. Examples:</p>
1327 <pre class="prettyprint lang-config">ErrorDocument 500 http://foo.example.com/cgi-bin/tester
1328 ErrorDocument 404 /cgi-bin/bad_urls.pl
1329 ErrorDocument 401 /subscription_info.html
1330 ErrorDocument 403 "Sorry can't allow you access today"
1331 ErrorDocument 403 Forbidden!
1332 ErrorDocument 403 /cgi-bin/forbidden.pl?referrer=%{escape:%{HTTP_REFERER}}</pre>
1335 <p>Additionally, the special value <code>default</code> can be used
1336 to specify Apache httpd's simple hardcoded message. While not required
1337 under normal circumstances, <code>default</code> will restore
1338 Apache httpd's simple hardcoded message for configurations that would
1339 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1341 <pre class="prettyprint lang-config">ErrorDocument 404 /cgi-bin/bad_urls.pl
1343 <Directory "/web/docs">
1344 ErrorDocument 404 default
1345 </Directory></pre>
1348 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1349 that points to a remote URL (ie. anything with a method such as
1350 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1351 client to tell it where to find the document, even if the
1352 document ends up being on the same server. This has several
1353 implications, the most important being that the client will not
1354 receive the original error status code, but instead will
1355 receive a redirect status code. This in turn can confuse web
1356 robots and other clients which try to determine if a URL is
1357 valid using the status code. In addition, if you use a remote
1358 URL in an <code>ErrorDocument 401</code>, the client will not
1359 know to prompt the user for a password since it will not
1360 receive the 401 status code. Therefore, <strong>if you use an
1361 <code>ErrorDocument 401</code> directive, then it must refer to a local
1362 document.</strong></p>
1364 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1365 server-generated error messages when they are "too small" and substitute
1366 its own "friendly" error messages. The size threshold varies depending on
1367 the type of error, but in general, if you make your error document
1368 greater than 512 bytes, then MSIE will show the server-generated
1369 error rather than masking it. More information is available in
1370 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1372 <p>Although most error messages can be overridden, there are certain
1373 circumstances where the internal messages are used regardless of the
1374 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1375 particular, if a malformed request is detected, normal request processing
1376 will be immediately halted and the internal error message returned.
1377 This is necessary to guard against security problems caused by
1380 <p>If you are using mod_proxy, you may wish to enable
1381 <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1382 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1383 Apache httpd will not generate custom error documents for proxied content.</p>
1387 <li><a href="../custom-error.html">documentation of
1388 customizable responses</a></li>
1391 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1392 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1393 <table class="directive">
1394 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1395 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</code></td></tr>
1396 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</code></td></tr>
1397 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1398 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1399 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1401 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1402 the file to which the server will log any errors it encounters. If
1403 the <var>file-path</var> is not absolute then it is assumed to be
1404 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1406 <pre class="prettyprint lang-config">ErrorLog "/var/log/httpd/error_log"</pre>
1409 <p>If the <var>file-path</var>
1410 begins with a pipe character "<code>|</code>" then it is assumed to be a
1411 command to spawn to handle the error log.</p>
1413 <pre class="prettyprint lang-config">ErrorLog "|/usr/local/bin/httpd_errors"</pre>
1416 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1417 more information.</p>
1419 <p>Using <code>syslog</code> instead of a filename enables logging
1420 via syslogd(8) if the system supports it and if <code class="module"><a href="../mod/mod_syslog.html">mod_syslog</a></code>
1421 is loaded. The default is to use syslog facility <code>local7</code>,
1422 but you can override this by using the <code>syslog:<var>facility</var></code>
1423 syntax where <var>facility</var> can be one of the names usually documented in
1424 syslog(1). The facility is effectively global, and if it is changed
1425 in individual virtual hosts, the final facility specified affects the
1428 <pre class="prettyprint lang-config">ErrorLog syslog:user</pre>
1431 <p>Additional modules can provide their own ErrorLog providers. The syntax
1432 is similar to the <code>syslog</code> example above.</p>
1434 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1435 document for details on why your security could be compromised
1436 if the directory where log files are stored is writable by
1437 anyone other than the user that starts the server.</p>
1438 <div class="warning"><h3>Note</h3>
1439 <p>When entering a file path on non-Unix platforms, care should be taken
1440 to make sure that only forward slashes are used even though the platform
1441 may allow the use of back slashes. In general it is a good idea to always
1442 use forward slashes throughout the configuration files.</p>
1447 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1448 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1451 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1452 <div class="directive-section"><h2><a name="ErrorLogFormat" id="ErrorLogFormat">ErrorLogFormat</a> <a name="errorlogformat" id="errorlogformat">Directive</a></h2>
1453 <table class="directive">
1454 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Format specification for error log entries</td></tr>
1455 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLogFormat [connection|request] <var>format</var></code></td></tr>
1456 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1457 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1458 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1460 <p><code class="directive">ErrorLogFormat</code> allows to specify what
1461 supplementary information is logged in the error log in addition to the
1462 actual log message.</p>
1464 <pre class="prettyprint lang-config">#Simple example
1465 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"</pre>
1468 <p>Specifying <code>connection</code> or <code>request</code> as first
1469 parameter allows to specify additional formats, causing additional
1470 information to be logged when the first message is logged for a specific
1471 connection or request, respectively. This additional information is only
1472 logged once per connection/request. If a connection or request is processed
1473 without causing any log message, the additional information is not logged
1476 <p>It can happen that some format string items do not produce output. For
1477 example, the Referer header is only present if the log message is
1478 associated to a request and the log message happens at a time when the
1479 Referer header has already been read from the client. If no output is
1480 produced, the default behavior is to delete everything from the preceding
1481 space character to the next space character. This means the log line is
1482 implicitly divided into fields on non-whitespace to whitespace transitions.
1483 If a format string item does not produce output, the whole field is
1484 omitted. For example, if the remote address <code>%a</code> in the log
1485 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1486 brackets are not logged either. Space characters can be escaped with a
1487 backslash to prevent them from delimiting a field. The combination '% '
1488 (percent space) is a zero-width field delimiter that does not produce any
1491 <p>The above behavior can be changed by adding modifiers to the format
1492 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1493 respective item does not produce any output. In once-per-connection/request
1494 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1495 item with the plus modifier does not produce any output, the whole line is
1498 <p>A number as modifier can be used to assign a log severity level to a
1499 format item. The item will only be logged if the severity of the log
1500 message is not higher than the specified log severity level. The number can
1501 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1503 <p>For example, here's what would happen if you added modifiers to
1504 the <code>%{Referer}i</code> token, which logs the
1505 <code>Referer</code> request header.</p>
1507 <table class="bordered"><tr class="header"><th>Modified Token</th><th>Meaning</th></tr>
1509 <td><code>%-{Referer}i</code></td>
1510 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1513 <td><code>%+{Referer}i</code></td>
1514 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1517 <td><code>%4{Referer}i</code></td>
1518 <td>Logs the <code>Referer</code> only if the log message severity
1519 is higher than 4.</td>
1523 <p>Some format string items accept additional parameters in braces.</p>
1525 <table class="bordered"><tr class="header"><th>Format String</th> <th>Description</th></tr>
1526 <tr><td><code>%%</code></td>
1527 <td>The percent sign</td></tr>
1528 <tr class="odd"><td><code>%a</code></td>
1529 <td>Client IP address and port of the request</td></tr>
1530 <tr><td><code>%{c}a</code></td>
1531 <td>Underlying peer IP address and port of the connection (see the
1532 <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module)</td></tr>
1533 <tr class="odd"><td><code>%A</code></td>
1534 <td>Local IP-address and port</td></tr>
1535 <tr><td><code>%{<em>name</em>}e</code></td>
1536 <td>Request environment variable <em>name</em></td></tr>
1537 <tr class="odd"><td><code>%E</code></td>
1538 <td>APR/OS error status code and string</td></tr>
1539 <tr><td><code>%F</code></td>
1540 <td>Source file name and line number of the log call</td></tr>
1541 <tr class="odd"><td><code>%{<em>name</em>}i</code></td>
1542 <td>Request header <em>name</em></td></tr>
1543 <tr><td><code>%k</code></td>
1544 <td>Number of keep-alive requests on this connection</td></tr>
1545 <tr class="odd"><td><code>%l</code></td>
1546 <td>Loglevel of the message</td></tr>
1547 <tr><td><code>%L</code></td>
1548 <td>Log ID of the request</td></tr>
1549 <tr class="odd"><td><code>%{c}L</code></td>
1550 <td>Log ID of the connection</td></tr>
1551 <tr><td><code>%{C}L</code></td>
1552 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1553 <tr class="odd"><td><code>%m</code></td>
1554 <td>Name of the module logging the message</td></tr>
1555 <tr><td><code>%M</code></td>
1556 <td>The actual log message</td></tr>
1557 <tr class="odd"><td><code>%{<em>name</em>}n</code></td>
1558 <td>Request note <em>name</em></td></tr>
1559 <tr><td><code>%P</code></td>
1560 <td>Process ID of current process</td></tr>
1561 <tr class="odd"><td><code>%T</code></td>
1562 <td>Thread ID of current thread</td></tr>
1563 <tr><td><code>%{g}T</code></td>
1564 <td>System unique thread ID of current thread (the same ID as
1565 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1566 <tr class="odd"><td><code>%t</code></td>
1567 <td>The current time</td></tr>
1568 <tr><td><code>%{u}t</code></td>
1569 <td>The current time including micro-seconds</td></tr>
1570 <tr class="odd"><td><code>%{cu}t</code></td>
1571 <td>The current time in compact ISO 8601 format, including
1572 micro-seconds</td></tr>
1573 <tr><td><code>%v</code></td>
1574 <td>The canonical <code class="directive"><a href="#servername">ServerName</a></code>
1575 of the current server.</td></tr>
1576 <tr class="odd"><td><code>%V</code></td>
1577 <td>The server name of the server serving the request according to the
1578 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
1580 <tr><td><code>\ </code> (backslash space)</td>
1581 <td>Non-field delimiting space</td></tr>
1582 <tr class="odd"><td><code>% </code> (percent space)</td>
1583 <td>Field delimiter (no output)</td></tr>
1586 <p>The log ID format <code>%L</code> produces a unique id for a connection
1587 or request. This can be used to correlate which log lines belong to the
1588 same connection or request, which request happens on which connection.
1589 A <code>%L</code> format string is also available in
1590 <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code> to allow to correlate access log entries
1591 with error log lines. If <code class="module"><a href="../mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its
1592 unique id will be used as log ID for requests.</p>
1594 <pre class="prettyprint lang-config">#Example (default format for threaded MPMs)
1595 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1598 <p>This would result in error messages such as:</p>
1600 <div class="example"><p><code>
1601 [Thu May 12 08:28:57.652118 2011] [core:error] [pid 8777:tid 4326490112] [client ::1:58619] File does not exist: /usr/local/apache2/htdocs/favicon.ico
1604 <p>Notice that, as discussed above, some fields are omitted
1605 entirely because they are not defined.</p>
1607 <pre class="prettyprint lang-config">#Example (similar to the 2.2.x format)
1608 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1611 <pre class="prettyprint lang-config">#Advanced example with request/connection log IDs
1612 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1613 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1614 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1615 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1616 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"</pre>
1622 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
1623 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1624 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1627 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1628 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1629 <table class="directive">
1630 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1632 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1633 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1634 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1635 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1636 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1638 <p>This option tracks additional data per worker about the
1639 currently executing request and creates a utilization summary.
1640 You can see these variables during runtime by configuring
1641 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>. Note that other modules may
1642 rely on this scoreboard.</p>
1644 <p>This setting applies to the entire server and cannot be
1645 enabled or disabled on a virtualhost-by-virtualhost basis.
1646 The collection of extended status information can slow down
1647 the server. Also note that this setting cannot be changed
1648 during a graceful restart.</p>
1651 <p>Note that loading <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> will change
1652 the default behavior to ExtendedStatus On, while other
1653 third party modules may do the same. Such modules rely on
1654 collecting detailed information about the state of all workers.
1655 The default is changed by <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> beginning
1656 with version 2.3.6. The previous default was always Off.</p>
1661 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1662 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1663 <table class="directive">
1664 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1665 HTTP response header for static files</td></tr>
1666 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1667 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag MTime Size</code></td></tr>
1668 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1669 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1670 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1671 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1672 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default used to be "INode MTime Size" in 2.3.14 and
1676 The <code class="directive">FileETag</code> directive configures the file
1677 attributes that are used to create the <code>ETag</code> (entity
1678 tag) response header field when the document is based on a static file.
1679 (The <code>ETag</code> value is used in cache management to save
1680 network bandwidth.) The
1681 <code class="directive">FileETag</code> directive allows you to choose
1682 which of these -- if any -- should be used. The recognized keywords are:
1686 <dt><strong>INode</strong></dt>
1687 <dd>The file's i-node number will be included in the calculation</dd>
1688 <dt><strong>MTime</strong></dt>
1689 <dd>The date and time the file was last modified will be included</dd>
1690 <dt><strong>Size</strong></dt>
1691 <dd>The number of bytes in the file will be included</dd>
1692 <dt><strong>All</strong></dt>
1693 <dd>All available fields will be used. This is equivalent to:
1694 <pre class="prettyprint lang-config">FileETag INode MTime Size</pre>
1696 <dt><strong>None</strong></dt>
1697 <dd>If a document is file-based, no <code>ETag</code> field will be
1698 included in the response</dd>
1701 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1702 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1703 which allow changes to be made to the default setting inherited
1704 from a broader scope. Any keyword appearing without such a prefix
1705 immediately and completely cancels the inherited setting.</p>
1707 <p>If a directory's configuration includes
1708 <code>FileETag INode MTime Size</code>, and a
1709 subdirectory's includes <code>FileETag -INode</code>,
1710 the setting for that subdirectory (which will be inherited by
1711 any sub-subdirectories that don't override it) will be equivalent to
1712 <code>FileETag MTime Size</code>.</p>
1713 <div class="warning"><h3>Warning</h3>
1714 Do not change the default for directories or locations that have WebDAV
1715 enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1716 <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>MTime Size</code>
1717 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1718 These conditional requests will break if the <code>ETag</code> format is
1719 changed via <code class="directive">FileETag</code>.
1721 <div class="note"><h3>Server Side Includes</h3>
1722 An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
1723 since the response entity can change without a change of the INode, MTime, or Size
1724 of the static file with embedded SSI directives.
1729 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1730 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1731 <table class="directive">
1732 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1734 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1735 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1736 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1737 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1738 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1740 <p>The <code class="directive"><Files></code> directive
1741 limits the scope of the enclosed directives by filename. It is comparable
1742 to the <code class="directive"><a href="#directory"><Directory></a></code>
1743 and <code class="directive"><a href="#location"><Location></a></code>
1744 directives. It should be matched with a <code></Files></code>
1745 directive. The directives given within this section will be applied to
1746 any object with a basename (last component of filename) matching the
1747 specified filename. <code class="directive"><Files></code>
1748 sections are processed in the order they appear in the
1749 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1750 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1751 that <code class="directive"><Files></code> can be nested
1752 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1753 portion of the filesystem they apply to.</p>
1755 <p>The <var>filename</var> argument should include a filename, or
1756 a wild-card string, where <code>?</code> matches any single character,
1757 and <code>*</code> matches any sequences of characters.</p>
1758 <pre class="prettyprint lang-config"><Files "cat.html">
1759 # Insert stuff that applies to cat.html here
1762 <Files "?at.*">
1763 # This would apply to cat.html, bat.html, hat.php and so on.
1764 </Files></pre>
1766 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1767 can also be used, with the addition of the
1768 <code>~</code> character. For example:</p>
1770 <pre class="prettyprint lang-config"><Files ~ "\.(gif|jpe?g|png)$">
1772 </Files></pre>
1775 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1778 <p>Note that unlike <code class="directive"><a href="#directory"><Directory></a></code> and <code class="directive"><a href="#location"><Location></a></code> sections, <code class="directive"><Files></code> sections can be used inside
1779 <code>.htaccess</code> files. This allows users to control access to
1780 their own files, at a file-by-file level.</p>
1785 <li><a href="../sections.html">How <Directory>, <Location>
1786 and <Files> sections work</a> for an explanation of how these
1787 different sections are combined when a request is received</li>
1790 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1791 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1792 <table class="directive">
1793 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1795 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1796 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1797 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1798 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1799 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1801 <p>The <code class="directive"><FilesMatch></code> directive
1802 limits the scope of the enclosed directives by filename, just as the
1803 <code class="directive"><a href="#files"><Files></a></code> directive
1804 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1805 expression</a>. For example:</p>
1807 <pre class="prettyprint lang-config"><FilesMatch ".+\.(gif|jpe?g|png)$">
1809 </FilesMatch></pre>
1812 <p>would match most common Internet graphics formats.</p>
1814 <div class="note">The <code>.+</code> at the start of the regex ensures that
1815 files named <code>.png</code>, or <code>.gif</code>, for example,
1816 are not matched.</div>
1818 <p>From 2.4.8 onwards, named groups and backreferences are captured and
1819 written to the environment with the corresponding name prefixed with
1820 "MATCH_" and in upper case. This allows elements of files to be referenced
1821 from within <a href="../expr.html">expressions</a> and modules like
1822 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
1823 (unnamed) backreferences are ignored. Use named groups instead.</p>
1825 <pre class="prettyprint lang-config"><FilesMatch "^(?<sitename>[^/]+)">
1826 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1827 </FilesMatch></pre>
1832 <li><a href="../sections.html">How <Directory>, <Location>
1833 and <Files> sections work</a> for an explanation of how these
1834 different sections are combined when a request is received</li>
1837 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1838 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1839 <table class="directive">
1840 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1841 media type in the HTTP Content-Type header field</td></tr>
1842 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1843 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1844 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1845 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1846 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1848 <p>When placed into an <code>.htaccess</code> file or a
1849 <code class="directive"><a href="#directory"><Directory></a></code>, or
1850 <code class="directive"><a href="#location"><Location></a></code> or
1851 <code class="directive"><a href="#files"><Files></a></code>
1852 section, this directive forces all matching files to be served
1853 with the content type identification given by
1854 <var>media-type</var>. For example, if you had a directory full of
1855 GIF files, but did not want to label them all with <code>.gif</code>,
1856 you might want to use:</p>
1858 <pre class="prettyprint lang-config">ForceType image/gif</pre>
1861 <p>Note that this directive overrides other indirect media type
1862 associations defined in mime.types or via the
1863 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1865 <p>You can also override more general
1866 <code class="directive">ForceType</code> settings
1867 by using the value of <code>None</code>:</p>
1869 <pre class="prettyprint lang-config"># force all files to be image/gif:
1870 <Location "/images">
1874 # but normal mime-type associations here:
1875 <Location "/images/mixed">
1877 </Location></pre>
1880 <p>This directive primarily overrides the content types generated for
1881 static files served out of the filesystem. For resources other than
1882 static files, where the generator of the response typically specifies
1883 a Content-Type, this directive has no effect.</p>
1886 <div class="note"><h3>Note</h3>
1887 <p>If no handler is explicitly set for a request, the specified content
1888 type will also be used as the handler name. </p>
1890 <p>When explicit directives such as
1891 <code class="directive"><a href="#sethandler">SetHandler</a></code> or
1892 <code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code> do not apply
1893 to the current request, the internal handler name normally set by those
1894 directives is instead set to the content type specified by this directive.
1897 This is a historical behavior that some third-party modules
1898 (such as mod_php) may look for a "synthetic" content type used only to
1899 signal the module to take responsibility for the matching request.
1902 <p>Configurations that rely on such "synthetic" types should be avoided.
1903 Additionally, configurations that restrict access to
1904 <code class="directive"><a href="#sethandler">SetHandler</a></code> or
1905 <code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code> should
1906 restrict access to this directive as well.</p>
1911 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1912 <div class="directive-section"><h2><a name="GprofDir" id="GprofDir">GprofDir</a> <a name="gprofdir" id="gprofdir">Directive</a></h2>
1913 <table class="directive">
1914 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory to write gmon.out profiling data to. </td></tr>
1915 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</code></td></tr>
1916 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1917 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1918 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1920 <p>When the server has been compiled with gprof profiling support,
1921 <code class="directive">GprofDir</code> causes <code>gmon.out</code> files to
1922 be written to the specified directory when the process exits. If the
1923 argument ends with a percent symbol ('%'), subdirectories are created
1924 for each process id.</p>
1926 <p>This directive currently only works with the <code class="module"><a href="../mod/prefork.html">prefork</a></code>
1930 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1931 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1932 <table class="directive">
1933 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1934 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1935 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1936 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1937 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1938 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1940 <p>This directive enables DNS lookups so that host names can be
1941 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1942 The value <code>Double</code> refers to doing double-reverse
1943 DNS lookup. That is, after a reverse lookup is performed, a forward
1944 lookup is then performed on that result. At least one of the IP
1945 addresses in the forward lookup must match the original
1946 address. (In "tcpwrappers" terminology this is called
1947 <code>PARANOID</code>.)</p>
1949 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1950 used for controlling access by hostname, a double reverse lookup
1951 will be performed. This is necessary for security. Note that the
1952 result of this double-reverse isn't generally available unless you
1953 set <code>HostnameLookups Double</code>. For example, if only
1954 <code>HostnameLookups On</code> and a request is made to an object
1955 that is protected by hostname restrictions, regardless of whether
1956 the double-reverse fails or not, CGIs will still be passed the
1957 single-reverse result in <code>REMOTE_HOST</code>.</p>
1959 <p>The default is <code>Off</code> in order to save the network
1960 traffic for those sites that don't truly need the reverse
1961 lookups done. It is also better for the end users because they
1962 don't have to suffer the extra latency that a lookup entails.
1963 Heavily loaded sites should leave this directive
1964 <code>Off</code>, since DNS lookups can take considerable
1965 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1966 default to the <code>bin</code> subdirectory of your installation
1967 directory, can be used to look up host names from logged IP addresses
1970 <p>Finally, if you have <a href="mod_authz_host.html#reqhost">hostname-based Require
1971 directives</a>, a hostname lookup will be performed regardless of
1972 the setting of <code>HostnameLookups</code>.</p>
1975 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1976 <div class="directive-section"><h2><a name="If" id="If"><If></a> <a name="if" id="if">Directive</a></h2>
1977 <table class="directive">
1978 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1979 satisfied by a request at runtime</td></tr>
1980 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><If <var>expression</var>> ... </If></code></td></tr>
1981 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1982 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1983 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1984 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1986 <p>The <code class="directive"><If></code> directive
1987 evaluates an expression at runtime, and applies the enclosed
1988 directives if and only if the expression evaluates to true.
1991 <pre class="prettyprint lang-config"><If "-z req('Host')"></pre>
1994 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1995 Expressions may contain various shell-like operators for string
1996 comparison (<code>==</code>, <code>!=</code>, <code><</code>, ...),
1997 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1998 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1999 It is also possible to use regular expressions, </p>
2001 <pre class="prettyprint lang-config"><If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"></pre>
2004 <p>shell-like pattern matches and many other operations. These operations
2005 can be done on request headers (<code>req</code>), environment variables
2006 (<code>env</code>), and a large number of other properties. The full
2007 documentation is available in <a href="../expr.html">Expressions in
2008 Apache HTTP Server</a>.</p>
2010 <p>Only directives that support the <a href="directive-dict.html#Context">directory context</a> can be used within this configuration section.</p>
2012 <div class="warning">
2013 Certain variables, such as <code>CONTENT_TYPE</code> and other
2014 response headers, are set after <If> conditions have already
2015 been evaluated, and so will not be available to use in this
2022 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
2023 for a complete reference and more examples.</li>
2024 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
2025 <li><code class="directive"><a href="#else"><Else></a></code></li>
2026 <li><a href="../sections.html">How <Directory>, <Location>,
2027 <Files> sections work</a> for an explanation of how these
2028 different sections are combined when a request is received.
2029 <code class="directive"><If></code>,
2030 <code class="directive"><ElseIf></code>, and
2031 <code class="directive"><Else></code> are applied last.</li>
2034 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2035 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
2036 <table class="directive">
2037 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
2038 if a test is true at startup</td></tr>
2039 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
2040 </IfDefine></code></td></tr>
2041 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2042 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2043 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2044 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2046 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
2047 </code> section is used to mark directives that are conditional. The
2048 directives within an <code class="directive"><IfDefine></code>
2049 section are only processed if the <var>test</var> is true. If <var>
2050 test</var> is false, everything between the start and end markers is
2053 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
2056 <li><var>parameter-name</var></li>
2058 <li><code>!</code><var>parameter-name</var></li>
2061 <p>In the former case, the directives between the start and end
2062 markers are only processed if the parameter named
2063 <var>parameter-name</var> is defined. The second format reverses
2064 the test, and only processes the directives if
2065 <var>parameter-name</var> is <strong>not</strong> defined.</p>
2067 <p>The <var>parameter-name</var> argument is a define as given on the
2068 <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
2069 </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
2071 <p><code class="directive"><IfDefine></code> sections are
2072 nest-able, which can be used to implement simple
2073 multiple-parameter tests. Example:</p>
2075 <div class="example"><p><code>httpd -DReverseProxy -DUseCache -DMemCache ...</code></p></div>
2076 <pre class="prettyprint lang-config"><IfDefine ReverseProxy>
2077 LoadModule proxy_module modules/mod_proxy.so
2078 LoadModule proxy_http_module modules/mod_proxy_http.so
2079 <IfDefine UseCache>
2080 LoadModule cache_module modules/mod_cache.so
2081 <IfDefine MemCache>
2082 LoadModule mem_cache_module modules/mod_mem_cache.so
2084 <IfDefine !MemCache>
2085 LoadModule cache_disk_module modules/mod_cache_disk.so
2088 </IfDefine></pre>
2092 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2093 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
2094 <table class="directive">
2095 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2096 presence or absence of a specific module</td></tr>
2097 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2098 </IfModule></code></td></tr>
2099 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2100 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2101 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2102 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2104 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
2105 section is used to mark directives that are conditional on the presence of
2106 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
2107 is true. If <var>test</var> is false, everything between the start and
2108 end markers is ignored.</p>
2110 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
2113 <li><var>module</var></li>
2115 <li>!<var>module</var></li>
2118 <p>In the former case, the directives between the start and end
2119 markers are only processed if the module named <var>module</var>
2120 is included in Apache httpd -- either compiled in or
2121 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
2122 and only processes the directives if <var>module</var> is
2123 <strong>not</strong> included.</p>
2125 <p>The <var>module</var> argument can be either the module identifier or
2126 the file name of the module, at the time it was compiled. For example,
2127 <code>rewrite_module</code> is the identifier and
2128 <code>mod_rewrite.c</code> is the file name. If a module consists of
2129 several source files, use the name of the file containing the string
2130 <code>STANDARD20_MODULE_STUFF</code>.</p>
2132 <p><code class="directive"><IfModule></code> sections are
2133 nest-able, which can be used to implement simple multiple-module
2136 <div class="note">This section should only be used if you need to have one
2137 configuration file that works whether or not a specific module
2138 is available. In normal operation, directives need not be
2139 placed in <code class="directive"><IfModule></code>
2143 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2144 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
2145 <table class="directive">
2146 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2147 the server configuration files</td></tr>
2148 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Include <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></code></td></tr>
2149 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2150 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2151 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2152 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Directory
2153 wildcard matching available in 2.3.6 and later</td></tr>
2155 <p>This directive allows inclusion of other configuration files
2156 from within the server configuration files.</p>
2158 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2159 in the filename or directory parts of the path to include several files
2160 at once, in alphabetical order. In addition, if
2161 <code class="directive">Include</code> points to a directory, rather than a file,
2162 Apache httpd will read all files in that directory and any subdirectory.
2163 However, including entire directories is not recommended, because it is
2164 easy to accidentally leave temporary files in a directory that can cause
2165 <code class="program"><a href="../programs/httpd.html">httpd</a></code> to fail. Instead, we encourage you to use the
2166 wildcard syntax shown below, to include files that match a particular
2167 pattern, such as *.conf, for example.</p>
2169 <p>The <code class="directive"><a href="#include">Include</a></code> directive will
2170 <strong>fail with an error</strong> if a wildcard expression does not
2171 match any file. The <code class="directive"><a href="#includeoptional">IncludeOptional</a></code>
2172 directive can be used if non-matching wildcards should be ignored.</p>
2174 <p>The file path specified may be an absolute path, or may be relative
2175 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
2179 <pre class="prettyprint lang-config">Include /usr/local/apache2/conf/ssl.conf
2180 Include /usr/local/apache2/conf/vhosts/*.conf</pre>
2183 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
2185 <pre class="prettyprint lang-config">Include conf/ssl.conf
2186 Include conf/vhosts/*.conf</pre>
2189 <p>Wildcards may be included in the directory or file portion of the
2190 path. This example will fail if there is no subdirectory in conf/vhosts
2191 that contains at least one *.conf file:</p>
2193 <pre class="prettyprint lang-config">Include conf/vhosts/*/*.conf</pre>
2196 <p>Alternatively, the following command will just be ignored in case of
2197 missing files or directories:</p>
2199 <pre class="prettyprint lang-config">IncludeOptional conf/vhosts/*/*.conf</pre>
2205 <li><code class="directive"><a href="#includeoptional">IncludeOptional</a></code></li>
2206 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2209 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2210 <div class="directive-section"><h2><a name="IncludeOptional" id="IncludeOptional">IncludeOptional</a> <a name="includeoptional" id="includeoptional">Directive</a></h2>
2211 <table class="directive">
2212 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2213 the server configuration files</td></tr>
2214 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>IncludeOptional <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></code></td></tr>
2215 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2216 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2217 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2218 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in 2.3.6 and later</td></tr>
2220 <p>This directive allows inclusion of other configuration files
2221 from within the server configuration files. It works identically to the
2222 <code class="directive"><a href="#include">Include</a></code> directive, with the
2223 exception that if wildcards do not match any file or directory, the
2224 <code class="directive"><a href="#includeoptional">IncludeOptional</a></code> directive will be
2225 silently ignored instead of causing an error.</p>
2229 <li><code class="directive"><a href="#include">Include</a></code></li>
2230 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2233 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2234 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
2235 <table class="directive">
2236 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
2237 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
2238 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
2239 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2240 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2241 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2243 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2244 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2245 which allow multiple requests to be sent over the same TCP
2246 connection. In some cases this has been shown to result in an
2247 almost 50% speedup in latency times for HTML documents with
2248 many images. To enable Keep-Alive connections, set
2249 <code>KeepAlive On</code>.</p>
2251 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2252 used if they are specifically requested by a client. In
2253 addition, a Keep-Alive connection with an HTTP/1.0 client can
2254 only be used when the length of the content is known in
2255 advance. This implies that dynamic content such as CGI output,
2256 SSI pages, and server-generated directory listings will
2257 generally not use Keep-Alive connections to HTTP/1.0 clients.
2258 For HTTP/1.1 clients, persistent connections are the default
2259 unless otherwise specified. If the client requests it, chunked
2260 encoding will be used in order to send content of unknown
2261 length over persistent connections.</p>
2263 <p>When a client uses a Keep-Alive connection, it will be counted
2264 as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> directive, regardless
2265 of how many requests are sent using the connection.</p>
2269 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
2272 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2273 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
2274 <table class="directive">
2275 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
2276 requests on a persistent connection</td></tr>
2277 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
2278 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
2279 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2280 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2281 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2283 <p>The number of seconds Apache httpd will wait for a subsequent
2284 request before closing the connection. By adding a postfix of ms the
2285 timeout can be also set in milliseconds. Once a request has been
2286 received, the timeout value specified by the
2287 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
2289 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
2290 may cause performance problems in heavily loaded servers. The
2291 higher the timeout, the more server processes will be kept
2292 occupied waiting on connections with idle clients.</p>
2294 <p>If <code class="directive">KeepAliveTimeout</code> is <strong>not</strong>
2295 set for a name-based virtual host, the value of the first defined
2296 virtual host best matching the local IP and port will be used.</p>
2299 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2300 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
2301 <table class="directive">
2302 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
2304 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
2305 </Limit></code></td></tr>
2306 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2307 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2308 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2309 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2311 <p>Access controls are normally effective for
2312 <strong>all</strong> access methods, and this is the usual
2313 desired behavior. <strong>In the general case, access control
2314 directives should not be placed within a
2315 <code class="directive"><Limit></code> section.</strong></p>
2317 <p>The purpose of the <code class="directive"><Limit></code>
2318 directive is to restrict the effect of the access controls to the
2319 nominated HTTP methods. For all other methods, the access
2320 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
2321 effect</strong>. The following example applies the access control
2322 only to the methods <code>POST</code>, <code>PUT</code>, and
2323 <code>DELETE</code>, leaving all other methods unprotected:</p>
2325 <pre class="prettyprint lang-config"><Limit POST PUT DELETE>
2327 </Limit></pre>
2330 <p>The method names listed can be one or more of: <code>GET</code>,
2331 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2332 <code>CONNECT</code>, <code>OPTIONS</code>,
2333 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2334 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2335 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2336 case-sensitive.</strong> If <code>GET</code> is used, it will also
2337 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2338 cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
2340 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
2341 used in preference to a <code class="directive"><Limit></code>
2342 section when restricting access, since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
2343 against arbitrary methods.</div>
2345 <p>The <code class="directive"><Limit></code> and
2346 <code class="directive"><a href="#limitexcept"><LimitExcept></a></code>
2347 directives may be nested. In this case, each successive level of
2348 <code class="directive"><Limit></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> directives must
2349 further restrict the set of methods to which access controls apply.</p>
2351 <div class="warning">When using
2352 <code class="directive"><Limit></code> or
2353 <code class="directive"><LimitExcept></code> directives with
2354 the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
2355 note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
2356 to succeed authorizes the request, regardless of the presence of other
2357 <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
2359 <p>For example, given the following configuration, all users will
2360 be authorized for <code>POST</code> requests, and the
2361 <code>Require group editors</code> directive will be ignored
2364 <pre class="prettyprint lang-config"><LimitExcept GET>
2366 </LimitExcept>
2368 Require group editors
2369 </Limit></pre>
2373 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2374 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
2375 <table class="directive">
2376 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
2377 except the named ones</td></tr>
2378 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2379 </LimitExcept></code></td></tr>
2380 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2381 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2382 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2383 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2385 <p><code class="directive"><LimitExcept></code> and
2386 <code></LimitExcept></code> are used to enclose
2387 a group of access control directives which will then apply to any
2388 HTTP access method <strong>not</strong> listed in the arguments;
2389 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
2390 both standard and nonstandard/unrecognized methods. See the
2391 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
2395 <pre class="prettyprint lang-config"><LimitExcept POST GET>
2397 </LimitExcept></pre>
2402 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2403 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
2404 <table class="directive">
2405 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
2406 subrequests</td></tr>
2407 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
2408 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
2409 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2410 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2411 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2413 <p>An internal redirect happens, for example, when using the <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> directive, which internally
2414 redirects the original request to a CGI script. A subrequest is Apache httpd's
2415 mechanism to find out what would happen for some URI if it were requested.
2416 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
2417 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2420 <p><code class="directive">LimitInternalRecursion</code> prevents the server
2421 from crashing when entering an infinite loop of internal redirects or
2422 subrequests. Such loops are usually caused by misconfigurations.</p>
2424 <p>The directive stores two different limits, which are evaluated on
2425 per-request basis. The first <var>number</var> is the maximum number of
2426 internal redirects that may follow each other. The second <var>number</var>
2427 determines how deeply subrequests may be nested. If you specify only one
2428 <var>number</var>, it will be assigned to both limits.</p>
2430 <pre class="prettyprint lang-config">LimitInternalRecursion 5</pre>
2434 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2435 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
2436 <table class="directive">
2437 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
2438 from the client</td></tr>
2439 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
2440 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
2441 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2442 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2443 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2444 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2446 <p>This directive specifies the number of <var>bytes</var> from 0
2447 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2448 request body. See the note below for the limited applicability
2449 to proxy requests.</p>
2451 <p>The <code class="directive">LimitRequestBody</code> directive allows
2452 the user to set a limit on the allowed size of an HTTP request
2453 message body within the context in which the directive is given
2454 (server, per-directory, per-file or per-location). If the client
2455 request exceeds that limit, the server will return an error
2456 response instead of servicing the request. The size of a normal
2457 request message body will vary greatly depending on the nature of
2458 the resource and the methods allowed on that resource. CGI scripts
2459 typically use the message body for retrieving form information.
2460 Implementations of the <code>PUT</code> method will require
2461 a value at least as large as any representation that the server
2462 wishes to accept for that resource.</p>
2464 <p>This directive gives the server administrator greater
2465 control over abnormal client request behavior, which may be
2466 useful for avoiding some forms of denial-of-service
2469 <p>If, for example, you are permitting file upload to a particular
2470 location and wish to limit the size of the uploaded file to 100K,
2471 you might use the following directive:</p>
2473 <pre class="prettyprint lang-config">LimitRequestBody 102400</pre>
2476 <div class="note"><p>For a full description of how this directive is interpreted by
2477 proxy requests, see the <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> documentation.</p>
2482 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2483 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
2484 <table class="directive">
2485 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
2486 will be accepted from the client</td></tr>
2487 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
2488 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
2489 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2490 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2491 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2493 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2494 32767. The default value is defined by the compile-time
2495 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2498 <p>The <code class="directive">LimitRequestFields</code> directive allows
2499 the server administrator to modify the limit on the number of
2500 request header fields allowed in an HTTP request. A server needs
2501 this value to be larger than the number of fields that a normal
2502 client request might include. The number of request header fields
2503 used by a client rarely exceeds 20, but this may vary among
2504 different client implementations, often depending upon the extent
2505 to which a user has configured their browser to support detailed
2506 content negotiation. Optional HTTP extensions are often expressed
2507 using request header fields.</p>
2509 <p>This directive gives the server administrator greater
2510 control over abnormal client request behavior, which may be
2511 useful for avoiding some forms of denial-of-service attacks.
2512 The value should be increased if normal clients see an error
2513 response from the server that indicates too many fields were
2514 sent in the request.</p>
2518 <pre class="prettyprint lang-config">LimitRequestFields 50</pre>
2521 <div class="warning"><h3>Warning</h3>
2522 <p> When name-based virtual hosting is used, the value for this
2523 directive is taken from the default (first-listed) virtual host for the
2524 local IP and port combination.</p>
2529 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2530 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
2531 <table class="directive">
2532 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
2534 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
2535 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
2536 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2537 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2538 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2540 <p>This directive specifies the number of <var>bytes</var>
2541 that will be allowed in an HTTP request header.</p>
2543 <p>The <code class="directive">LimitRequestFieldSize</code> directive
2544 allows the server administrator to set the limit
2545 on the allowed size of an HTTP request header field. A server
2546 needs this value to be large enough to hold any one header field
2547 from a normal client request. The size of a normal request header
2548 field will vary greatly among different client implementations,
2549 often depending upon the extent to which a user has configured
2550 their browser to support detailed content negotiation. SPNEGO
2551 authentication headers can be up to 12392 bytes.</p>
2553 <p>This directive gives the server administrator greater
2554 control over abnormal client request behavior, which may be
2555 useful for avoiding some forms of denial-of-service attacks.</p>
2559 <pre class="prettyprint lang-config">LimitRequestFieldSize 4094</pre>
2562 <div class="note">Under normal conditions, the value should not be changed from
2565 <div class="warning"><h3>Warning</h3>
2566 <p> When name-based virtual hosting is used, the value for this
2567 directive is taken from the default (first-listed) virtual host best
2568 matching the current IP address and port combination.</p>
2572 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2573 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
2574 <table class="directive">
2575 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
2576 from the client</td></tr>
2577 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
2578 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
2579 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2580 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2581 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2583 <p>This directive sets the number of <var>bytes</var> that will be
2584 allowed on the HTTP request-line.</p>
2586 <p>The <code class="directive">LimitRequestLine</code> directive allows
2587 the server administrator to set the limit on the allowed size
2588 of a client's HTTP request-line. Since the request-line consists of the
2589 HTTP method, URI, and protocol version, the
2590 <code class="directive">LimitRequestLine</code> directive places a
2591 restriction on the length of a request-URI allowed for a request
2592 on the server. A server needs this value to be large enough to
2593 hold any of its resource names, including any information that
2594 might be passed in the query part of a <code>GET</code> request.</p>
2596 <p>This directive gives the server administrator greater
2597 control over abnormal client request behavior, which may be
2598 useful for avoiding some forms of denial-of-service attacks.</p>
2602 <pre class="prettyprint lang-config">LimitRequestLine 4094</pre>
2605 <div class="note">Under normal conditions, the value should not be changed from
2608 <div class="warning"><h3>Warning</h3>
2609 <p> When name-based virtual hosting is used, the value for this
2610 directive is taken from the default (first-listed) virtual host best
2611 matching the current IP address and port combination.</p>
2616 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2617 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
2618 <table class="directive">
2619 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
2620 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
2621 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
2622 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2623 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2624 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2625 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2627 <p>Limit (in bytes) on maximum size of an XML-based request
2628 body. A value of <code>0</code> will disable any checking.</p>
2632 <pre class="prettyprint lang-config">LimitXMLRequestBody 0</pre>
2637 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2638 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
2639 <table class="directive">
2640 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2642 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
2643 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
2644 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2645 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2646 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2648 <p>The <code class="directive"><Location></code> directive
2649 limits the scope of the enclosed directives by URL. It is similar to the
2650 <code class="directive"><a href="#directory"><Directory></a></code>
2651 directive, and starts a subsection which is terminated with a
2652 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
2653 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
2654 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
2656 <p><code class="directive"><Location></code> sections operate
2657 completely outside the filesystem. This has several consequences.
2658 Most importantly, <code class="directive"><Location></code>
2659 directives should not be used to control access to filesystem
2660 locations. Since several different URLs may map to the same
2661 filesystem location, such access controls may by circumvented.</p>
2663 <p>The enclosed directives will be applied to the request if the path component
2664 of the URL meets <em>any</em> of the following criteria:
2667 <li>The specified location matches exactly the path component of the URL.
2669 <li>The specified location, which ends in a forward slash, is a prefix
2670 of the path component of the URL (treated as a context root).
2672 <li>The specified location, with the addition of a trailing slash, is a
2673 prefix of the path component of the URL (also treated as a context root).
2677 In the example below, where no trailing slash is used, requests to
2678 /private1, /private1/ and /private1/file.txt will have the enclosed
2679 directives applied, but /private1other would not.
2681 <pre class="prettyprint lang-config"><Location "/private1">
2683 </Location></pre>
2686 In the example below, where a trailing slash is used, requests to
2687 /private2/ and /private2/file.txt will have the enclosed
2688 directives applied, but /private2 and /private2other would not.
2690 <pre class="prettyprint lang-config"><Location "/private2<em>/</em>">
2692 </Location></pre>
2695 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
2697 <p>Use <code class="directive"><Location></code> to apply
2698 directives to content that lives outside the filesystem. For
2699 content that lives in the filesystem, use <code class="directive"><a href="#directory"><Directory></a></code> and <code class="directive"><a href="#files"><Files></a></code>. An exception is
2700 <code><Location "/"></code>, which is an easy way to
2701 apply a configuration to the entire server.</p>
2704 <p>For all origin (non-proxy) requests, the URL to be matched is a
2705 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2706 port, or query string may be included.</em> For proxy requests, the
2707 URL to be matched is of the form
2708 <code>scheme://servername/path</code>, and you must include the
2711 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2712 any single character, and <code>*</code> matches any sequences of
2713 characters. Neither wildcard character matches a / in the URL-path.</p>
2715 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
2716 can also be used, with the addition of the <code>~</code>
2717 character. For example:</p>
2719 <pre class="prettyprint lang-config"><Location ~ "/(extra|special)/data">
2721 </Location></pre>
2724 <p>would match URLs that contained the substring <code>/extra/data</code>
2725 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
2726 identical to the regex version of <code class="directive"><Location></code>, and is preferred, for the
2727 simple reason that <code>~</code> is hard to distinguish from
2728 <code>-</code> in many fonts.</p>
2730 <p>The <code class="directive"><Location></code>
2731 functionality is especially useful when combined with the
2732 <code class="directive"><a href="#sethandler">SetHandler</a></code>
2733 directive. For example, to enable status requests but allow them
2734 only from browsers at <code>example.com</code>, you might use:</p>
2736 <pre class="prettyprint lang-config"><Location "/status">
2737 SetHandler server-status
2738 Require host example.com
2739 </Location></pre>
2742 <div class="note"><h3>Note about / (slash)</h3>
2743 <p>The slash character has special meaning depending on where in a
2744 URL it appears. People may be used to its behavior in the filesystem
2745 where multiple adjacent slashes are frequently collapsed to a single
2746 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2747 <code>/home/foo</code>). In URL-space this is not necessarily true.
2748 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
2749 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
2750 slashes if that is your intention.</p>
2752 <p>For example, <code><LocationMatch "^/abc"></code> would match
2753 the request URL <code>/abc</code> but not the request URL <code>
2754 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
2755 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
2756 implicitly match multiple slashes with a single slash. For example,
2757 if you specify <code><Location "/abc/def"></code> and the
2758 request is to <code>/abc//def</code> then it will match.</p>
2763 <li><a href="../sections.html">How <Directory>, <Location>
2764 and <Files> sections work</a> for an explanation of how these
2765 different sections are combined when a request is received.</li>
2766 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
2769 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2770 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2771 <table class="directive">
2772 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2773 matching URLs</td></tr>
2774 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
2775 <var>regex</var>> ... </LocationMatch></code></td></tr>
2776 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2777 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2778 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2780 <p>The <code class="directive"><LocationMatch></code> directive
2781 limits the scope of the enclosed directives by URL, in an identical manner
2782 to <code class="directive"><a href="#location"><Location></a></code>. However,
2783 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2784 as an argument instead of a simple string. For example:</p>
2786 <pre class="prettyprint lang-config"><LocationMatch "/(extra|special)/data">
2788 </LocationMatch></pre>
2791 <p>would match URLs that contained the substring <code>/extra/data</code>
2792 or <code>/special/data</code>.</p>
2794 <div class="note"><p>If the intent is that a URL <strong>starts with</strong>
2795 <code>/extra/data</code>, rather than merely
2796 <strong>contains</strong> <code>/extra/data</code>, prefix the
2797 regular expression with a <code>^</code> to require this.</p>
2799 <pre class="prettyprint lang-config"><LocationMatch "^/(extra|special)/data"></pre>
2803 <p>From 2.4.8 onwards, named groups and backreferences are captured and
2804 written to the environment with the corresponding name prefixed with
2805 "MATCH_" and in upper case. This allows elements of URLs to be referenced
2806 from within <a href="../expr.html">expressions</a> and modules like
2807 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
2808 (unnamed) backreferences are ignored. Use named groups instead.</p>
2810 <pre class="prettyprint lang-config"><LocationMatch "^/combined/(?<sitename>[^/]+)">
2811 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
2812 </LocationMatch></pre>
2817 <li><a href="../sections.html">How <Directory>, <Location>
2818 and <Files> sections work</a> for an explanation of how these
2819 different sections are combined when a request is received</li>
2822 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2823 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2824 <table class="directive">
2825 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2826 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel [<var>module</var>:]<var>level</var>
2827 [<var>module</var>:<var>level</var>] ...
2829 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2830 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2831 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2832 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2833 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Per-module and per-directory configuration is available in
2834 Apache HTTP Server 2.3.6 and later</td></tr>
2836 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2837 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2838 <var>level</var>s are available, in order of decreasing
2841 <table class="bordered">
2844 <th><strong>Level</strong> </th>
2846 <th><strong>Description</strong> </th>
2848 <th><strong>Example</strong> </th>
2852 <td><code>emerg</code> </td>
2854 <td>Emergencies - system is unusable.</td>
2856 <td>"Child cannot open lock file. Exiting"</td>
2860 <td><code>alert</code> </td>
2862 <td>Action must be taken immediately.</td>
2864 <td>"getpwuid: couldn't determine user name from uid"</td>
2868 <td><code>crit</code> </td>
2870 <td>Critical Conditions.</td>
2872 <td>"socket: Failed to get a socket, exiting child"</td>
2876 <td><code>error</code> </td>
2878 <td>Error conditions.</td>
2880 <td>"Premature end of script headers"</td>
2884 <td><code>warn</code> </td>
2886 <td>Warning conditions.</td>
2888 <td>"child process 1234 did not exit, sending another
2893 <td><code>notice</code> </td>
2895 <td>Normal but significant condition.</td>
2897 <td>"httpd: caught SIGBUS, attempting to dump core in
2902 <td><code>info</code> </td>
2904 <td>Informational.</td>
2906 <td>"Server seems busy, (you may need to increase
2907 StartServers, or Min/MaxSpareServers)..."</td>
2911 <td><code>debug</code> </td>
2913 <td>Debug-level messages</td>
2915 <td>"Opening config file ..."</td>
2918 <td><code>trace1</code> </td>
2920 <td>Trace messages</td>
2922 <td>"proxy: FTP: control connection complete"</td>
2925 <td><code>trace2</code> </td>
2927 <td>Trace messages</td>
2929 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2932 <td><code>trace3</code> </td>
2934 <td>Trace messages</td>
2936 <td>"openssl: Handshake: start"</td>
2939 <td><code>trace4</code> </td>
2941 <td>Trace messages</td>
2943 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2946 <td><code>trace5</code> </td>
2948 <td>Trace messages</td>
2950 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2953 <td><code>trace6</code> </td>
2955 <td>Trace messages</td>
2957 <td>"cache lookup FAILED, forcing new map lookup"</td>
2960 <td><code>trace7</code> </td>
2962 <td>Trace messages, dumping large amounts of data</td>
2964 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2967 <td><code>trace8</code> </td>
2969 <td>Trace messages, dumping large amounts of data</td>
2971 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2975 <p>When a particular level is specified, messages from all
2976 other levels of higher significance will be reported as well.
2977 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2978 then messages with log levels of <code>notice</code> and
2979 <code>warn</code> will also be posted.</p>
2981 <p>Using a level of at least <code>crit</code> is
2986 <pre class="prettyprint lang-config">LogLevel notice</pre>
2989 <div class="note"><h3>Note</h3>
2990 <p>When logging to a regular file, messages of the level
2991 <code>notice</code> cannot be suppressed and thus are always
2992 logged. However, this doesn't apply when logging is done
2993 using <code>syslog</code>.</p>
2996 <p>Specifying a level without a module name will reset the level
2997 for all modules to that level. Specifying a level with a module
2998 name will set the level for that module only. It is possible to
2999 use the module source file name, the module identifier, or the
3000 module identifier with the trailing <code>_module</code> omitted
3001 as module specification. This means the following three specifications
3004 <pre class="prettyprint lang-config">LogLevel info ssl:warn
3005 LogLevel info mod_ssl.c:warn
3006 LogLevel info ssl_module:warn</pre>
3009 <p>It is also possible to change the level per directory:</p>
3011 <pre class="prettyprint lang-config">LogLevel info
3012 <Directory "/usr/local/apache/htdocs/app">
3014 </Directory></pre>
3018 Per directory loglevel configuration only affects messages that are
3019 logged after the request has been parsed and that are associated with
3020 the request. Log messages which are associated with the server or
3021 the connection are not affected. The latter can be influenced by the
3022 <code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code> directive,
3028 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
3029 <li><code class="directive"><a href="#errorlogformat">ErrorLogFormat</a></code></li>
3030 <li><code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code></li>
3031 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
3034 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3035 <div class="directive-section"><h2><a name="LogLevelOverride" id="LogLevelOverride">LogLevelOverride</a> <a name="logleveloverride" id="logleveloverride">Directive</a></h2>
3036 <table class="directive">
3037 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override the verbosity of the ErrorLog for certain clients</td></tr>
3038 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>ipaddress</var>[/<var>prefixlen</var>]
3039 [<var>module</var>:]<var>level</var> [<var>module</var>:<var>level</var>] ...
3041 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>unset</code></td></tr>
3042 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3043 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3044 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3045 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.5.0 and later</td></tr>
3047 <p><code class="directive">LogLevelOverride</code> adjusts the
3048 <code class="directive"><a href="#loglevel">LogLevel</a></code> for requests coming from
3049 certain client IP addresses.
3050 This allows to enable verbose logging only for certain test clients.
3051 The IP address is checked at a very early state in the connection
3052 processing. Therefore, <code class="directive">LogLevelOverride</code> allows to
3053 change the log level for things like the SSL handshake which happen before
3054 a <code class="directive"><a href="#loglevel">LogLevel</a></code> directive in an
3055 <code class="directive"><a href="#if"><If></a></code> container would
3058 <p><code class="directive">LogLevelOverride</code> accepts either a single
3059 IP-address or a CIDR IP-address/len subnet specification.
3060 For the syntax of the loglevel specification, see the
3061 <code class="directive"><a href="#loglevel">LogLevel</a></code> directive.</p>
3063 <p>For requests that match a <code class="directive">LogLevelOverride</code>
3064 directive, per-directory specifications of
3065 <code class="directive"><a href="#loglevel">LogLevel</a></code> are ignored.</p>
3069 <pre class="prettyprint lang-config"> LogLevelOverride 192.0.2.0/24 ssl:trace6
3070 LogLevelOverride 192.0.2.7 ssl:trace8</pre>
3074 <code class="directive">LogLevelOverride</code> only affects
3075 log messages that are associated with the request or the connection.
3076 Log messages which are associated with the server are not affected.
3082 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
3085 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3086 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
3087 <table class="directive">
3088 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
3089 connection</td></tr>
3090 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
3091 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
3092 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3093 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3094 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3096 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
3097 limits the number of requests allowed per connection when
3098 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
3099 set to <code>0</code>, unlimited requests will be allowed. We
3100 recommend that this setting be kept to a high value for maximum
3101 server performance.</p>
3105 <pre class="prettyprint lang-config">MaxKeepAliveRequests 500</pre>
3109 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3110 <div class="directive-section"><h2><a name="MaxRangeOverlaps" id="MaxRangeOverlaps">MaxRangeOverlaps</a> <a name="maxrangeoverlaps" id="maxrangeoverlaps">Directive</a></h2>
3111 <table class="directive">
3112 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of overlapping ranges (eg: <code>100-200,150-300</code>) allowed before returning the complete
3114 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRangeOverlaps default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
3115 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeOverlaps 20</code></td></tr>
3116 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3117 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3118 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3119 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3121 <p>The <code class="directive">MaxRangeOverlaps</code> directive
3122 limits the number of overlapping HTTP ranges the server is willing to
3123 return to the client. If more overlapping ranges than permitted are requested,
3124 the complete resource is returned instead.</p>
3127 <dt><strong>default</strong></dt>
3128 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3130 <dt><strong>none</strong></dt>
3131 <dd>No overlapping Range headers are allowed.</dd>
3133 <dt><strong>unlimited</strong></dt>
3134 <dd>The server does not limit the number of overlapping ranges it is
3135 willing to satisfy.</dd>
3137 <dt><var>number-of-ranges</var></dt>
3138 <dd>A positive number representing the maximum number of overlapping ranges the
3139 server is willing to satisfy.</dd>
3143 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3144 <div class="directive-section"><h2><a name="MaxRangeReversals" id="MaxRangeReversals">MaxRangeReversals</a> <a name="maxrangereversals" id="maxrangereversals">Directive</a></h2>
3145 <table class="directive">
3146 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of range reversals (eg: <code>100-200,50-70</code>) allowed before returning the complete
3148 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRangeReversals default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
3149 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeReversals 20</code></td></tr>
3150 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3151 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3152 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3153 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3155 <p>The <code class="directive">MaxRangeReversals</code> directive
3156 limits the number of HTTP Range reversals the server is willing to
3157 return to the client. If more ranges reversals than permitted are requested,
3158 the complete resource is returned instead.</p>
3161 <dt><strong>default</strong></dt>
3162 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3164 <dt><strong>none</strong></dt>
3165 <dd>No Range reversals headers are allowed.</dd>
3167 <dt><strong>unlimited</strong></dt>
3168 <dd>The server does not limit the number of range reversals it is
3169 willing to satisfy.</dd>
3171 <dt><var>number-of-ranges</var></dt>
3172 <dd>A positive number representing the maximum number of range reversals the
3173 server is willing to satisfy.</dd>
3177 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3178 <div class="directive-section"><h2><a name="MaxRanges" id="MaxRanges">MaxRanges</a> <a name="maxranges" id="maxranges">Directive</a></h2>
3179 <table class="directive">
3180 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of ranges allowed before returning the complete
3182 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRanges default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
3183 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRanges 200</code></td></tr>
3184 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3185 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3186 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3187 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3189 <p>The <code class="directive">MaxRanges</code> directive
3190 limits the number of HTTP ranges the server is willing to
3191 return to the client. If more ranges than permitted are requested,
3192 the complete resource is returned instead.</p>
3195 <dt><strong>default</strong></dt>
3196 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3198 <dt><strong>none</strong></dt>
3199 <dd>Range headers are ignored.</dd>
3201 <dt><strong>unlimited</strong></dt>
3202 <dd>The server does not limit the number of ranges it is
3203 willing to satisfy.</dd>
3205 <dt><var>number-of-ranges</var></dt>
3206 <dd>A positive number representing the maximum number of ranges the
3207 server is willing to satisfy.</dd>
3211 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3212 <div class="directive-section"><h2><a name="MergeTrailers" id="MergeTrailers">MergeTrailers</a> <a name="mergetrailers" id="mergetrailers">Directive</a></h2>
3213 <table class="directive">
3214 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether trailers are merged into headers</td></tr>
3215 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MergeTrailers [on|off]</code></td></tr>
3216 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MergeTrailers off</code></td></tr>
3217 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3218 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3219 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3220 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.4.11 and later</td></tr>
3222 <p>This directive controls whether HTTP trailers are copied into the
3223 internal representation of HTTP headers. This merging occurs when the
3224 request body has been completely consumed, long after most header
3225 processing would have a chance to examine or modify request headers.</p>
3226 <p>This option is provided for compatibility with releases prior to 2.4.11,
3227 where trailers were always merged.</p>
3230 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3231 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
3232 <table class="directive">
3233 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
3234 or specified mutexes</td></tr>
3235 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</code></td></tr>
3236 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
3237 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3240 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.4 and later</td></tr>
3242 <p>The <code class="directive">Mutex</code> directive sets the mechanism,
3243 and optionally the lock file location, that httpd and modules use
3244 to serialize access to resources. Specify <code>default</code> as
3245 the second argument to change the settings for all mutexes; specify
3246 a mutex name (see table below) as the second argument to override
3247 defaults only for that mutex.</p>
3249 <p>The <code class="directive">Mutex</code> directive is typically used in
3250 the following exceptional situations:</p>
3253 <li>change the mutex mechanism when the default mechanism selected
3254 by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
3257 <li>change the directory used by file-based mutexes when the
3258 default directory does not support locking</li>
3261 <div class="note"><h3>Supported modules</h3>
3262 <p>This directive only configures mutexes which have been registered
3263 with the core server using the <code>ap_mutex_register()</code> API.
3264 All modules bundled with httpd support the <code class="directive">Mutex</code>
3265 directive, but third-party modules may not. Consult the documentation
3266 of the third-party module, which must indicate the mutex name(s) which
3267 can be configured if this directive is supported.</p>
3270 <p>The following mutex <em>mechanisms</em> are available:</p>
3272 <li><code>default | yes</code>
3273 <p>This selects the default locking implementation, as determined by
3274 <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>. The default locking implementation can
3275 be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
3276 <code>-V</code> option.</p></li>
3278 <li><code>none | no</code>
3279 <p>This effectively disables the mutex, and is only allowed for a
3280 mutex if the module indicates that it is a valid choice. Consult the
3281 module documentation for more information.</p></li>
3283 <li><code>posixsem</code>
3284 <p>This is a mutex variant based on a Posix semaphore.</p>
3286 <div class="warning"><h3>Warning</h3>
3287 <p>The semaphore ownership is not recovered if a thread in the process
3288 holding the mutex segfaults, resulting in a hang of the web server.</p>
3292 <li><code>sysvsem</code>
3293 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3295 <div class="warning"><h3>Warning</h3>
3296 <p>It is possible to "leak" SysV semaphores if processes crash
3297 before the semaphore is removed.</p>
3300 <div class="warning"><h3>Security</h3>
3301 <p>The semaphore API allows for a denial of service attack by any
3302 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3303 all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
3304 or <code>cgiwrapper</code>).</p>
3308 <li><code>sem</code>
3309 <p>This selects the "best" available semaphore implementation, choosing
3310 between Posix and SystemV IPC semaphores, in that order.</p></li>
3312 <li><code>pthread</code>
3313 <p>This is a mutex variant based on cross-process Posix thread
3316 <div class="warning"><h3>Warning</h3>
3317 <p>On most systems, if a child process terminates abnormally while
3318 holding a mutex that uses this implementation, the server will deadlock
3319 and stop responding to requests. When this occurs, the server will
3320 require a manual restart to recover.</p>
3321 <p>Solaris is a notable exception as it provides a mechanism which
3322 usually allows the mutex to be recovered after a child process
3323 terminates abnormally while holding a mutex.</p>
3324 <p>If your system implements the
3325 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3326 to use the <code>pthread</code> option safely.</p>
3330 <li><code>fcntl:/path/to/mutex</code>
3331 <p>This is a mutex variant where a physical (lock-)file and the
3332 <code>fcntl()</code> function are used as the mutex.</p>
3334 <div class="warning"><h3>Warning</h3>
3335 <p>When multiple mutexes based on this mechanism are used within
3336 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3337 can be reported for valid mutex operations if <code>fcntl()</code>
3338 is not thread-aware, such as on Solaris.</p>
3342 <li><code>flock:/path/to/mutex</code>
3343 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3344 with the exception that the <code>flock()</code> function is used to
3345 provide file locking.</p></li>
3347 <li><code>file:/path/to/mutex</code>
3348 <p>This selects the "best" available file locking implementation,
3349 choosing between <code>fcntl</code> and <code>flock</code>, in that
3353 <p>Most mechanisms are only available on selected platforms, where the
3354 underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it. Mechanisms
3355 which aren't available on all platforms are <em>posixsem</em>,
3356 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3357 <em>flock</em>, and <em>file</em>.</p>
3359 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3360 the path, if provided, is a directory where the lock file will be created.
3361 The default directory is httpd's run-time file directory,
3362 <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>. If a relative
3363 path is provided, it is relative to
3364 <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>. Always use a local
3365 disk filesystem for <code>/path/to/mutex</code> and never a directory residing
3366 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3367 type, an optional instance string provided by the module, and unless the
3368 <code>OmitPID</code> keyword is specified, the process id of the httpd
3369 parent process will be appended to make the file name unique, avoiding
3370 conflicts when multiple httpd instances share a lock file directory. For
3371 example, if the mutex name is <code>mpm-accept</code> and the lock file
3372 directory is <code>/var/httpd/locks</code>, the lock file name for the
3373 httpd instance with parent process id 12345 would be
3374 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3376 <div class="warning"><h3>Security</h3>
3377 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3378 directory such as <code>/var/tmp</code> because someone could create
3379 a denial of service attack and prevent the server from starting by
3380 creating a lockfile with the same name as the one the server will try
3384 <p>The following table documents the names of mutexes used by httpd
3385 and bundled modules.</p>
3387 <table class="bordered"><tr class="header">
3390 <th>Protected resource</th>
3393 <td><code>mpm-accept</code></td>
3394 <td><code class="module"><a href="../mod/prefork.html">prefork</a></code> and <code class="module"><a href="../mod/worker.html">worker</a></code> MPMs</td>
3395 <td>incoming connections, to avoid the thundering herd problem;
3396 for more information, refer to the
3397 <a href="../misc/perf-tuning.html">performance tuning</a>
3401 <td><code>authdigest-client</code></td>
3402 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3403 <td>client list in shared memory</td>
3406 <td><code>authdigest-opaque</code></td>
3407 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3408 <td>counter in shared memory</td>
3411 <td><code>ldap-cache</code></td>
3412 <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
3413 <td>LDAP result cache</td>
3416 <td><code>rewrite-map</code></td>
3417 <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
3418 <td>communication with external mapping programs, to avoid
3419 intermixed I/O from multiple requests</td>
3422 <td><code>ssl-cache</code></td>
3423 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3424 <td>SSL session cache</td>
3427 <td><code>ssl-stapling</code></td>
3428 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3429 <td>OCSP stapling response cache</td>
3432 <td><code>watchdog-callback</code></td>
3433 <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
3434 <td>callback function of a particular client module</td>
3438 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3439 parent process id from the lock file name.</p>
3441 <p>In the following example, the mutex mechanism for the MPM accept
3442 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3443 with the associated lock file created in directory
3444 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3445 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3447 <pre class="prettyprint lang-config">Mutex sysvsem default
3448 Mutex fcntl:/var/httpd/locks mpm-accept</pre>
3452 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3453 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
3454 <table class="directive">
3455 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>DEPRECATED: Designates an IP address for name-virtual
3457 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
3458 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3459 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3460 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3463 <p>Prior to 2.3.11, <code class="directive">NameVirtualHost</code> was required
3464 to instruct the server that a particular IP address and port combination
3465 was usable as a name-based virtual host. In 2.3.11 and later,
3466 any time an IP address and port combination is used in multiple virtual
3467 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3469 <p>This directive currently has no effect.</p>
3473 <li><a href="../vhosts/">Virtual Hosts
3474 documentation</a></li>
3477 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3478 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
3479 <table class="directive">
3480 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
3482 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
3483 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
3484 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options FollowSymlinks</code></td></tr>
3485 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3486 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
3487 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3488 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3489 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default was changed from All to FollowSymlinks in 2.3.11</td></tr>
3491 <p>The <code class="directive">Options</code> directive controls which
3492 server features are available in a particular directory.</p>
3494 <p><var>option</var> can be set to <code>None</code>, in which
3495 case none of the extra features are enabled, or one or more of
3499 <dt><code>All</code></dt>
3501 <dd>All options except for <code>MultiViews</code>.</dd>
3503 <dt><code>ExecCGI</code></dt>
3506 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
3509 <dt><code>FollowSymLinks</code></dt>
3512 The server will follow symbolic links in this directory. This is
3513 the default setting.
3515 <p>Even though the server follows the symlink it does <em>not</em>
3516 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
3518 <p>The <code>FollowSymLinks</code> and
3519 <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory"><Directory></a></code> sections or
3520 <code>.htaccess</code> files.</p>
3522 <p>Omitting this option should not be considered a security restriction,
3523 since symlink testing is subject to race conditions that make it
3527 <dt><code>Includes</code></dt>
3530 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
3533 <dt><code>IncludesNOEXEC</code></dt>
3537 Server-side includes are permitted, but the <code>#exec
3538 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3539 possible to <code>#include virtual</code> CGI scripts from
3540 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
3543 <dt><code>Indexes</code></dt>
3546 If a URL which maps to a directory is requested and there
3547 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
3548 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3549 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
3550 of the directory.</dd>
3552 <dt><code>MultiViews</code></dt>
3555 <a href="../content-negotiation.html">Content negotiated</a>
3556 "MultiViews" are allowed using
3557 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.
3558 <div class="note"><h3>Note</h3> <p>This option gets ignored if set
3559 anywhere other than <code class="directive"><a href="#directory"><Directory></a></code>, as <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>
3560 needs real resources to compare against and evaluate from.</p></div>
3563 <dt><code>SymLinksIfOwnerMatch</code></dt>
3565 <dd>The server will only follow symbolic links for which the
3566 target file or directory is owned by the same user id as the
3569 <div class="note"><h3>Note</h3>
3570 <p>The <code>FollowSymLinks</code> and
3571 <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory"><Directory></a></code> sections or
3572 <code>.htaccess</code> files.</p>
3574 <p>This option should not be considered a security restriction,
3575 since symlink testing is subject to race conditions that make it
3580 <p>Normally, if multiple <code class="directive">Options</code> could
3581 apply to a directory, then the most specific one is used and
3582 others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
3583 However if <em>all</em> the options on the
3584 <code class="directive">Options</code> directive are preceded by a
3585 <code>+</code> or <code>-</code> symbol, the options are
3586 merged. Any options preceded by a <code>+</code> are added to the
3587 options currently in force, and any options preceded by a
3588 <code>-</code> are removed from the options currently in
3591 <div class="note"><h3>Note</h3>
3592 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
3593 <code>-</code> with those without is not valid syntax and will be
3594 rejected during server startup by the syntax check with an abort.</p>
3597 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3599 <pre class="prettyprint lang-config"><Directory "/web/docs">
3600 Options Indexes FollowSymLinks
3603 <Directory "/web/docs/spec">
3605 </Directory></pre>
3608 <p>then only <code>Includes</code> will be set for the
3609 <code>/web/docs/spec</code> directory. However if the second
3610 <code class="directive">Options</code> directive uses the <code>+</code> and
3611 <code>-</code> symbols:</p>
3613 <pre class="prettyprint lang-config"><Directory "/web/docs">
3614 Options Indexes FollowSymLinks
3617 <Directory "/web/docs/spec">
3618 Options +Includes -Indexes
3619 </Directory></pre>
3622 <p>then the options <code>FollowSymLinks</code> and
3623 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3626 <div class="note"><h3>Note</h3>
3627 <p>Using <code>-IncludesNOEXEC</code> or
3628 <code>-Includes</code> disables server-side includes completely
3629 regardless of the previous setting.</p>
3632 <p>The default in the absence of any other settings is
3633 <code>FollowSymlinks</code>.</p>
3636 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3637 <div class="directive-section"><h2><a name="Protocol" id="Protocol">Protocol</a> <a name="protocol" id="protocol">Directive</a></h2>
3638 <table class="directive">
3639 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocol for a listening socket</td></tr>
3640 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocol <var>protocol</var></code></td></tr>
3641 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3643 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3644 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>On Windows, only available from Apache 2.3.3 and later.</td></tr>
3646 <p>This directive specifies the protocol used for a specific listening socket.
3647 The protocol is used to determine which module should handle a request and
3648 to apply protocol specific optimizations with the <code class="directive">AcceptFilter</code>
3651 <p>You only need to set the protocol if you are running on non-standard ports;
3652 otherwise, <code>http</code> is assumed for port 80 and <code>https</code>
3655 <p>For example, if you are running <code>https</code> on a non-standard port,
3656 specify the protocol explicitly:</p>
3658 <pre class="prettyprint lang-config">Protocol https</pre>
3661 <p>You can also specify the protocol using the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive.</p>
3665 <li><code class="directive"><a href="#acceptfilter">AcceptFilter</a></code></li>
3666 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3669 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3670 <div class="directive-section"><h2><a name="Protocols" id="Protocols">Protocols</a> <a name="protocols" id="protocols">Directive</a></h2>
3671 <table class="directive">
3672 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocols available for a server/virtual host</td></tr>
3673 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocols <var>protocol</var> ...</code></td></tr>
3674 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3675 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3676 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3677 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only available from Apache 2.4.17 and later.</td></tr>
3679 <p>This directive specifies the list of protocols supported for a
3680 server/virtual host. The list determines the allowed protocols
3681 a client may negotiate for this server/host.</p>
3683 <p>You only need to set protocols if you want to limit the available
3684 protocols for a server/host. By default, all supported protocols
3685 are available to a client.</p>
3687 <p>For example, if you want to support only HTTP/1.1 for a server, even
3688 though HTTP/2 is available, just specify this protocol only:</p>
3690 <pre class="prettyprint lang-config">Protocols http/1.1</pre>
3693 <p>Valid protocols are <code>http/1.1</code> for http and https connections,
3694 <code>h2</code> on https connections and <code>h2c</code> for http
3695 connections. Modules may enable more protocols.</p>
3697 <p>It is safe to specify protocols that are unavailable/disabled. Such
3698 protocol names will simply be ignored.</p>
3700 <p>Protocols specified in base servers are inherited for virtual hosts
3701 only if the virtual host has no own Protocols directive. Or, the other
3702 way around, Protocols directives in virtual hosts replace any
3703 such directive in the base server.
3709 <li><code class="directive"><a href="#protocolshonororder">ProtocolsHonorOrder</a></code></li>
3712 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3713 <div class="directive-section"><h2><a name="ProtocolsHonorOrder" id="ProtocolsHonorOrder">ProtocolsHonorOrder</a> <a name="protocolshonororder" id="protocolshonororder">Directive</a></h2>
3714 <table class="directive">
3715 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocols available for a server/virtual host</td></tr>
3716 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProtocolsHonorOrder On|Off</code></td></tr>
3717 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProtocolsHonorOrder Off</code></td></tr>
3718 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3719 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3720 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3721 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only available from Apache 2.4.17 and later.</td></tr>
3723 <p>This directive specifies if the server should honor the order in which
3724 the <code class="directive">Protocols</code> directive lists protocols.</p>
3726 <p>By default, a client supplies a list of supported protocols and the server
3727 selects an available one from that list in the given order.</p>
3729 <p>With <code class="directive">ProtocolsHonorOrder</code> set to <code>on</code>, the
3730 client ordering does not matter and only the ordering in the server
3731 settings influences the outcome of the protocol negotiation.</p>
3736 <li><code class="directive"><a href="#protocols">Protocols</a></code></li>
3739 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3740 <div class="directive-section"><h2><a name="RegisterHttpMethod" id="RegisterHttpMethod">RegisterHttpMethod</a> <a name="registerhttpmethod" id="registerhttpmethod">Directive</a></h2>
3741 <table class="directive">
3742 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Register non-standard HTTP methods</td></tr>
3743 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RegisterHttpMethod <var>method</var> [<var>method</var> [...]]</code></td></tr>
3744 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3745 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3746 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3748 <p>HTTP Methods that are not conforming to the relvant RFCs are normally
3749 rejected by request processing in Apache HTTPD. To avoid this, modules
3750 can register non-standard HTTP methods they support.
3751 The <code class="directive">RegisterHttpMethod</code> allows to register such
3752 methods manually. This can be useful if such methods are forwarded
3753 for external processing, e.g. to a CGI script.</p>
3756 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3757 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
3758 <table class="directive">
3759 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
3760 by Apache httpd children</td></tr>
3761 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</code></td></tr>
3762 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3763 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3764 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3765 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3766 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3768 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3769 resource limit for all processes and the second parameter sets
3770 the maximum resource limit. Either parameter can be a number,
3771 or <code>max</code> to indicate to the server that the limit should
3772 be set to the maximum allowed by the operating system
3773 configuration. Raising the maximum resource limit requires that
3774 the server is running as <code>root</code> or in the initial startup
3777 <p>This applies to processes forked from Apache httpd children
3778 servicing requests, not the Apache httpd children themselves. This
3779 includes CGI scripts and SSI exec commands, but not any
3780 processes forked from the Apache httpd parent, such as piped
3783 <p>CPU resource limits are expressed in seconds per
3788 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3789 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3792 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3793 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
3794 <table class="directive">
3795 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
3796 by Apache httpd children</td></tr>
3797 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</code></td></tr>
3798 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3799 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3800 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3801 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3802 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3804 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3805 resource limit for all processes and the second parameter sets
3806 the maximum resource limit. Either parameter can be a number,
3807 or <code>max</code> to indicate to the server that the limit should
3808 be set to the maximum allowed by the operating system
3809 configuration. Raising the maximum resource limit requires that
3810 the server is running as <code>root</code> or in the initial startup
3813 <p>This applies to processes forked from Apache httpd children
3814 servicing requests, not the Apache httpd children themselves. This
3815 includes CGI scripts and SSI exec commands, but not any
3816 processes forked from the Apache httpd parent, such as piped
3819 <p>Memory resource limits are expressed in bytes per
3824 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3825 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3828 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3829 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
3830 <table class="directive">
3831 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
3832 processes launched by Apache httpd children</td></tr>
3833 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</code></td></tr>
3834 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3835 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3836 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3837 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3838 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3840 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3841 resource limit for all processes, and the second parameter sets
3842 the maximum resource limit. Either parameter can be a number,
3843 or <code>max</code> to indicate to the server that the limit
3844 should be set to the maximum allowed by the operating system
3845 configuration. Raising the maximum resource limit requires that
3846 the server is running as <code>root</code> or in the initial startup
3849 <p>This applies to processes forked from Apache httpd children
3850 servicing requests, not the Apache httpd children themselves. This
3851 includes CGI scripts and SSI exec commands, but not any
3852 processes forked from the Apache httpd parent, such as piped
3855 <p>Process limits control the number of processes per user.</p>
3857 <div class="note"><h3>Note</h3>
3858 <p>If CGI processes are <strong>not</strong> running
3859 under user ids other than the web server user id, this directive
3860 will limit the number of processes that the server itself can
3861 create. Evidence of this situation will be indicated by
3862 <strong><code>cannot fork</code></strong> messages in the
3863 <code>error_log</code>.</p>
3868 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3869 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3872 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3873 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
3874 <table class="directive">
3875 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
3877 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
3878 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
3879 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3880 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3881 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3882 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3883 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only.</td></tr>
3885 <p>This directive is used to control how Apache httpd finds the
3886 interpreter used to run CGI scripts. The default setting is
3887 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3888 by the shebang line (first line, starting with <code>#!</code>) in the
3889 script. On Win32 systems this line usually looks like:</p>
3891 <pre class="prettyprint lang-perl">#!C:/Perl/bin/perl.exe</pre>
3894 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3896 <pre class="prettyprint lang-perl">#!perl</pre>
3899 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3900 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3901 searched using the script file extension (e.g., <code>.pl</code>) as a
3902 search key. The command defined by the registry subkey
3903 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3904 <code>Shell\Open\Command</code> is used to open the script file. If the
3905 registry keys cannot be found, Apache httpd falls back to the behavior of the
3906 <code>Script</code> option.</p>
3908 <div class="warning"><h3>Security</h3>
3909 <p>Be careful when using <code>ScriptInterpreterSource
3910 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
3911 Apache httpd will try to execute <strong>every</strong> file within this
3912 directory. The <code>Registry</code> setting may cause undesired
3913 program calls on files which are typically not executed. For
3914 example, the default open command on <code>.htm</code> files on
3915 most Windows systems will execute Microsoft Internet Explorer, so
3916 any HTTP request for an <code>.htm</code> file existing within the
3917 script directory would start the browser in the background on the
3918 server. This is a good way to crash your system within a minute or
3922 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3923 2.0 does the same thing as <code>Registry</code> but uses only the
3924 subkey <code>Shell\ExecCGI\Command</code>. The
3925 <code>ExecCGI</code> key is not a common one. It must be
3926 configured manually in the windows registry and hence prevents
3927 accidental program calls on your system.</p>
3930 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3931 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
3932 <table class="directive">
3933 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
3934 of a request or the last 63, assuming the request itself is greater than
3936 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
3937 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
3938 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3939 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3940 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3942 <p>mod_status with <code>ExtendedStatus On</code>
3943 displays the actual request being handled.
3944 For historical purposes, only 63 characters of the request
3945 are actually stored for display purposes. This directive
3946 controls whether the 1st 63 characters are stored (the previous
3947 behavior and the default) or if the last 63 characters are. This
3948 is only applicable, of course, if the length of the request is
3949 64 characters or greater.</p>
3951 <p>If Apache httpd is handling <code>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code> mod_status displays as follows:
3954 <table class="bordered">
3956 <th>Off (default)</th>
3957 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3961 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3967 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3968 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
3969 <table class="directive">
3970 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
3971 messages sent to the client</td></tr>
3972 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
3973 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3974 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3975 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3977 <p>The <code class="directive">ServerAdmin</code> sets the contact address
3978 that the server includes in any error messages it returns to the
3979 client. If the <code>httpd</code> doesn't recognize the supplied argument
3981 assumes, that it's an <var>email-address</var> and prepends it with
3982 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3983 actually use an email address, since there are a lot of CGI scripts that
3984 make that assumption. If you want to use an URL, it should point to another
3985 server under your control. Otherwise users may not be able to contact you in
3988 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3990 <pre class="prettyprint lang-config">ServerAdmin www-admin@foo.example.com</pre>
3992 <p>as users do not always mention that they are talking about the
3996 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3997 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
3998 <table class="directive">
3999 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
4000 to name-virtual hosts</td></tr>
4001 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
4002 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
4003 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4004 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4006 <p>The <code class="directive">ServerAlias</code> directive sets the
4007 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
4008 <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
4010 <pre class="prettyprint lang-config"><VirtualHost *:80>
4011 ServerName server.example.com
4012 ServerAlias server server2.example.com server2
4013 ServerAlias *.example.com
4014 UseCanonicalName Off
4016 </VirtualHost></pre>
4019 <p>Name-based virtual hosts for the best-matching set of <code class="directive"><a href="#virtualhost"><virtualhost></a></code>s are processed
4020 in the order they appear in the configuration. The first matching <code class="directive"><a href="#servername">ServerName</a></code> or <code class="directive"><a href="#serveralias">ServerAlias</a></code> is used, with no different precedence for wildcards
4021 (nor for ServerName vs. ServerAlias). </p>
4023 <p>The complete list of names in the <code class="directive">VirtualHost</code>
4024 directive are treated just like a (non wildcard)
4025 <code class="directive">ServerAlias</code>.</p>
4030 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4031 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4034 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4035 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
4036 <table class="directive">
4037 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
4039 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</code></td></tr>
4040 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4041 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4042 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4044 <p>The <code class="directive">ServerName</code> directive sets the
4045 request scheme, hostname and
4046 port that the server uses to identify itself. This is used when
4047 creating redirection URLs.</p>
4049 <p>Additionally, <code class="directive">ServerName</code> is used (possibly
4050 in conjunction with <code class="directive">ServerAlias</code>) to uniquely
4051 identify a virtual host, when using <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
4053 <p>For example, if the name of the
4054 machine hosting the web server is <code>simple.example.com</code>,
4055 but the machine also has the DNS alias <code>www.example.com</code>
4056 and you wish the web server to be so identified, the following
4057 directive should be used:</p>
4059 <pre class="prettyprint lang-config">ServerName www.example.com</pre>
4062 <p>The <code class="directive">ServerName</code> directive
4063 may appear anywhere within the definition of a server. However,
4064 each appearance overrides the previous appearance (within that
4067 <p>If no <code class="directive">ServerName</code> is specified, then the
4068 server attempts to deduce the client visible hostname by performing a
4069 reverse lookup on an IP address of the systems hostname.</p>
4071 <p>If no port is specified in the
4072 <code class="directive">ServerName</code>, then the server will use the
4073 port from the incoming request. For optimal reliability and
4074 predictability, you should specify an explicit hostname and port
4075 using the <code class="directive">ServerName</code> directive.</p>
4077 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
4078 the <code class="directive">ServerName</code> inside a
4079 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
4080 section specifies what hostname must appear in the request's
4081 <code>Host:</code> header to match this virtual host.</p>
4083 <p>Sometimes, the server runs behind a device that processes SSL,
4084 such as a reverse proxy, load balancer or SSL offload
4085 appliance. When this is the case, specify the
4086 <code>https://</code> scheme and the port number to which the
4087 clients connect in the <code class="directive">ServerName</code> directive
4088 to make sure that the server generates the correct
4089 self-referential URLs.
4092 <p>See the description of the
4093 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
4094 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
4095 settings which determine whether self-referential URLs (e.g., by the
4096 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
4097 specified port, or to the port number given in the client's request.
4100 <div class="warning">
4101 <p>Failure to set <code class="directive">ServerName</code> to a name that
4102 your server can resolve to an IP address will result in a startup
4103 warning. <code>httpd</code> will then use whatever hostname it can
4104 determine, using the system's <code>hostname</code> command. This
4105 will almost never be the hostname you actually want.</p>
4106 <div class="example"><p><code>
4107 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
4114 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4115 Apache HTTP Server</a></li>
4116 <li><a href="../vhosts/">Apache HTTP Server virtual host
4117 documentation</a></li>
4118 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4119 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4120 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
4123 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4124 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
4125 <table class="directive">
4126 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
4127 is accessed by an incompatible browser</td></tr>
4128 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
4129 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
4130 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4131 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4133 <p>The <code class="directive">ServerPath</code> directive sets the legacy
4134 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
4138 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4141 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4142 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
4143 <table class="directive">
4144 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
4145 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
4146 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
4147 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4148 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4149 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4151 <p>The <code class="directive">ServerRoot</code> directive sets the
4152 directory in which the server lives. Typically it will contain the
4153 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
4154 paths in other configuration directives (such as <code class="directive"><a href="#include">Include</a></code> or <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>, for example) are taken as
4155 relative to this directory.</p>
4157 <pre class="prettyprint lang-config">ServerRoot "/home/httpd"</pre>
4160 <p>The default location of <code class="directive">ServerRoot</code> may be
4161 modified by using the <code>--prefix</code> argument to
4162 <a href="../programs/configure.html"><code>configure</code></a>, and
4163 most third-party distributions of the server have a different
4164 default location from the one listed above.</p>
4169 <li><a href="../invoking.html">the <code>-d</code>
4170 option to <code>httpd</code></a></li>
4171 <li><a href="../misc/security_tips.html#serverroot">the
4172 security tips</a> for information on how to properly set
4173 permissions on the <code class="directive">ServerRoot</code></li>
4176 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4177 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
4178 <table class="directive">
4179 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
4180 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
4181 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
4182 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4183 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4184 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4185 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4187 <p>The <code class="directive">ServerSignature</code> directive allows the
4188 configuration of a trailing footer line under server-generated
4189 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
4190 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
4191 would want to enable such a footer line is that in a chain of proxies,
4192 the user often has no possibility to tell which of the chained servers
4193 actually produced a returned error message.</p>
4195 <p>The <code>Off</code>
4196 setting, which is the default, suppresses the footer line (and is
4197 therefore compatible with the behavior of Apache-1.2 and
4198 below). The <code>On</code> setting simply adds a line with the
4199 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
4200 and the <code>EMail</code> setting additionally creates a
4201 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
4204 <p>After version 2.0.44, the details of the server version number
4205 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
4209 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
4212 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4213 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
4214 <table class="directive">
4215 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
4217 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</code></td></tr>
4218 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
4219 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4220 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4221 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4223 <p>This directive controls whether <code>Server</code> response
4224 header field which is sent back to clients includes a
4225 description of the generic OS-type of the server as well as
4226 information about compiled-in modules.</p>
4229 <dt><code>ServerTokens Full</code> (or not specified)</dt>
4231 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4232 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4234 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4236 <dd>Server sends (<em>e.g.</em>): <code>Server:
4239 <dt><code>ServerTokens Major</code></dt>
4241 <dd>Server sends (<em>e.g.</em>): <code>Server:
4242 Apache/2</code></dd>
4244 <dt><code>ServerTokens Minor</code></dt>
4246 <dd>Server sends (<em>e.g.</em>): <code>Server:
4247 Apache/2.4</code></dd>
4249 <dt><code>ServerTokens Min[imal]</code></dt>
4251 <dd>Server sends (<em>e.g.</em>): <code>Server:
4252 Apache/2.4.2</code></dd>
4254 <dt><code>ServerTokens OS</code></dt>
4256 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4261 <p>This setting applies to the entire server, and cannot be
4262 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4264 <p>After version 2.0.44, this directive also controls the
4265 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
4267 <div class="note">Setting <code class="directive">ServerTokens</code> to less than
4268 <code>minimal</code> is not recommended because it makes it more
4269 difficult to debug interoperational problems. Also note that
4270 disabling the Server: header does nothing at all to make your
4271 server more secure. The idea of "security through obscurity"
4272 is a myth and leads to a false sense of safety.</div>
4276 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
4279 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4280 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
4281 <table class="directive">
4282 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
4284 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
4285 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4286 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4287 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4288 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4290 <p>When placed into an <code>.htaccess</code> file or a
4291 <code class="directive"><a href="#directory"><Directory></a></code> or
4292 <code class="directive"><a href="#location"><Location></a></code>
4293 section, this directive forces all matching files to be parsed
4294 through the <a href="../handler.html">handler</a> given by
4295 <var>handler-name</var>. For example, if you had a directory you
4296 wanted to be parsed entirely as imagemap rule files, regardless
4297 of extension, you might put the following into an
4298 <code>.htaccess</code> file in that directory:</p>
4300 <pre class="prettyprint lang-config">SetHandler imap-file</pre>
4303 <p>Another example: if you wanted to have the server display a
4304 status report whenever a URL of
4305 <code>http://servername/status</code> was called, you might put
4306 the following into <code>httpd.conf</code>:</p>
4308 <pre class="prettyprint lang-config"><Location "/status">
4309 SetHandler server-status
4310 </Location></pre>
4313 <p>You could also use this directive to configure a particular
4314 handler for files with a particular file extension. For example:</p>
4316 <pre class="prettyprint lang-config"><FilesMatch "\.php$">
4317 SetHandler application/x-httpd-php
4318 </FilesMatch></pre>
4321 <p>You can override an earlier defined <code class="directive">SetHandler</code>
4322 directive by using the value <code>None</code>.</p>
4324 <div class="note"><h3>Note</h3>
4325 <p>Because <code class="directive">SetHandler</code> overrides default handlers,
4326 normal behavior such as handling of URLs ending in a slash (/) as
4327 directories or index files is suppressed.</p></div>
4331 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
4334 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4335 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
4336 <table class="directive">
4337 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
4339 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4340 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4341 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4342 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4343 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4345 <p>The <code class="directive">SetInputFilter</code> directive sets the
4346 filter or filters which will process client requests and POST
4347 input when they are received by the server. This is in addition to
4348 any filters defined elsewhere, including the
4349 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
4352 <p>If more than one filter is specified, they must be separated
4353 by semicolons in the order in which they should process the
4358 <li><a href="../filter.html">Filters</a> documentation</li>
4361 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4362 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
4363 <table class="directive">
4364 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
4366 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4367 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4368 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4369 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4370 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4372 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
4373 which will process responses from the server before they are
4374 sent to the client. This is in addition to any filters defined
4375 elsewhere, including the
4376 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
4379 <p>For example, the following configuration will process all files
4380 in the <code>/www/data/</code> directory for server-side
4383 <pre class="prettyprint lang-config"><Directory "/www/data/">
4384 SetOutputFilter INCLUDES
4385 </Directory></pre>
4388 <p>If more than one filter is specified, they must be separated
4389 by semicolons in the order in which they should process the
4394 <li><a href="../filter.html">Filters</a> documentation</li>
4397 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4398 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
4399 <table class="directive">
4400 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
4401 certain events before failing a request</td></tr>
4402 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
4403 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 60</code></td></tr>
4404 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4405 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4406 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4408 <p>The <code class="directive">TimeOut</code> directive defines the length
4409 of time Apache httpd will wait for I/O in various circumstances:</p>
4412 <li>When reading data from the client, the length of time to
4413 wait for a TCP packet to arrive if the read buffer is
4416 <li>When writing data to the client, the length of time to wait
4417 for an acknowledgement of a packet if the send buffer is
4420 <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code> and <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code>,
4421 the length of time to wait for output from a CGI script.</li>
4423 <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
4424 wait for output from a filtering process.</li>
4426 <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
4427 <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
4433 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4434 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
4435 <table class="directive">
4436 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behavior on <code>TRACE</code> requests</td></tr>
4437 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
4438 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
4439 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4440 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4441 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4443 <p>This directive overrides the behavior of <code>TRACE</code> for both
4444 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
4445 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4446 RFC 2616, which disallows any request body to accompany the request.
4447 <code>TraceEnable off</code> causes the core server and
4448 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
4449 allowed) error to the client.</p>
4451 <p>Finally, for testing and diagnostic purposes only, request
4452 bodies may be allowed using the non-compliant <code>TraceEnable
4453 extended</code> directive. The core (as an origin server) will
4454 restrict the request body to 64k (plus 8k for chunk headers if
4455 <code>Transfer-Encoding: chunked</code> is used). The core will
4456 reflect the full headers and all chunk headers with the response
4457 body. As a proxy server, the request body is not restricted to 64k.</p>
4459 <div class="note"><h3>Note</h3>
4460 <p>Despite claims to the contrary, <code>TRACE</code> is not
4461 a security vulnerability, and there is no viable reason for
4462 it to be disabled. Doing so necessarily makes your server
4467 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4468 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
4469 <table class="directive">
4470 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
4471 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
4472 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4473 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4474 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4476 <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
4477 of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
4478 <p>This directive can be used to toggle the use of <code class="directive"><a href="#ifdefine"><IfDefine></a></code> sections without needing to alter
4479 <code>-D</code> arguments in any startup scripts.</p>
4480 <p>While this directive is supported in virtual host context,
4481 the changes it makes are visible to any later configuration
4482 directives, beyond any enclosing virtual host.</p>
4485 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4486 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
4487 <table class="directive">
4488 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
4490 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
4491 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
4492 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4493 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4494 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4496 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4497 URL -- that is, a URL that refers back to the same server. With
4498 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4499 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
4500 directive to construct the canonical name for the server. This name
4501 is used in all self-referential URLs, and for the values of
4502 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4504 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4505 self-referential URLs using the hostname and port supplied by
4506 the client if any are supplied (otherwise it will use the
4507 canonical name, as defined above). These values are the same
4508 that are used to implement <a href="../vhosts/name-based.html">name-based virtual hosts</a>
4509 and are available with the same clients. The CGI variables
4510 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4511 constructed from the client supplied values as well.</p>
4513 <p>An example where this may be useful is on an intranet server
4514 where you have users connecting to the machine using short
4515 names such as <code>www</code>. You'll notice that if the users
4516 type a shortname and a URL which is a directory, such as
4517 <code>http://www/splat</code>, <em>without the trailing
4518 slash</em>, then Apache httpd will redirect them to
4519 <code>http://www.example.com/splat/</code>. If you have
4520 authentication enabled, this will cause the user to have to
4521 authenticate twice (once for <code>www</code> and once again
4522 for <code>www.example.com</code> -- see <a href="http://wiki.apache.org/httpd/FAQ#Why_does_Apache_ask_for_my_password_twice_before_serving_a_file.3F">
4523 the FAQ on this subject for more information</a>). But if
4524 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
4525 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4527 <p>There is a third option, <code>UseCanonicalName DNS</code>,
4528 which is intended for use with mass IP-based virtual hosting to
4529 support ancient clients that do not provide a
4530 <code>Host:</code> header. With this option, Apache httpd does a
4531 reverse DNS lookup on the server IP address that the client
4532 connected to in order to work out self-referential URLs.</p>
4534 <div class="warning"><h3>Warning</h3>
4535 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>,
4536 they may be broken by this option. The client is essentially free
4537 to give whatever value they want as a hostname. But if the CGI is
4538 only using <code>SERVER_NAME</code> to construct self-referential URLs,
4539 then it should be just fine.</p>
4544 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4545 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4546 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4549 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4550 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
4551 <table class="directive">
4552 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own port</td></tr>
4553 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
4554 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
4555 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4556 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4557 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4559 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4560 URL -- that is, a URL that refers back to the same server. With
4561 <code>UseCanonicalPhysicalPort On</code>, Apache httpd will, when
4562 constructing the canonical port for the server to honor
4563 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
4564 provide the actual physical port number being used by this request
4565 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>,
4566 Apache httpd will not ever use the actual physical port number, instead
4567 relying on all configured information to construct a valid port number.</p>
4569 <div class="note"><h3>Note</h3>
4570 <p>The ordering of the lookup when the physical port is used is as
4573 <dt><code>UseCanonicalName On</code></dt>
4576 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4577 <li>Physical port</li>
4578 <li>Default port</li>
4581 <dt><code>UseCanonicalName Off | DNS</code></dt>
4584 <li>Parsed port from <code>Host:</code> header</li>
4585 <li>Physical port</li>
4586 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4587 <li>Default port</li>
4592 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4593 physical ports are removed from the ordering.</p>
4599 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4600 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4601 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4604 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4605 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
4606 <table class="directive">
4607 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
4608 hostname or IP address</td></tr>
4609 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
4610 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4611 ...> ... </VirtualHost></code></td></tr>
4612 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4613 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4614 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4616 <p><code class="directive"><VirtualHost></code> and
4617 <code></VirtualHost></code> are used to enclose a group of
4618 directives that will apply only to a particular virtual host. Any
4619 directive that is allowed in a virtual host context may be
4620 used. When the server receives a request for a document on a
4621 particular virtual host, it uses the configuration directives
4622 enclosed in the <code class="directive"><VirtualHost></code>
4623 section. <var>Addr</var> can be any of the following, optionally followed by
4624 a colon and a port number (or *):</p>
4627 <li>The IP address of the virtual host;</li>
4629 <li>A fully qualified domain name for the IP address of the
4630 virtual host (not recommended);</li>
4632 <li>The character <code>*</code>, which acts as a wildcard and matches
4633 any IP address.</li>
4635 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4639 <pre class="prettyprint lang-config"><VirtualHost 10.1.2.3:80>
4640 ServerAdmin webmaster@host.example.com
4641 DocumentRoot "/www/docs/host.example.com"
4642 ServerName host.example.com
4643 ErrorLog "logs/host.example.com-error_log"
4644 TransferLog "logs/host.example.com-access_log"
4645 </VirtualHost></pre>
4649 <p>IPv6 addresses must be specified in square brackets because
4650 the optional port number could not be determined otherwise. An
4651 IPv6 example is shown below:</p>
4653 <pre class="prettyprint lang-config"><VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
4654 ServerAdmin webmaster@host.example.com
4655 DocumentRoot "/www/docs/host.example.com"
4656 ServerName host.example.com
4657 ErrorLog "logs/host.example.com-error_log"
4658 TransferLog "logs/host.example.com-access_log"
4659 </VirtualHost></pre>
4662 <p>Each Virtual Host must correspond to a different IP address,
4663 different port number, or a different host name for the server,
4664 in the former case the server machine must be configured to
4665 accept IP packets for multiple addresses. (If the machine does
4666 not have multiple network interfaces, then this can be
4667 accomplished with the <code>ifconfig alias</code> command -- if
4668 your OS supports it).</p>
4670 <div class="note"><h3>Note</h3>
4671 <p>The use of <code class="directive"><VirtualHost></code> does
4672 <strong>not</strong> affect what addresses Apache httpd listens on. You
4673 may need to ensure that Apache httpd is listening on the correct addresses
4674 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
4677 <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
4678 specified inside each <code class="directive"><VirtualHost></code> block. If it is absent, the
4679 <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
4680 server configuration will be inherited.</p>
4682 <p>When a request is received, the server first maps it to the best matching
4683 <code class="directive"><VirtualHost></code> based on the local
4684 IP address and port combination only. Non-wildcards have a higher
4685 precedence. If no match based on IP and port occurs at all, the
4686 "main" server configuration is used.</p>
4688 <p>If multiple virtual hosts contain the best matching IP address and port,
4689 the server selects from these virtual hosts the best match based on the
4690 requested hostname. If no matching name-based virtual host is found,
4691 then the first listed virtual host that matched the IP address will be
4692 used. As a consequence, the first listed virtual host for a given IP address
4693 and port combination is the default virtual host for that IP and port
4696 <div class="warning"><h3>Security</h3>
4697 <p>See the <a href="../misc/security_tips.html">security tips</a>
4698 document for details on why your security could be compromised if the
4699 directory where log files are stored is writable by anyone other
4700 than the user that starts the server.</p>
4705 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4706 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4707 Apache HTTP Server</a></li>
4708 <li><a href="../bind.html">Setting
4709 which addresses and ports Apache HTTP Server uses</a></li>
4710 <li><a href="../sections.html">How <Directory>, <Location>
4711 and <Files> sections work</a> for an explanation of how these
4712 different sections are combined when a request is received</li>
4715 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4716 <div class="directive-section"><h2><a name="Warning" id="Warning">Warning</a> <a name="warning" id="warning">Directive</a></h2>
4717 <table class="directive">
4718 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Warn from configuration parsing with a custom message</td></tr>
4719 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Warning <var>message</var></code></td></tr>
4720 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4721 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4722 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4723 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5 and later</td></tr>
4725 <p>If an issue can be detected from within the configuration, this
4726 directive can be used to generate a custom warning message. The
4727 configuration parsing is not halted. The typical use is to check
4728 whether some user define options are set, and warn if not.</p>
4730 <pre class="prettyprint lang-config"># Example
4731 # tell when ReverseProxy is not set
4732 <IfDefine !ReverseProxy>
4733 Warning "reverse proxy is not started, hope this is okay!"
4736 <IfDefine ReverseProxy>
4737 # define custom proxy configuration
4738 </IfDefine></pre>
4744 <div class="bottomlang">
4745 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
4746 <a href="../en/mod/core.html" title="English"> en </a> |
4747 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
4748 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
4749 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
4750 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
4751 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
4752 <script type="text/javascript"><!--//--><![CDATA[//><!--
4753 var comments_shortname = 'httpd';
4754 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/core.html';
4756 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
4757 d.write('<div id="comments_thread"><\/div>');
4758 var s = d.createElement('script');
4759 s.type = 'text/javascript';
4761 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
4762 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
4765 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
4767 })(window, document);
4768 //--><!]]></script></div><div id="footer">
4769 <p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
4770 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
4771 if (typeof(prettyPrint) !== 'undefined') {