]> granicus.if.org Git - apache/blob - docs/manual/mod/core.html.en
Rebuild
[apache] / docs / manual / mod / core.html.en
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         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>core - Apache HTTP Server Version 2.5</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <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" />
12 <script src="../style/scripts/prettify.min.js" type="text/javascript">
13 </script>
14
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
16 <body>
17 <div id="page-header">
18 <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>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
22 <div id="path">
23 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Core Features</h1>
26 <div class="toplang">
27 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
28 <a href="../en/mod/core.html" title="English">&nbsp;en&nbsp;</a> |
29 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
30 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
31 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
32 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
33 </div>
34 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
35 available</td></tr>
36 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
37 </div>
38 <div id="quickview"><h3 class="directives">Directives</h3>
39 <ul id="toc">
40 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverridelist">AllowOverrideList</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#cgipassauth">CGIPassAuth</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#defaultruntimedir">DefaultRuntimeDir</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#directory">&lt;Directory&gt;</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch">&lt;DirectoryMatch&gt;</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#else">&lt;Else&gt;</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#elseif">&lt;ElseIf&gt;</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#error">Error</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#errorlogformat">ErrorLogFormat</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#files">&lt;Files&gt;</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch">&lt;FilesMatch&gt;</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#gprofdir">GprofDir</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#if">&lt;If&gt;</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine">&lt;IfDefine&gt;</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule">&lt;IfModule&gt;</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#includeoptional">IncludeOptional</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#limit">&lt;Limit&gt;</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept">&lt;LimitExcept&gt;</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#location">&lt;Location&gt;</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch">&lt;LocationMatch&gt;</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#logleveloverride">LogLevelOverride</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangeoverlaps">MaxRangeOverlaps</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangereversals">MaxRangeReversals</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#maxranges">MaxRanges</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#mergetrailers">MergeTrailers</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#registerhttpmethod">RegisterHttpMethod</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
107 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
108 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
109 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
110 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
111 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
112 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
113 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
114 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
115 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
116 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
117 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
118 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
119 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
120 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost">&lt;VirtualHost&gt;</a></li>
121 <li><img alt="" src="../images/down.gif" /> <a href="#warning">Warning</a></li>
122 </ul>
123 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
124
125 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
126 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
127 <table class="directive">
128 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
129 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
130 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
131 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
132 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
133 </table>
134     <p>This directive enables operating system specific optimizations for a
135        listening socket by the <code class="directive">Protocol</code> type.
136        The basic premise is for the kernel to not send a socket to the server
137        process until either data is received or an entire HTTP Request is buffered.
138        Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&amp;sektion=9">
139        FreeBSD's Accept Filters</a>, Linux's more primitive
140        <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
141        are currently supported.</p>
142
143     <p>Using <code>none</code> for an argument will disable any accept filters
144        for that protocol.  This is useful for protocols that require a server
145        send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
146     <pre class="prettyprint lang-config">AcceptFilter nntp none</pre>
147
148
149     <p>The default protocol names are <code>https</code> for port 443
150        and <code>http</code> for all other ports.  To specify another protocol
151        is being used with a listening port, add the <var>protocol</var>
152        argument to the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
153        directive.</p>
154
155     <p>The default values on FreeBSD are:</p>
156     <pre class="prettyprint lang-config">AcceptFilter http httpready
157 AcceptFilter https dataready</pre>
158
159
160     <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
161        the kernel level.  Once an entire request is received, the kernel then
162        sends it to the server. See the
163        <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&amp;sektion=9">
164        accf_http(9)</a> man page for more details.  Since HTTPS requests are
165        encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&amp;sektion=9">
166        accf_data(9)</a> filter is used.</p>
167
168     <p>The default values on Linux are:</p>
169     <pre class="prettyprint lang-config">AcceptFilter http data
170 AcceptFilter https data</pre>
171
172
173     <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
174        requests.  Any value besides <code>none</code> will enable
175        <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
176        see the Linux
177        <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
178        tcp(7)</a> man page.</p>
179
180     <p>The default values on Windows are:</p>
181     <pre class="prettyprint lang-config">AcceptFilter http data
182 AcceptFilter https data</pre>
183
184
185     <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
186        API, and does not support http protocol buffering.  There are two values
187        which utilize the Windows AcceptEx() API and will recycle network
188        sockets between connections.  <code>data</code> waits until data has
189        been transmitted as documented above, and the initial data buffer and
190        network endpoint addresses are all retrieved from the single AcceptEx()
191        invocation.  <code>connect</code> will use the AcceptEx() API, also
192        retrieve the network endpoint addresses, but like <code>none</code>
193        the <code>connect</code> option does not wait for the initial data
194        transmission.</p>
195
196     <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
197        and will not recycle sockets between connections.  This is useful for
198        network adapters with broken driver support, as well as some virtual
199        network providers such as vpn drivers, or spam, virus or spyware
200        filters.</p>
201
202
203 <h3>See also</h3>
204 <ul>
205 <li><code class="directive"><a href="#protocol">Protocol</a></code></li>
206 </ul>
207 </div>
208 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
209 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
210 <table class="directive">
211 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
212 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
213 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
214 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
215 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
216 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
217 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
218 </table>
219
220     <p>This directive controls whether requests that contain trailing
221     pathname information that follows an actual filename (or
222     non-existent file in an existing directory) will be accepted or
223     rejected.  The trailing pathname information can be made
224     available to scripts in the <code>PATH_INFO</code> environment
225     variable.</p>
226
227     <p>For example, assume the location <code>/test/</code> points to
228     a directory that contains only the single file
229     <code>here.html</code>.  Then requests for
230     <code>/test/here.html/more</code> and
231     <code>/test/nothere.html/more</code> both collect
232     <code>/more</code> as <code>PATH_INFO</code>.</p>
233
234     <p>The three possible arguments for the
235     <code class="directive">AcceptPathInfo</code> directive are:</p>
236     <dl>
237     <dt><code>Off</code></dt><dd>A request will only be accepted if it
238     maps to a literal path that exists.  Therefore a request with
239     trailing pathname information after the true filename such as
240     <code>/test/here.html/more</code> in the above example will return
241     a 404 NOT FOUND error.</dd>
242
243     <dt><code>On</code></dt><dd>A request will be accepted if a
244     leading path component maps to a file that exists.  The above
245     example <code>/test/here.html/more</code> will be accepted if
246     <code>/test/here.html</code> maps to a valid file.</dd>
247
248     <dt><code>Default</code></dt><dd>The treatment of requests with
249     trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
250     The core handler for normal files defaults to rejecting
251     <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
252     <code>PATH_INFO</code> by default.</dd>
253     </dl>
254
255     <p>The primary purpose of the <code>AcceptPathInfo</code>
256     directive is to allow you to override the handler's choice of
257     accepting or rejecting <code>PATH_INFO</code>. This override is required,
258     for example, when you use a <a href="../filter.html">filter</a>, such
259     as <a href="mod_include.html">INCLUDES</a>, to generate content
260     based on <code>PATH_INFO</code>.  The core handler would usually reject
261     the request, so you can use the following configuration to enable
262     such a script:</p>
263
264     <pre class="prettyprint lang-config">&lt;Files "mypaths.shtml"&gt;
265   Options +Includes
266   SetOutputFilter INCLUDES
267   AcceptPathInfo On
268 &lt;/Files&gt;</pre>
269
270
271
272 </div>
273 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
274 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
275 <table class="directive">
276 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
277 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
278 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
279 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
280 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
281 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
282 </table>
283     <p>While processing a request the server looks for
284     the first existing configuration file from this list of names in
285     every directory of the path to the document, if distributed
286     configuration files are <a href="#allowoverride">enabled for that
287     directory</a>. For example:</p>
288
289     <pre class="prettyprint lang-config">AccessFileName .acl</pre>
290
291
292     <p>before returning the document
293     <code>/usr/local/web/index.html</code>, the server will read
294     <code>/.acl</code>, <code>/usr/.acl</code>,
295     <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
296     for directives, unless they have been disabled with</p>
297
298     <pre class="prettyprint lang-config">&lt;Directory /&gt;
299     AllowOverride None
300 &lt;/Directory&gt;</pre>
301
302
303 <h3>See also</h3>
304 <ul>
305 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
306 <li><a href="../configuring.html">Configuration Files</a></li>
307 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
308 </ul>
309 </div>
310 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
311 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
312 <table class="directive">
313 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
314 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
315 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
316 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
317 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
318 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
319 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
320 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
321 </table>
322     <p>This directive specifies a default value for the media type
323     charset parameter (the name of a character encoding) to be added
324     to a response if and only if the response's content-type is either
325     <code>text/plain</code> or <code>text/html</code>.  This should override
326     any charset specified in the body of the response via a <code>META</code>
327     element, though the exact behavior is often dependent on the user's client
328     configuration. A setting of <code>AddDefaultCharset Off</code>
329     disables this functionality. <code>AddDefaultCharset On</code> enables
330     a default charset of <code>iso-8859-1</code>. Any other value is assumed
331     to be the <var>charset</var> to be used, which should be one of the
332     <a href="http://www.iana.org/assignments/character-sets">IANA registered
333     charset values</a> for use in Internet media types (MIME types).
334     For example:</p>
335
336     <pre class="prettyprint lang-config">AddDefaultCharset utf-8</pre>
337
338
339     <p><code class="directive">AddDefaultCharset</code> should only be used when all
340     of the text resources to which it applies are known to be in that
341     character encoding and it is too inconvenient to label their charset
342     individually. One such example is to add the charset parameter
343     to resources containing generated content, such as legacy CGI
344     scripts, that might be vulnerable to cross-site scripting attacks
345     due to user-provided data being included in the output.  Note, however,
346     that a better solution is to just fix (or delete) those scripts, since
347     setting a default charset does not protect users that have enabled
348     the "auto-detect character encoding" feature on their browser.</p>
349
350 <h3>See also</h3>
351 <ul>
352 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
353 </ul>
354 </div>
355 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
356 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
357 <table class="directive">
358 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
359 be passed through</td></tr>
360 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off|NoDecode</code></td></tr>
361 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
362 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
363 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
364 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
365 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>
366 NoDecode option available in 2.3.12 and later.</td></tr>
367 </table>
368     <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
369     which contain encoded path separators (<code>%2F</code> for <code>/</code>
370     and additionally <code>%5C</code> for <code>\</code> on according systems)
371     to be used in the path info.</p>
372
373     <p>With the default value, <code>Off</code>, such URLs are refused
374     with a 404 (Not found) error.</p>
375
376     <p>With the value <code>On</code>, such URLs are accepted, and encoded
377       slashes are decoded like all other encoded characters.</p>
378
379     <p>With the value <code>NoDecode</code>, such URLs are accepted, but
380       encoded slashes are not decoded but left in their encoded state.</p>
381
382     <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
383     mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
384
385     <div class="note"><h3>Note</h3>
386       <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
387       strongly recommended as a security measure.  Allowing slashes
388       to be decoded could potentially allow unsafe paths.</p>
389     </div>
390
391 <h3>See also</h3>
392 <ul>
393 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
394 </ul>
395 </div>
396 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
397 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
398 <table class="directive">
399 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
400 <code>.htaccess</code> files</td></tr>
401 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
402 [<var>directive-type</var>] ...</code></td></tr>
403 <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>
404 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
405 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
406 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
407 </table>
408     <p>When the server finds an <code>.htaccess</code> file (as
409     specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
410     it needs to know which directives declared in that file can override
411     earlier configuration directives.</p>
412
413     <div class="note"><h3>Only available in &lt;Directory&gt; sections</h3>
414     <code class="directive">AllowOverride</code> is valid only in
415     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
416     sections specified without regular expressions, not in <code class="directive"><a href="#location">&lt;Location&gt;</a></code>, <code class="directive"><a href="#directorymatch">&lt;DirectoryMatch&gt;</a></code> or
417     <code class="directive"><a href="#files">&lt;Files&gt;</a></code> sections.
418     </div>
419
420     <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code> is set to
421     <code>None</code> <a href="#accessfilename">.htaccess</a> files are
422     completely ignored. In this case, the server will not even attempt
423     to read <code>.htaccess</code> files in the filesystem.</p>
424
425     <p>When this directive is set to <code>All</code>, then any
426     directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
427     <code>.htaccess</code> files.</p>
428
429     <p>The <var>directive-type</var> can be one of the following
430     groupings of directives.</p>
431
432     <dl>
433       <dt>AuthConfig</dt>
434
435       <dd>
436
437       Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authz_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
438       <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
439       <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
440       <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
441       <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>
442
443       <dt>FileInfo</dt>
444
445       <dd>
446       Allow use of the directives controlling document types
447      (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
448       <code class="directive"><a href="#forcetype">ForceType</a></code>,
449       <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
450       <code class="directive"><a href="#sethandler">SetHandler</a></code>,
451       <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
452       <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
453       <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
454       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>),
455       <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>),
456       <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
457       <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
458       <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
459       </dd>
460
461       <dt>Indexes</dt>
462
463       <dd>
464       Allow use of the directives controlling directory indexing
465       (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
466       <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>,
467       <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
468       <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>,
469       <em>etc.</em>).</dd>
470
471       <dt>Limit</dt>
472
473       <dd>
474       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>
475
476
477
478
479       <dt>Nonfatal=[Override|Unknown|All]</dt>
480
481       <dd>
482       Allow use of AllowOverride option to treat syntax errors in
483       .htaccess as non-fatal: instead of causing an Internal Server
484       Error, disallowed or unrecognised directives will be ignored
485       and a warning logged:
486       <ul>
487           <li><strong>Nonfatal=Override</strong> treats directives
488               forbidden by AllowOverride as non-fatal.</li>
489           <li><strong>Nonfatal=Unknown</strong> treats unknown directives
490               as non-fatal.  This covers typos and directives implemented
491               by a module that's not present.</li>
492           <li><strong>Nonfatal=All</strong> treats both the above as non-fatal.</li>
493       </ul>
494       <p>Note that a syntax error in a valid directive will still cause
495       an internal server error.</p>
496       <div class="warning"><h3>Security</h3>
497           Nonfatal errors may have security implications for .htaccess users.
498           For example, if AllowOverride disallows AuthConfig, users'
499           configuration designed to restrict access to a site will be disabled.
500       </div>
501       </dd>
502
503       <dt>Options[=<var>Option</var>,...]</dt>
504
505       <dd>
506       Allow use of the directives controlling specific directory
507       features (<code class="directive"><a href="#options">Options</a></code> and
508       <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
509       An equal sign may be given followed by a comma (but no spaces)
510       separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.
511
512       <div class="note"><h3>Implicit disabling of Options</h3>
513       <p>Even though the list of options that may be used in .htaccess files
514          can be limited with this directive, as long as any <code class="directive"><a href="#options">Options</a></code> directive is allowed any
515          other inherited option can be disabled by using the non-relative
516          syntax.  In other words, this mechanism cannot force a specific option
517          to remain <em>set</em> while allowing any others to be set.
518       </p></div>
519
520       <div class="example"><p><code>
521       AllowOverride Options=Indexes,MultiViews
522       </code></p></div>
523       </dd>
524     </dl>
525
526     <p>Example:</p>
527
528     <pre class="prettyprint lang-config">AllowOverride AuthConfig Indexes</pre>
529
530
531     <p>In the example above all directives that are neither in the group
532     <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
533     server error.</p>
534
535     <div class="note"><p>For security and performance reasons, do not set
536     <code>AllowOverride</code> to anything other than <code>None</code>
537     in your <code>&lt;Directory /&gt;</code> block. Instead, find (or
538     create) the <code>&lt;Directory&gt;</code> block that refers to the
539     directory where you're actually planning to place a
540     <code>.htaccess</code> file.</p>
541     </div>
542
543 <h3>See also</h3>
544 <ul>
545 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
546 <li><code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code></li>
547 <li><a href="../configuring.html">Configuration Files</a></li>
548 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
549 </ul>
550 </div>
551 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
552 <div class="directive-section"><h2><a name="AllowOverrideList" id="AllowOverrideList">AllowOverrideList</a> <a name="allowoverridelist" id="allowoverridelist">Directive</a></h2>
553 <table class="directive">
554 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Individual directives that are allowed in
555 <code>.htaccess</code> files</td></tr>
556 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverrideList None|<var>directive</var>
557 [<var>directive-type</var>] ...</code></td></tr>
558 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverrideList None</code></td></tr>
559 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
560 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
561 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
562 </table>
563     <p>When the server finds an <code>.htaccess</code> file (as
564     specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
565     it needs to know which directives declared in that file can override
566     earlier configuration directives.</p>
567
568     <div class="note"><h3>Only available in &lt;Directory&gt; sections</h3>
569     <code class="directive">AllowOverrideList</code> is valid only in
570     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
571     sections specified without regular expressions, not in <code class="directive"><a href="#location">&lt;Location&gt;</a></code>, <code class="directive"><a href="#directorymatch">&lt;DirectoryMatch&gt;</a></code> or
572     <code class="directive"><a href="#files">&lt;Files&gt;</a></code> sections.
573     </div>
574
575     <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>,
576     then <a href="#accessfilename">.htaccess</a> files are completely
577     ignored.  In this case, the server will not even attempt to read
578     <code>.htaccess</code> files in the filesystem.</p>
579
580     <p>Example:</p>
581
582     <pre class="prettyprint lang-config">AllowOverride None
583 AllowOverrideList Redirect RedirectMatch</pre>
584
585
586     <p>In the example above only the <code>Redirect</code> and
587     <code>RedirectMatch</code> directives are allowed. All others will
588     cause an internal server error.</p>
589
590     <p>Example:</p>
591
592     <pre class="prettyprint lang-config">AllowOverride AuthConfig
593 AllowOverrideList CookieTracking CookieName</pre>
594
595
596     <p>In the example above <code class="directive"><a href="#allowoverride">AllowOverride
597     </a></code> grants permission to the <code>AuthConfig</code>
598     directive grouping and <code class="directive">AllowOverrideList</code> grants
599     permission to only two directives from the <code>FileInfo</code> directive
600     grouping. All others will cause an internal server error.</p>
601
602 <h3>See also</h3>
603 <ul>
604 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
605 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
606 <li><a href="../configuring.html">Configuration Files</a></li>
607 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
608 </ul>
609 </div>
610 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
611 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
612 <table class="directive">
613 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
614 scripts</td></tr>
615 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
616 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
617 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
618 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
619 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
620 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
621 </table>
622     <p>This directive is used to control how Apache httpd finds the
623     interpreter used to run CGI scripts. For example, setting
624     <code>CGIMapExtension sys:\foo.nlm .foo</code> will
625     cause all CGI script files with a <code>.foo</code> extension to
626     be passed to the FOO interpreter.</p>
627
628 </div>
629 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
630 <div class="directive-section"><h2><a name="CGIPassAuth" id="CGIPassAuth">CGIPassAuth</a> <a name="cgipassauth" id="cgipassauth">Directive</a></h2>
631 <table class="directive">
632 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables passing HTTP authorization headers to scripts as CGI
633 variables</td></tr>
634 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIPassAuth On|Off</code></td></tr>
635 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CGIPassAuth Off</code></td></tr>
636 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
637 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
638 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
639 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
640 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.13 and later</td></tr>
641 </table>
642     <p><code class="directive">CGIPassAuth</code> allows scripts access to HTTP
643     authorization headers such as <code>Authorization</code>, which is
644     required for scripts that implement HTTP Basic authentication.
645     Normally these HTTP headers are hidden from scripts, as it allows
646     scripts to see user ids and passwords used to access the server when
647     HTTP Basic authentication is enabled in the web server.  This directive
648     should be used when scripts are allowed to implement HTTP Basic
649     authentication.</p>
650
651     <p>This directive can be used instead of the compile-time setting
652     <code>SECURITY_HOLE_PASS_AUTHORIZATION</code> which has been available
653     in previous versions of Apache HTTP Server.</p>
654
655     <p>The setting is respected by any modules which use
656     <code>ap_add_common_vars()</code>, such as <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>,
657     <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>,
658     <code class="module"><a href="../mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code>, and so on.  Notably, it affects
659     modules which don't handle the request in the usual sense but
660     still use this API; examples of this are <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
661     and <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>.  Third-party modules that don't
662     use <code>ap_add_common_vars()</code> may choose to respect the setting
663     as well.</p>
664
665 </div>
666 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
667 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
668 <table class="directive">
669 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
670 headers</td></tr>
671 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
672 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
673 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
674 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
675 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
676 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
677 </table>
678     <p>This directive enables the generation of
679     <code>Content-MD5</code> headers as defined in RFC1864
680     respectively RFC2616.</p>
681
682     <p>MD5 is an algorithm for computing a "message digest"
683     (sometimes called "fingerprint") of arbitrary-length data, with
684     a high degree of confidence that any alterations in the data
685     will be reflected in alterations in the message digest.</p>
686
687     <p>The <code>Content-MD5</code> header provides an end-to-end
688     message integrity check (MIC) of the entity-body. A proxy or
689     client may check this header for detecting accidental
690     modification of the entity-body in transit. Example header:</p>
691
692     <div class="example"><p><code>
693       Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
694     </code></p></div>
695
696     <p>Note that this can cause performance problems on your server
697     since the message digest is computed on every request (the
698     values are not cached).</p>
699
700     <p><code>Content-MD5</code> is only sent for documents served
701     by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
702     SSI documents, output from CGI scripts, and byte range responses
703     do not have this header.</p>
704
705 </div>
706 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
707 <div class="directive-section"><h2><a name="DefaultRuntimeDir" id="DefaultRuntimeDir">DefaultRuntimeDir</a> <a name="defaultruntimedir" id="defaultruntimedir">Directive</a></h2>
708 <table class="directive">
709 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server run-time files</td></tr>
710 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultRuntimeDir <var>directory-path</var></code></td></tr>
711 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</code></td></tr>
712 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
713 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
714 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
715 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.2 and later</td></tr>
716 </table>
717     <p>The <code class="directive">DefaultRuntimeDir</code> directive sets the
718     directory in which the server will create various run-time files
719     (shared memory, locks, etc.). If set as a relative path, the full path
720     will be relative to <code class="directive">ServerRoot</code>.</p>
721
722     <p><strong>Example</strong></p>
723    <pre class="prettyprint lang-config">DefaultRuntimeDir scratch/</pre>
724
725
726     <p>The default location of <code class="directive">DefaultRuntimeDir</code> may be
727     modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
728     at build time.</p>
729
730    <p>Note: <code class="directive">ServerRoot</code> should be specified before this
731    directive is used, otherwise the default value of <code class="directive">ServerRoot</code>
732    would be used to set the base directory.</p>
733
734
735 <h3>See also</h3>
736 <ul>
737 <li><a href="../misc/security_tips.html#serverroot">the
738     security tips</a> for information on how to properly set
739     permissions on the <code class="directive">ServerRoot</code></li>
740 </ul>
741 </div>
742 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
743 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
744 <table class="directive">
745 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
746 if the value is not <code>none</code>. In prior versions, DefaultType
747 would specify a default media type to assign to response content for
748 which no other media type configuration could be found.
749 </td></tr>
750 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
751 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
752 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
753 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
754 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
755 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
756 <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.
757 </td></tr>
758 </table>
759     <p>This directive has been disabled.  For backwards compatibility
760     of configuration files, it may be specified with the value
761     <code>none</code>, meaning no default media type. For example:</p>
762
763     <pre class="prettyprint lang-config">DefaultType None</pre>
764
765
766     <p><code>DefaultType None</code> is only available in
767     httpd-2.2.7 and later.</p>
768
769     <p>Use the mime.types configuration file and the
770     <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
771     type assignments via file extensions, or the
772     <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
773     the media type for specific resources. Otherwise, the server will
774     send the response without a Content-Type header field and the
775     recipient may attempt to guess the media type.</p>
776
777 </div>
778 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
779 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
780 <table class="directive">
781 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a variable</td></tr>
782 <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>
783 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
784 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
785 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
786 </table>
787     <p>In its one parameter form, <code class="directive">Define</code> is equivalent
788     to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>. It
789     can be used to toggle the use of
790     <code class="directive"><a href="#ifdefine">&lt;IfDefine&gt;</a></code> sections
791     without needing to alter <code>-D</code> arguments in any startup
792     scripts.</p>
793
794     <p>In addition to that, if the second parameter is given, a config variable
795     is set to this value. The variable can be used in the configuration using
796     the <code>${VAR}</code> syntax. The variable is always globally defined
797     and not limited to the scope of the surrounding config section.</p>
798
799     <pre class="prettyprint lang-config">&lt;IfDefine TEST&gt;
800   Define servername test.example.com
801 &lt;/IfDefine&gt;
802 &lt;IfDefine !TEST&gt;
803   Define servername www.example.com
804   Define SSL
805 &lt;/IfDefine&gt;
806
807 DocumentRoot /var/www/${servername}/htdocs</pre>
808
809
810     <p>Variable names may not contain colon ":" characters, to avoid clashes
811     with <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>'s syntax.</p>
812
813     <p>While this directive is supported in virtual host context,
814        the changes it makes are visible to any later configuration
815        directives, beyond any enclosing virtual host</p>
816
817 </div>
818 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
819 <div class="directive-section"><h2><a name="Directory" id="Directory">&lt;Directory&gt;</a> <a name="directory" id="directory">Directive</a></h2>
820 <table class="directive">
821 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
822 named file-system directory, sub-directories, and their contents.</td></tr>
823 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Directory <var>directory-path</var>&gt;
824 ... &lt;/Directory&gt;</code></td></tr>
825 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
826 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
827 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
828 </table>
829     <p><code class="directive">&lt;Directory&gt;</code> and
830     <code>&lt;/Directory&gt;</code> are used to enclose a group of
831     directives that will apply only to the named directory,
832     sub-directories of that directory, and the files within the respective
833     directories.  Any directive that is allowed
834     in a directory context may be used. <var>Directory-path</var> is
835     either the full path to a directory, or a wild-card string using
836     Unix shell-style matching. In a wild-card string, <code>?</code> matches
837     any single character, and <code>*</code> matches any sequences of
838     characters. You may also use <code>[]</code> character ranges. None
839     of the wildcards match a `/' character, so <code>&lt;Directory
840     /*/public_html&gt;</code> will not match
841     <code>/home/user/public_html</code>, but <code>&lt;Directory
842     /home/*/public_html&gt;</code> will match. Example:</p>
843
844     <pre class="prettyprint lang-config">&lt;Directory "/usr/local/httpd/htdocs"&gt;
845   Options Indexes FollowSymLinks
846 &lt;/Directory&gt;</pre>
847
848
849     <p>Directory paths <em>may</em> be quoted, if you like, however, it
850     <em>must</em> be quoted if the path contains spaces. This is because a
851     space would otherwise indicate the end of an argument.</p>
852
853     <div class="note">
854       <p>Be careful with the <var>directory-path</var> arguments:
855       They have to literally match the filesystem path which Apache httpd uses
856       to access the files. Directives applied to a particular
857       <code>&lt;Directory&gt;</code> will not apply to files accessed from
858       that same directory via a different path, such as via different symbolic
859       links.</p>
860     </div>
861
862     <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
863     expressions</a> can also be used, with the addition of the
864     <code>~</code> character. For example:</p>
865
866     <pre class="prettyprint lang-config">&lt;Directory ~ "^/www/[0-9]{3}"&gt;
867
868 &lt;/Directory&gt;</pre>
869
870
871     <p>would match directories in <code>/www/</code> that consisted of
872     three numbers.</p>
873
874     <p>If multiple (non-regular expression) <code class="directive">&lt;Directory&gt;</code> sections
875     match the directory (or one of its parents) containing a document,
876     then the directives are applied in the order of shortest match
877     first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
878     with</p>
879
880     <pre class="prettyprint lang-config">&lt;Directory /&gt;
881   AllowOverride None
882 &lt;/Directory&gt;
883
884 &lt;Directory "/home"&gt;
885   AllowOverride FileInfo
886 &lt;/Directory&gt;</pre>
887
888
889     <p>for access to the document <code>/home/web/dir/doc.html</code>
890     the steps are:</p>
891
892     <ul>
893       <li>Apply directive <code>AllowOverride None</code>
894       (disabling <code>.htaccess</code> files).</li>
895
896       <li>Apply directive <code>AllowOverride FileInfo</code> (for
897       directory <code>/home</code>).</li>
898
899       <li>Apply any <code>FileInfo</code> directives in
900       <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
901       <code>/home/web/dir/.htaccess</code> in that order.</li>
902     </ul>
903
904     <p>Regular expressions are not considered until after all of the
905     normal sections have been applied. Then all of the regular
906     expressions are tested in the order they appeared in the
907     configuration file. For example, with</p>
908
909     <pre class="prettyprint lang-config">&lt;Directory ~ "abc$"&gt;
910   # ... directives here ...
911 &lt;/Directory&gt;</pre>
912
913
914     <p>the regular expression section won't be considered until after
915     all normal <code class="directive">&lt;Directory&gt;</code>s and
916     <code>.htaccess</code> files have been applied. Then the regular
917     expression will match on <code>/home/abc/public_html/abc</code> and
918     the corresponding <code class="directive">&lt;Directory&gt;</code> will
919     be applied.</p>
920
921    <p><strong>Note that the default access for
922     <code>&lt;Directory /&gt;</code> is to permit all access.
923     This means that Apache httpd will serve any file mapped from an URL. It is
924     recommended that you change this with a block such
925     as</strong></p>
926
927     <pre class="prettyprint lang-config">&lt;Directory /&gt;
928   Require all denied
929 &lt;/Directory&gt;</pre>
930
931
932     <p><strong>and then override this for directories you
933     <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
934     details.</strong></p>
935
936     <p>The directory sections occur in the <code>httpd.conf</code> file.
937     <code class="directive">&lt;Directory&gt;</code> directives
938     cannot nest, and cannot appear in a <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> or <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section.</p>
939
940 <h3>See also</h3>
941 <ul>
942 <li><a href="../sections.html">How &lt;Directory&gt;,
943     &lt;Location&gt; and &lt;Files&gt; sections work</a> for an
944     explanation of how these different sections are combined when a
945     request is received</li>
946 </ul>
947 </div>
948 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
949 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch">&lt;DirectoryMatch&gt;</a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
950 <table class="directive">
951 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
952 the contents of file-system directories matching a regular expression.</td></tr>
953 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;DirectoryMatch <var>regex</var>&gt;
954 ... &lt;/DirectoryMatch&gt;</code></td></tr>
955 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
956 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
957 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
958 </table>
959     <p><code class="directive">&lt;DirectoryMatch&gt;</code> and
960     <code>&lt;/DirectoryMatch&gt;</code> are used to enclose a group
961     of directives which will apply only to the named directory (and the files within),
962     the same as <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>.
963     However, it takes as an argument a
964     <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>.  For example:</p>
965
966     <pre class="prettyprint lang-config">&lt;DirectoryMatch "^/www/(.+/)?[0-9]{3}/"&gt;
967     # ...
968 &lt;/DirectoryMatch&gt;</pre>
969
970
971     <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
972     that consist of three numbers.</p>
973
974    <div class="note"><h3>Compatability</h3>
975       Prior to 2.3.9, this directive implicitly applied to sub-directories
976       (like <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>) and
977       could not match the end of line symbol ($).  In 2.3.9 and later,
978       only directories that match the expression are affected by the enclosed
979       directives.
980     </div>
981
982     <div class="note"><h3>Trailing Slash</h3>
983       This directive applies to requests for directories that may or may
984       not end in a trailing slash, so expressions that are anchored to the
985       end of line ($) must be written with care.
986     </div>
987
988     <p>From 2.4.8 onwards, named groups and backreferences are captured and
989     written to the environment with the corresponding name prefixed with
990     "MATCH_" and in upper case. This allows elements of paths to be referenced
991     from within <a href="../expr.html">expressions</a> and modules like
992     <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
993     (unnamed) backreferences are ignored. Use named groups instead.</p>
994
995 <pre class="prettyprint lang-config">&lt;DirectoryMatch ^/var/www/combined/(?&lt;sitename&gt;[^/]+)&gt;
996     Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
997 &lt;/DirectoryMatch&gt;</pre>
998
999
1000 <h3>See also</h3>
1001 <ul>
1002 <li><code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> for
1003 a description of how regular expressions are mixed in with normal
1004 <code class="directive">&lt;Directory&gt;</code>s</li>
1005 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt; and
1006 &lt;Files&gt; sections work</a> for an explanation of how these different
1007 sections are combined when a request is received</li>
1008 </ul>
1009 </div>
1010 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1011 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
1012 <table class="directive">
1013 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
1014 from the web</td></tr>
1015 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
1016 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
1017 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1018 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1019 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1020 </table>
1021     <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1022     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
1023     path from the requested URL to the document root to make the
1024     path to the document. Example:</p>
1025
1026     <pre class="prettyprint lang-config">DocumentRoot "/usr/web"</pre>
1027
1028
1029     <p>then an access to
1030     <code>http://my.example.com/index.html</code> refers to
1031     <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
1032     not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1033
1034     <p>The <code class="directive">DocumentRoot</code> should be specified without
1035     a trailing slash.</p>
1036
1037 <h3>See also</h3>
1038 <ul>
1039 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1040 Locations</a></li>
1041 </ul>
1042 </div>
1043 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1044 <div class="directive-section"><h2><a name="Else" id="Else">&lt;Else&gt;</a> <a name="else" id="else">Directive</a></h2>
1045 <table class="directive">
1046 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if the condition of a
1047 previous <code class="directive"><a href="#if">&lt;If&gt;</a></code> or
1048 <code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code> section is not
1049 satisfied by a request at runtime</td></tr>
1050 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Else&gt; ... &lt;/Else&gt;</code></td></tr>
1051 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1052 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1053 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1054 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1055 </table>
1056     <p>The <code class="directive">&lt;Else&gt;</code> applies the enclosed
1057     directives if and only if the most recent
1058     <code class="directive">&lt;If&gt;</code> or
1059     <code class="directive">&lt;ElseIf&gt;</code> section
1060     in the same scope has not been applied.
1061     For example: In </p>
1062
1063     <pre class="prettyprint lang-config">&lt;If "-z req('Host')"&gt;
1064   # ...
1065 &lt;/If&gt;
1066 &lt;Else&gt;
1067   # ...
1068 &lt;/Else&gt;</pre>
1069
1070
1071     <p> The <code class="directive">&lt;If&gt;</code> would match HTTP/1.0
1072         requests without a <var>Host:</var> header and the
1073         <code class="directive">&lt;Else&gt;</code> would match requests
1074         with a <var>Host:</var> header.</p>
1075
1076
1077 <h3>See also</h3>
1078 <ul>
1079 <li><code class="directive"><a href="#if">&lt;If&gt;</a></code></li>
1080 <li><code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code></li>
1081 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
1082     &lt;Files&gt; sections work</a> for an explanation of how these
1083     different sections are combined when a request is received.
1084     <code class="directive">&lt;If&gt;</code>,
1085     <code class="directive">&lt;ElseIf&gt;</code>, and
1086     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
1087 </ul>
1088 </div>
1089 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1090 <div class="directive-section"><h2><a name="ElseIf" id="ElseIf">&lt;ElseIf&gt;</a> <a name="elseif" id="elseif">Directive</a></h2>
1091 <table class="directive">
1092 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is satisfied
1093 by a request at runtime while the condition of a previous
1094 <code class="directive"><a href="#if">&lt;If&gt;</a></code> or
1095 <code class="directive">&lt;ElseIf&gt;</code> section is not
1096 satisfied</td></tr>
1097 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;ElseIf <var>expression</var>&gt; ... &lt;/ElseIf&gt;</code></td></tr>
1098 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1099 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1100 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1101 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1102 </table>
1103     <p>The <code class="directive">&lt;ElseIf&gt;</code> applies the enclosed
1104     directives if and only if both the given condition evaluates to true and
1105     the most recent <code class="directive">&lt;If&gt;</code> or
1106     <code class="directive">&lt;ElseIf&gt;</code> section in the same scope has
1107     not been applied.  For example: In </p>
1108
1109     <pre class="prettyprint lang-config">&lt;If "-R '10.1.0.0/16'"&gt;
1110   #...
1111 &lt;/If&gt;
1112 &lt;ElseIf "-R '10.0.0.0/8'"&gt;
1113   #...
1114 &lt;/ElseIf&gt;
1115 &lt;Else&gt;
1116   #...
1117 &lt;/Else&gt;</pre>
1118
1119
1120     <p>The <code class="directive">&lt;ElseIf&gt;</code> would match if
1121     the remote address of a request belongs to the subnet 10.0.0.0/8 but
1122     not to the subnet 10.1.0.0/16.</p>
1123
1124
1125 <h3>See also</h3>
1126 <ul>
1127 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1128 for a complete reference and more examples.</li>
1129 <li><code class="directive"><a href="#if">&lt;If&gt;</a></code></li>
1130 <li><code class="directive"><a href="#else">&lt;Else&gt;</a></code></li>
1131 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
1132     &lt;Files&gt; sections work</a> for an explanation of how these
1133     different sections are combined when a request is received.
1134     <code class="directive">&lt;If&gt;</code>,
1135     <code class="directive">&lt;ElseIf&gt;</code>, and
1136     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
1137 </ul>
1138 </div>
1139 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1140 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
1141 <table class="directive">
1142 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
1143 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
1144 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
1145 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1146 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1147 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1148 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1149 </table>
1150     <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
1151     memory-mapping if it needs to read the contents of a file during
1152     delivery.  By default, when the handling of a request requires
1153     access to the data within a file -- for example, when delivering a
1154     server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache httpd
1155     memory-maps the file if the OS supports it.</p>
1156
1157     <p>This memory-mapping sometimes yields a performance improvement.
1158     But in some environments, it is better to disable the memory-mapping
1159     to prevent operational problems:</p>
1160
1161     <ul>
1162     <li>On some multiprocessor systems, memory-mapping can reduce the
1163     performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
1164     <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1165       has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1166       crash with a segmentation fault.
1167     </li>
1168     </ul>
1169
1170     <p>For server configurations that are vulnerable to these problems,
1171     you should disable memory-mapping of delivered files by specifying:</p>
1172
1173     <pre class="prettyprint lang-config">EnableMMAP Off</pre>
1174
1175
1176     <p>For NFS mounted files, this feature may be disabled explicitly for
1177     the offending files by specifying:</p>
1178
1179     <pre class="prettyprint lang-config">&lt;Directory "/path-to-nfs-files"&gt;
1180   EnableMMAP Off
1181 &lt;/Directory&gt;</pre>
1182
1183
1184 </div>
1185 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1186 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
1187 <table class="directive">
1188 <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>
1189 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
1190 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile Off</code></td></tr>
1191 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1192 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1193 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1194 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1195 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Default changed to Off in
1196 version 2.3.9.</td></tr>
1197 </table>
1198     <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
1199     sendfile support from the kernel to transmit file contents to the client.
1200     By default, when the handling of a request requires no access
1201     to the data within a file -- for example, when delivering a
1202     static file -- Apache httpd uses sendfile to deliver the file contents
1203     without ever reading the file if the OS supports it.</p>
1204
1205     <p>This sendfile mechanism avoids separate read and send operations,
1206     and buffer allocations. But on some platforms or within some
1207     filesystems, it is better to disable this feature to avoid
1208     operational problems:</p>
1209
1210     <ul>
1211     <li>Some platforms may have broken sendfile support that the build
1212     system did not detect, especially if the binaries were built on
1213     another box and moved to such a machine with broken sendfile
1214     support.</li>
1215     <li>On Linux the use of sendfile triggers TCP-checksum
1216     offloading bugs on certain networking cards when using IPv6.</li>
1217     <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1218     files over 2GB in size.</li>
1219     <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS, SMB, CIFS, FUSE),
1220     the kernel may be unable to serve the network file through
1221     its own cache.</li>
1222     </ul>
1223
1224     <p>For server configurations that are not vulnerable to these problems,
1225     you may enable this feature by specifying:</p>
1226
1227     <pre class="prettyprint lang-config">EnableSendfile On</pre>
1228
1229
1230     <p>For network mounted files, this feature may be disabled explicitly
1231     for the offending files by specifying:</p>
1232
1233     <pre class="prettyprint lang-config">&lt;Directory "/path-to-nfs-files"&gt;
1234   EnableSendfile Off
1235 &lt;/Directory&gt;</pre>
1236
1237     <p>Please note that the per-directory and .htaccess configuration
1238        of <code class="directive">EnableSendfile</code> is not supported by
1239        <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>.
1240        Only global definition of <code class="directive">EnableSendfile</code>
1241        is taken into account by the module.
1242     </p>
1243
1244 </div>
1245 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1246 <div class="directive-section"><h2><a name="Error" id="Error">Error</a> <a name="error" id="error">Directive</a></h2>
1247 <table class="directive">
1248 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Abort configuration parsing with a custom error message</td></tr>
1249 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Error <var>message</var></code></td></tr>
1250 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1251 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1252 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1253 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.3.9 and later</td></tr>
1254 </table>
1255     <p>If an error can be detected within the configuration, this
1256     directive can be used to generate a custom error message, and halt
1257     configuration parsing.  The typical use is for reporting required
1258     modules which are missing from the configuration.</p>
1259
1260     <pre class="prettyprint lang-config"># Example
1261 # ensure that mod_include is loaded
1262 &lt;IfModule !include_module&gt;
1263   Error "mod_include is required by mod_foo.  Load it with LoadModule."
1264 &lt;/IfModule&gt;
1265
1266 # ensure that exactly one of SSL,NOSSL is defined
1267 &lt;IfDefine SSL&gt;
1268 &lt;IfDefine NOSSL&gt;
1269   Error "Both SSL and NOSSL are defined.  Define only one of them."
1270 &lt;/IfDefine&gt;
1271 &lt;/IfDefine&gt;
1272 &lt;IfDefine !SSL&gt;
1273 &lt;IfDefine !NOSSL&gt;
1274   Error "Either SSL or NOSSL must be defined."
1275 &lt;/IfDefine&gt;
1276 &lt;/IfDefine&gt;</pre>
1277
1278
1279
1280 </div>
1281 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1282 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
1283 <table class="directive">
1284 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
1285 in case of an error</td></tr>
1286 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
1287 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1288 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1289 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1290 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1291 </table>
1292     <p>In the event of a problem or error, Apache httpd can be configured
1293     to do one of four things,</p>
1294
1295     <ol>
1296       <li>output a simple hardcoded error message</li>
1297
1298       <li>output a customized message</li>
1299
1300       <li>internally redirect to a local <var>URL-path</var> to handle the
1301       problem/error</li>
1302
1303       <li>redirect to an external <var>URL</var> to handle the
1304       problem/error</li>
1305     </ol>
1306
1307     <p>The first option is the default, while options 2-4 are
1308     configured using the <code class="directive">ErrorDocument</code>
1309     directive, which is followed by the HTTP response code and a URL
1310     or a message. Apache httpd will sometimes offer additional information
1311     regarding the problem/error.</p>
1312
1313     <p>From 2.4.13, <a href="../expr.html">expression syntax</a> can be
1314     used inside the directive to produce dynamic strings and URLs.</p>
1315
1316     <p>URLs can begin with a slash (/) for local web-paths (relative
1317     to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1318     full URL which the client can resolve. Alternatively, a message
1319     can be provided to be displayed by the browser. Note that deciding
1320     whether the parameter is an URL, a path or a message is performed
1321     before any expression is parsed. Examples:</p>
1322
1323     <pre class="prettyprint lang-config">ErrorDocument 500 http://foo.example.com/cgi-bin/tester
1324 ErrorDocument 404 /cgi-bin/bad_urls.pl
1325 ErrorDocument 401 /subscription_info.html
1326 ErrorDocument 403 "Sorry can't allow you access today"
1327 ErrorDocument 403 Forbidden!
1328 ErrorDocument 403 /cgi-bin/forbidden.pl?referrer=%{escape:%{HTTP_REFERER}}</pre>
1329
1330
1331     <p>Additionally, the special value <code>default</code> can be used
1332     to specify Apache httpd's simple hardcoded message.  While not required
1333     under normal circumstances, <code>default</code> will restore
1334     Apache httpd's simple hardcoded message for configurations that would
1335     otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1336
1337     <pre class="prettyprint lang-config">ErrorDocument 404 /cgi-bin/bad_urls.pl
1338
1339 &lt;Directory /web/docs&gt;
1340   ErrorDocument 404 default
1341 &lt;/Directory&gt;</pre>
1342
1343
1344     <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1345     that points to a remote URL (ie. anything with a method such as
1346     <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1347     client to tell it where to find the document, even if the
1348     document ends up being on the same server. This has several
1349     implications, the most important being that the client will not
1350     receive the original error status code, but instead will
1351     receive a redirect status code. This in turn can confuse web
1352     robots and other clients which try to determine if a URL is
1353     valid using the status code. In addition, if you use a remote
1354     URL in an <code>ErrorDocument 401</code>, the client will not
1355     know to prompt the user for a password since it will not
1356     receive the 401 status code. Therefore, <strong>if you use an
1357     <code>ErrorDocument 401</code> directive then it must refer to a local
1358     document.</strong></p>
1359
1360     <p>Microsoft Internet Explorer (MSIE) will by default ignore
1361     server-generated error messages when they are "too small" and substitute
1362     its own "friendly" error messages. The size threshold varies depending on
1363     the type of error, but in general, if you make your error document
1364     greater than 512 bytes, then MSIE will show the server-generated
1365     error rather than masking it.  More information is available in
1366     Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1367
1368     <p>Although most error messages can be overridden, there are certain
1369     circumstances where the internal messages are used regardless of the
1370     setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>.  In
1371     particular, if a malformed request is detected, normal request processing
1372     will be immediately halted and the internal error message returned.
1373     This is necessary to guard against security problems caused by
1374     bad requests.</p>
1375
1376     <p>If you are using mod_proxy, you may wish to enable
1377     <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1378     custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1379     Apache httpd will not generate custom error documents for proxied content.</p>
1380
1381 <h3>See also</h3>
1382 <ul>
1383 <li><a href="../custom-error.html">documentation of
1384     customizable responses</a></li>
1385 </ul>
1386 </div>
1387 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1388 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1389 <table class="directive">
1390 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1391 <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>
1392 <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>
1393 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1394 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1395 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1396 </table>
1397     <p>The <code class="directive">ErrorLog</code> directive sets the name of
1398     the file to which the server will log any errors it encounters. If
1399     the <var>file-path</var> is not absolute then it is assumed to be
1400     relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1401
1402     <pre class="prettyprint lang-config">ErrorLog "/var/log/httpd/error_log"</pre>
1403
1404
1405     <p>If the <var>file-path</var>
1406     begins with a pipe character "<code>|</code>" then it is assumed to be a
1407     command to spawn to handle the error log.</p>
1408
1409     <pre class="prettyprint lang-config">ErrorLog "|/usr/local/bin/httpd_errors"</pre>
1410
1411
1412     <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1413     more information.</p>
1414
1415     <p>Using <code>syslog</code> instead of a filename enables logging
1416     via syslogd(8) if the system supports it and if <code class="module"><a href="../mod/mod_syslog.html">mod_syslog</a></code>
1417     is loaded. The default is to use syslog facility <code>local7</code>,
1418     but you can override this by using the <code>syslog:<var>facility</var></code>
1419     syntax where <var>facility</var> can be one of the names usually documented in
1420     syslog(1).  The facility is effectively global, and if it is changed
1421     in individual virtual hosts, the final facility specified affects the
1422     entire server.</p>
1423
1424     <pre class="prettyprint lang-config">ErrorLog syslog:user</pre>
1425
1426
1427     <p>Additional modules can provide their own ErrorLog providers. The syntax
1428     is similar to <code>syslog</code> example above.</p>
1429
1430     <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1431     document for details on why your security could be compromised
1432     if the directory where log files are stored is writable by
1433     anyone other than the user that starts the server.</p>
1434     <div class="warning"><h3>Note</h3>
1435       <p>When entering a file path on non-Unix platforms, care should be taken
1436       to make sure that only forward slashes are used even though the platform
1437       may allow the use of back slashes. In general it is a good idea to always
1438       use forward slashes throughout the configuration files.</p>
1439     </div>
1440
1441 <h3>See also</h3>
1442 <ul>
1443 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1444 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1445 </ul>
1446 </div>
1447 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1448 <div class="directive-section"><h2><a name="ErrorLogFormat" id="ErrorLogFormat">ErrorLogFormat</a> <a name="errorlogformat" id="errorlogformat">Directive</a></h2>
1449 <table class="directive">
1450 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Format specification for error log entries</td></tr>
1451 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLogFormat [connection|request] <var>format</var></code></td></tr>
1452 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1453 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1454 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1455 </table>
1456     <p><code class="directive">ErrorLogFormat</code> allows to specify what
1457     supplementary information is logged in the error log in addition to the
1458     actual log message.</p>
1459
1460     <pre class="prettyprint lang-config">#Simple example
1461 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"</pre>
1462
1463
1464     <p>Specifying <code>connection</code> or <code>request</code> as first
1465     parameter allows to specify additional formats, causing additional
1466     information to be logged when the first message is logged for a specific
1467     connection or request, respectively. This additional information is only
1468     logged once per connection/request. If a connection or request is processed
1469     without causing any log message, the additional information is not logged
1470     either.</p>
1471
1472     <p>It can happen that some format string items do not produce output.  For
1473     example, the Referer header is only present if the log message is
1474     associated to a request and the log message happens at a time when the
1475     Referer header has already been read from the client.  If no output is
1476     produced, the default behavior is to delete everything from the preceding
1477     space character to the next space character.  This means the log line is
1478     implicitly divided into fields on non-whitespace to whitespace transitions.
1479     If a format string item does not produce output, the whole field is
1480     omitted.  For example, if the remote address <code>%a</code> in the log
1481     format <code>[%t] [%l] [%a] %M&nbsp;</code> is not available, the surrounding
1482     brackets are not logged either.  Space characters can be escaped with a
1483     backslash to prevent them from delimiting a field.  The combination '%&nbsp;'
1484     (percent space) is a zero-width field delimiter that does not produce any
1485     output.</p>
1486
1487     <p>The above behavior can be changed by adding modifiers to the format
1488     string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1489     respective item does not produce any output. In once-per-connection/request
1490     formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1491     item with the plus modifier does not produce any output, the whole line is
1492     omitted.</p>
1493
1494     <p>A number as modifier can be used to assign a log severity level to a
1495     format item. The item will only be logged if the severity of the log
1496     message is not higher than the specified log severity level. The number can
1497     range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1498
1499     <p>For example, here's what would happen if you added modifiers to
1500     the <code>%{Referer}i</code> token, which logs the
1501     <code>Referer</code> request header.</p>
1502
1503     <table class="bordered"><tr class="header"><th>Modified Token</th><th>Meaning</th></tr>
1504 <tr>
1505     <td><code>%-{Referer}i</code></td>
1506     <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1507     </tr>
1508 <tr class="odd">
1509     <td><code>%+{Referer}i</code></td>
1510     <td>Omits the entire line if <code>Referer</code> is not set.</td>
1511     </tr>
1512 <tr>
1513     <td><code>%4{Referer}i</code></td>
1514     <td>Logs the <code>Referer</code> only if the log message severity
1515     is higher than 4.</td>
1516     </tr>
1517 </table>
1518
1519     <p>Some format string items accept additional parameters in braces.</p>
1520
1521     <table class="bordered"><tr class="header"><th>Format&nbsp;String</th> <th>Description</th></tr>
1522 <tr><td><code>%%</code></td>
1523         <td>The percent sign</td></tr>
1524 <tr class="odd"><td><code>%a</code></td>
1525         <td>Client IP address and port of the request</td></tr>
1526 <tr><td><code>%{c}a</code></td>
1527         <td>Underlying peer IP address and port of the connection (see the
1528             <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module)</td></tr>
1529 <tr class="odd"><td><code>%A</code></td>
1530         <td>Local IP-address and port</td></tr>
1531 <tr><td><code>%{<em>name</em>}e</code></td>
1532         <td>Request environment variable <em>name</em></td></tr>
1533 <tr class="odd"><td><code>%E</code></td>
1534         <td>APR/OS error status code and string</td></tr>
1535 <tr><td><code>%F</code></td>
1536         <td>Source file name and line number of the log call</td></tr>
1537 <tr class="odd"><td><code>%{<em>name</em>}i</code></td>
1538         <td>Request header <em>name</em></td></tr>
1539 <tr><td><code>%k</code></td>
1540         <td>Number of keep-alive requests on this connection</td></tr>
1541 <tr class="odd"><td><code>%l</code></td>
1542         <td>Loglevel of the message</td></tr>
1543 <tr><td><code>%L</code></td>
1544         <td>Log ID of the request</td></tr>
1545 <tr class="odd"><td><code>%{c}L</code></td>
1546         <td>Log ID of the connection</td></tr>
1547 <tr><td><code>%{C}L</code></td>
1548         <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1549 <tr class="odd"><td><code>%m</code></td>
1550         <td>Name of the module logging the message</td></tr>
1551 <tr><td><code>%M</code></td>
1552         <td>The actual log message</td></tr>
1553 <tr class="odd"><td><code>%{<em>name</em>}n</code></td>
1554         <td>Request note <em>name</em></td></tr>
1555 <tr><td><code>%P</code></td>
1556         <td>Process ID of current process</td></tr>
1557 <tr class="odd"><td><code>%T</code></td>
1558         <td>Thread ID of current thread</td></tr>
1559 <tr><td><code>%{g}T</code></td>
1560         <td>System unique thread ID of current thread (the same ID as
1561             displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1562 <tr class="odd"><td><code>%t</code></td>
1563         <td>The current time</td></tr>
1564 <tr><td><code>%{u}t</code></td>
1565         <td>The current time including micro-seconds</td></tr>
1566 <tr class="odd"><td><code>%{cu}t</code></td>
1567         <td>The current time in compact ISO 8601 format, including
1568             micro-seconds</td></tr>
1569 <tr><td><code>%v</code></td>
1570         <td>The canonical <code class="directive"><a href="#servername">ServerName</a></code>
1571             of the current server.</td></tr>
1572 <tr class="odd"><td><code>%V</code></td>
1573         <td>The server name of the server serving the request according to the
1574             <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
1575             setting.</td></tr>
1576 <tr><td><code>\&nbsp;</code> (backslash space)</td>
1577         <td>Non-field delimiting space</td></tr>
1578 <tr class="odd"><td><code>%&nbsp;</code> (percent space)</td>
1579         <td>Field delimiter (no output)</td></tr>
1580 </table>
1581
1582     <p>The log ID format <code>%L</code> produces a unique id for a connection
1583     or request. This can be used to correlate which log lines belong to the
1584     same connection or request, which request happens on which connection.
1585     A <code>%L</code> format string is also available in
1586     <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>, to allow to correlate access log entries
1587     with error log lines. If <code class="module"><a href="../mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its
1588     unique id will be used as log ID for requests.</p>
1589
1590     <pre class="prettyprint lang-config">#Example (default format for threaded MPMs)
1591 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1592
1593
1594     <p>This would result in error messages such as:</p>
1595
1596         <div class="example"><p><code>
1597     [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
1598     </code></p></div>
1599
1600     <p>Notice that, as discussed above, some fields are omitted
1601     entirely because they are not defined.</p>
1602
1603     <pre class="prettyprint lang-config">#Example (similar to the 2.2.x format)
1604 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1605
1606
1607     <pre class="prettyprint lang-config">#Advanced example with request/connection log IDs
1608 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1609 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1610 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1611 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1612 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"</pre>
1613
1614
1615
1616 <h3>See also</h3>
1617 <ul>
1618 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
1619 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1620 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1621 </ul>
1622 </div>
1623 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1624 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1625 <table class="directive">
1626 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1627 request</td></tr>
1628 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1629 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1630 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1631 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1632 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1633 </table>
1634     <p>This option tracks additional data per worker about the
1635     currently executing request, and a utilization summary; you
1636     can see these variables during runtime by configuring
1637     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.  Note that other modules may
1638     rely on this scoreboard.</p>
1639
1640     <p>This setting applies to the entire server, and cannot be
1641     enabled or disabled on a virtualhost-by-virtualhost basis.
1642     The collection of extended status information can slow down
1643     the server.  Also note that this setting cannot be changed
1644     during a graceful restart.</p>
1645
1646     <div class="note">
1647     <p>Note that loading <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> will change
1648     the default behavior to ExtendedStatus On, while other
1649     third party modules may do the same.  Such modules rely on
1650     collecting detailed information about the state of all workers.
1651     The default is changed by <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> beginning
1652     with version 2.3.6; the previous default was always Off.</p>
1653     </div>
1654
1655
1656 </div>
1657 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1658 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1659 <table class="directive">
1660 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1661 HTTP response header for static files</td></tr>
1662 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1663 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag MTime Size</code></td></tr>
1664 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1665 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1666 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1667 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1668 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default used to be "INode&nbsp;MTime&nbsp;Size" in 2.3.14 and
1669 earlier.</td></tr>
1670 </table>
1671     <p>
1672     The <code class="directive">FileETag</code> directive configures the file
1673     attributes that are used to create the <code>ETag</code> (entity
1674     tag) response header field when the document is based on a static file.
1675     (The <code>ETag</code> value is used in cache management to save
1676     network bandwidth.) The
1677     <code class="directive">FileETag</code> directive allows you to choose
1678     which of these -- if any -- should be used. The recognized keywords are:
1679     </p>
1680
1681     <dl>
1682      <dt><strong>INode</strong></dt>
1683      <dd>The file's i-node number will be included in the calculation</dd>
1684      <dt><strong>MTime</strong></dt>
1685      <dd>The date and time the file was last modified will be included</dd>
1686      <dt><strong>Size</strong></dt>
1687      <dd>The number of bytes in the file will be included</dd>
1688      <dt><strong>All</strong></dt>
1689      <dd>All available fields will be used. This is equivalent to:
1690          <pre class="prettyprint lang-config">FileETag INode MTime Size</pre>
1691 </dd>
1692      <dt><strong>None</strong></dt>
1693      <dd>If a document is file-based, no <code>ETag</code> field will be
1694        included in the response</dd>
1695     </dl>
1696
1697     <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1698     keywords may be prefixed with either <code>+</code> or <code>-</code>,
1699     which allow changes to be made to the default setting inherited
1700     from a broader scope. Any keyword appearing without such a prefix
1701     immediately and completely cancels the inherited setting.</p>
1702
1703     <p>If a directory's configuration includes
1704     <code>FileETag&nbsp;INode&nbsp;MTime&nbsp;Size</code>, and a
1705     subdirectory's includes <code>FileETag&nbsp;-INode</code>,
1706     the setting for that subdirectory (which will be inherited by
1707     any sub-subdirectories that don't override it) will be equivalent to
1708     <code>FileETag&nbsp;MTime&nbsp;Size</code>.</p>
1709     <div class="warning"><h3>Warning</h3>
1710     Do not change the default for directories or locations that have WebDAV
1711     enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1712     <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>MTime&nbsp;Size</code>
1713     as a fixed format for <code>ETag</code> comparisons on conditional requests.
1714     These conditional requests will break if the <code>ETag</code> format is
1715     changed via <code class="directive">FileETag</code>.
1716     </div>
1717     <div class="note"><h3>Server Side Includes</h3>
1718     An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>,
1719     since the response entity can change without a change of the INode, MTime, or Size
1720     of the static file with embedded SSI directives.
1721     </div>
1722
1723
1724 </div>
1725 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1726 <div class="directive-section"><h2><a name="Files" id="Files">&lt;Files&gt;</a> <a name="files" id="files">Directive</a></h2>
1727 <table class="directive">
1728 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1729 filenames</td></tr>
1730 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Files <var>filename</var>&gt; ... &lt;/Files&gt;</code></td></tr>
1731 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1732 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1733 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1734 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1735 </table>
1736     <p>The <code class="directive">&lt;Files&gt;</code> directive
1737     limits the scope of the enclosed directives by filename. It is comparable
1738     to the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
1739     and <code class="directive"><a href="#location">&lt;Location&gt;</a></code>
1740     directives. It should be matched with a <code>&lt;/Files&gt;</code>
1741     directive. The directives given within this section will be applied to
1742     any object with a basename (last component of filename) matching the
1743     specified filename. <code class="directive">&lt;Files&gt;</code>
1744     sections are processed in the order they appear in the
1745     configuration file, after the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections and
1746     <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location">&lt;Location&gt;</a></code> sections. Note
1747     that <code class="directive">&lt;Files&gt;</code> can be nested
1748     inside <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections to restrict the
1749     portion of the filesystem they apply to.</p>
1750
1751     <p>The <var>filename</var> argument should include a filename, or
1752     a wild-card string, where <code>?</code> matches any single character,
1753     and <code>*</code> matches any sequences of characters.</p>
1754     <pre class="prettyprint lang-config">&lt;Files "cat.html"&gt;
1755     # Insert stuff that applies to cat.html here
1756 &lt;/Files&gt;
1757
1758 &lt;Files "?at.*"&gt;
1759     # This would apply to cat.html, bat.html, hat.php and so on.
1760 &lt;/Files&gt;</pre>
1761
1762     <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1763     can also be used, with the addition of the
1764     <code>~</code> character. For example:</p>
1765
1766     <pre class="prettyprint lang-config">&lt;Files ~ "\.(gif|jpe?g|png)$"&gt;
1767     #...
1768 &lt;/Files&gt;</pre>
1769
1770
1771     <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch">&lt;FilesMatch&gt;</a></code> is preferred,
1772     however.</p>
1773
1774     <p>Note that unlike <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> and <code class="directive"><a href="#location">&lt;Location&gt;</a></code> sections, <code class="directive">&lt;Files&gt;</code> sections can be used inside
1775     <code>.htaccess</code> files. This allows users to control access to
1776     their own files, at a file-by-file level.</p>
1777
1778
1779 <h3>See also</h3>
1780 <ul>
1781 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
1782     and &lt;Files&gt; sections work</a> for an explanation of how these
1783     different sections are combined when a request is received</li>
1784 </ul>
1785 </div>
1786 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1787 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch">&lt;FilesMatch&gt;</a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1788 <table class="directive">
1789 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1790 filenames</td></tr>
1791 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;FilesMatch <var>regex</var>&gt; ... &lt;/FilesMatch&gt;</code></td></tr>
1792 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1793 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1794 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1795 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1796 </table>
1797     <p>The <code class="directive">&lt;FilesMatch&gt;</code> directive
1798     limits the scope of the enclosed directives by filename, just as the
1799     <code class="directive"><a href="#files">&lt;Files&gt;</a></code> directive
1800     does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1801     expression</a>. For example:</p>
1802
1803 <pre class="prettyprint lang-config">&lt;FilesMatch ".+\.(gif|jpe?g|png)$"&gt;
1804     # ...
1805 &lt;/FilesMatch&gt;</pre>
1806
1807
1808     <p>would match most common Internet graphics formats.</p>
1809
1810     <div class="note">The <code>.+</code> at the start of the regex ensures that
1811     files named <code>.png</code>, or <code>.gif</code>, for example,
1812     are not matched.</div>
1813
1814     <p>From 2.4.8 onwards, named groups and backreferences are captured and
1815     written to the environment with the corresponding name prefixed with
1816     "MATCH_" and in upper case. This allows elements of files to be referenced
1817     from within <a href="../expr.html">expressions</a> and modules like
1818     <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
1819     (unnamed) backreferences are ignored. Use named groups instead.</p>
1820
1821 <pre class="prettyprint lang-config">&lt;FilesMatch ^(?&lt;sitename&gt;[^/]+)&gt;
1822     require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1823 &lt;/FilesMatch&gt;</pre>
1824
1825
1826 <h3>See also</h3>
1827 <ul>
1828 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
1829     and &lt;Files&gt; sections work</a> for an explanation of how these
1830     different sections are combined when a request is received</li>
1831 </ul>
1832 </div>
1833 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1834 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1835 <table class="directive">
1836 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1837 media type in the HTTP Content-Type header field</td></tr>
1838 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1839 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1840 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1841 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1842 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1843 </table>
1844     <p>When placed into an <code>.htaccess</code> file or a
1845     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>, or
1846     <code class="directive"><a href="#location">&lt;Location&gt;</a></code> or
1847     <code class="directive"><a href="#files">&lt;Files&gt;</a></code>
1848     section, this directive forces all matching files to be served
1849     with the content type identification given by
1850     <var>media-type</var>. For example, if you had a directory full of
1851     GIF files, but did not want to label them all with <code>.gif</code>,
1852     you might want to use:</p>
1853
1854     <pre class="prettyprint lang-config">ForceType image/gif</pre>
1855
1856
1857     <p>Note that this directive overrides other indirect media type
1858     associations defined in mime.types or via the
1859     <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1860
1861     <p>You can also override more general
1862     <code class="directive">ForceType</code> settings
1863     by using the value of <code>None</code>:</p>
1864
1865     <pre class="prettyprint lang-config"># force all files to be image/gif:
1866 &lt;Location /images&gt;
1867   ForceType image/gif
1868 &lt;/Location&gt;
1869
1870 # but normal mime-type associations here:
1871 &lt;Location /images/mixed&gt;
1872   ForceType None
1873 &lt;/Location&gt;</pre>
1874
1875
1876     <p>This directive primarily overrides the content types generated for
1877     static files served out of the filesystem.  For resources other than
1878     static files, where the generator of the response typically specifies
1879     a Content-Type, this directive has no effect.</p>
1880
1881
1882 </div>
1883 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1884 <div class="directive-section"><h2><a name="GprofDir" id="GprofDir">GprofDir</a> <a name="gprofdir" id="gprofdir">Directive</a></h2>
1885 <table class="directive">
1886 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory to write gmon.out profiling data to.  </td></tr>
1887 <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>
1888 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1889 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1890 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1891 </table>
1892     <p>When the server has been compiled with gprof profiling support,
1893     <code class="directive">GprofDir</code> causes <code>gmon.out</code> files to
1894     be written to the specified directory when the process exits.  If the
1895     argument ends with a percent symbol ('%'), subdirectories are created
1896     for each process id.</p>
1897
1898     <p>This directive currently only works with the <code class="module"><a href="../mod/prefork.html">prefork</a></code>
1899     MPM.</p>
1900
1901 </div>
1902 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1903 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1904 <table class="directive">
1905 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1906 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1907 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1908 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1909 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1910 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1911 </table>
1912     <p>This directive enables DNS lookups so that host names can be
1913     logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1914     The value <code>Double</code> refers to doing double-reverse
1915     DNS lookup. That is, after a reverse lookup is performed, a forward
1916     lookup is then performed on that result. At least one of the IP
1917     addresses in the forward lookup must match the original
1918     address. (In "tcpwrappers" terminology this is called
1919     <code>PARANOID</code>.)</p>
1920
1921     <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1922     used for controlling access by hostname, a double reverse lookup
1923     will be performed.  This is necessary for security. Note that the
1924     result of this double-reverse isn't generally available unless you
1925     set <code>HostnameLookups Double</code>. For example, if only
1926     <code>HostnameLookups On</code> and a request is made to an object
1927     that is protected by hostname restrictions, regardless of whether
1928     the double-reverse fails or not, CGIs will still be passed the
1929     single-reverse result in <code>REMOTE_HOST</code>.</p>
1930
1931     <p>The default is <code>Off</code> in order to save the network
1932     traffic for those sites that don't truly need the reverse
1933     lookups done. It is also better for the end users because they
1934     don't have to suffer the extra latency that a lookup entails.
1935     Heavily loaded sites should leave this directive
1936     <code>Off</code>, since DNS lookups can take considerable
1937     amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1938     default to the <code>bin</code> subdirectory of your installation
1939     directory, can be used to look up host names from logged IP addresses
1940     offline.</p>
1941
1942     <p>Finally, if you have <a href="mod_authz_host.html#reqhost">hostname-based Require
1943     directives</a>, a hostname lookup will be performed regardless of
1944     the setting of <code>HostnameLookups</code>.</p>
1945
1946 </div>
1947 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1948 <div class="directive-section"><h2><a name="If" id="If">&lt;If&gt;</a> <a name="if" id="if">Directive</a></h2>
1949 <table class="directive">
1950 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1951 satisfied by a request at runtime</td></tr>
1952 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;If <var>expression</var>&gt; ... &lt;/If&gt;</code></td></tr>
1953 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1954 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1955 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1956 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1957 </table>
1958     <p>The <code class="directive">&lt;If&gt;</code> directive
1959     evaluates an expression at runtime, and applies the enclosed
1960     directives if and only if the expression evaluates to true.
1961     For example:</p>
1962
1963     <pre class="prettyprint lang-config">&lt;If "-z req('Host')"&gt;</pre>
1964
1965
1966     <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1967     Expressions may contain various shell-like operators for string
1968     comparison (<code>==</code>, <code>!=</code>, <code>&lt;</code>, ...),
1969     integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1970     and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1971     It is also possible to use regular expressions, </p>
1972
1973     <pre class="prettyprint lang-config">&lt;If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"&gt;</pre>
1974
1975
1976     <p>shell-like pattern matches and many other operations. These operations
1977     can be done on request headers (<code>req</code>), environment variables
1978     (<code>env</code>), and a large number of other properties. The full
1979     documentation is available in <a href="../expr.html">Expressions in
1980     Apache HTTP Server</a>.</p>
1981
1982     <p>Only directives that support the <a href="directive-dict.html#Context">directory context</a> can be used within this configuration section.</p>
1983
1984     <div class="warning">
1985     Certain variables, such as <code>CONTENT_TYPE</code> and other
1986     response headers, are set after &lt;If&gt; conditions have already
1987     been evaluated, and so will not be available to use in this
1988     directive.
1989     </div>
1990
1991
1992 <h3>See also</h3>
1993 <ul>
1994 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1995 for a complete reference and more examples.</li>
1996 <li><code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code></li>
1997 <li><code class="directive"><a href="#else">&lt;Else&gt;</a></code></li>
1998 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
1999     &lt;Files&gt; sections work</a> for an explanation of how these
2000     different sections are combined when a request is received.
2001     <code class="directive">&lt;If&gt;</code>,
2002     <code class="directive">&lt;ElseIf&gt;</code>, and
2003     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
2004 </ul>
2005 </div>
2006 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2007 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine">&lt;IfDefine&gt;</a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
2008 <table class="directive">
2009 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
2010 if a test is true at startup</td></tr>
2011 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;IfDefine [!]<var>parameter-name</var>&gt; ...
2012     &lt;/IfDefine&gt;</code></td></tr>
2013 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2014 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2015 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2016 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2017 </table>
2018     <p>The <code>&lt;IfDefine <var>test</var>&gt;...&lt;/IfDefine&gt;
2019     </code> section is used to mark directives that are conditional. The
2020     directives within an <code class="directive">&lt;IfDefine&gt;</code>
2021     section are only processed if the <var>test</var> is true. If <var>
2022     test</var> is false, everything between the start and end markers is
2023     ignored.</p>
2024
2025     <p>The <var>test</var> in the <code class="directive">&lt;IfDefine&gt;</code> section directive can be one of two forms:</p>
2026
2027     <ul>
2028       <li><var>parameter-name</var></li>
2029
2030       <li><code>!</code><var>parameter-name</var></li>
2031     </ul>
2032
2033     <p>In the former case, the directives between the start and end
2034     markers are only processed if the parameter named
2035     <var>parameter-name</var> is defined. The second format reverses
2036     the test, and only processes the directives if
2037     <var>parameter-name</var> is <strong>not</strong> defined.</p>
2038
2039     <p>The <var>parameter-name</var> argument is a define as given on the
2040     <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
2041     </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
2042
2043     <p><code class="directive">&lt;IfDefine&gt;</code> sections are
2044     nest-able, which can be used to implement simple
2045     multiple-parameter tests. Example:</p>
2046
2047     <div class="example"><p><code>httpd -DReverseProxy -DUseCache -DMemCache ...</code></p></div>
2048     <pre class="prettyprint lang-config">&lt;IfDefine ReverseProxy&gt;
2049   LoadModule proxy_module   modules/mod_proxy.so
2050   LoadModule proxy_http_module   modules/mod_proxy_http.so
2051   &lt;IfDefine UseCache&gt;
2052     LoadModule cache_module   modules/mod_cache.so
2053     &lt;IfDefine MemCache&gt;
2054       LoadModule mem_cache_module   modules/mod_mem_cache.so
2055     &lt;/IfDefine&gt;
2056     &lt;IfDefine !MemCache&gt;
2057       LoadModule cache_disk_module   modules/mod_cache_disk.so
2058     &lt;/IfDefine&gt;
2059   &lt;/IfDefine&gt;
2060 &lt;/IfDefine&gt;</pre>
2061
2062
2063 </div>
2064 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2065 <div class="directive-section"><h2><a name="IfModule" id="IfModule">&lt;IfModule&gt;</a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
2066 <table class="directive">
2067 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2068 presence or absence of a specific module</td></tr>
2069 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;IfModule [!]<var>module-file</var>|<var>module-identifier</var>&gt; ...
2070     &lt;/IfModule&gt;</code></td></tr>
2071 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2072 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2073 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2074 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2075 </table>
2076     <p>The <code>&lt;IfModule <var>test</var>&gt;...&lt;/IfModule&gt;</code>
2077     section is used to mark directives that are conditional on the presence of
2078     a specific module. The directives within an <code class="directive">&lt;IfModule&gt;</code> section are only processed if the <var>test</var>
2079     is true. If <var>test</var> is false, everything between the start and
2080     end markers is ignored.</p>
2081
2082     <p>The <var>test</var> in the <code class="directive">&lt;IfModule&gt;</code> section directive can be one of two forms:</p>
2083
2084     <ul>
2085       <li><var>module</var></li>
2086
2087       <li>!<var>module</var></li>
2088     </ul>
2089
2090     <p>In the former case, the directives between the start and end
2091     markers are only processed if the module named <var>module</var>
2092     is included in Apache httpd -- either compiled in or
2093     dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
2094     and only processes the directives if <var>module</var> is
2095     <strong>not</strong> included.</p>
2096
2097     <p>The <var>module</var> argument can be either the module identifier or
2098     the file name of the module, at the time it was compiled.  For example,
2099     <code>rewrite_module</code> is the identifier and
2100     <code>mod_rewrite.c</code> is the file name. If a module consists of
2101     several source files, use the name of the file containing the string
2102     <code>STANDARD20_MODULE_STUFF</code>.</p>
2103
2104     <p><code class="directive">&lt;IfModule&gt;</code> sections are
2105     nest-able, which can be used to implement simple multiple-module
2106     tests.</p>
2107
2108     <div class="note">This section should only be used if you need to have one
2109     configuration file that works whether or not a specific module
2110     is available. In normal operation, directives need not be
2111     placed in <code class="directive">&lt;IfModule&gt;</code>
2112     sections.</div>
2113
2114 </div>
2115 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2116 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
2117 <table class="directive">
2118 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2119 the server configuration files</td></tr>
2120 <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>
2121 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2122 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2123 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2124 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Directory
2125 wildcard matching available in 2.3.6 and later</td></tr>
2126 </table>
2127     <p>This directive allows inclusion of other configuration files
2128     from within the server configuration files.</p>
2129
2130     <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2131     in the filename or directory parts of the path to include several files
2132     at once, in alphabetical order. In addition, if
2133     <code class="directive">Include</code> points to a directory, rather than a file,
2134     Apache httpd will read all files in that directory and any subdirectory.
2135     However, including entire directories is not recommended, because it is
2136     easy to accidentally leave temporary files in a directory that can cause
2137     <code class="program"><a href="../programs/httpd.html">httpd</a></code> to fail. Instead, we encourage you to use the
2138     wildcard syntax shown below, to include files that match a particular
2139     pattern, such as *.conf, for example.</p>
2140
2141     <p>The <code class="directive"><a href="#include">Include</a></code> directive will
2142     <strong>fail with an error</strong> if a wildcard expression does not
2143     match any file. The <code class="directive"><a href="#includeoptional">IncludeOptional</a></code>
2144     directive can be used if non-matching wildcards should be ignored.</p>
2145
2146     <p>The file path specified may be an absolute path, or may be relative
2147     to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
2148
2149     <p>Examples:</p>
2150
2151     <pre class="prettyprint lang-config">Include /usr/local/apache2/conf/ssl.conf
2152 Include /usr/local/apache2/conf/vhosts/*.conf</pre>
2153
2154
2155     <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
2156
2157     <pre class="prettyprint lang-config">Include conf/ssl.conf
2158 Include conf/vhosts/*.conf</pre>
2159
2160
2161     <p>Wildcards may be included in the directory or file portion of the
2162     path. This example will fail if there is no subdirectory in conf/vhosts
2163     that contains at least one *.conf file:</p>
2164
2165     <pre class="prettyprint lang-config">Include conf/vhosts/*/*.conf</pre>
2166
2167
2168     <p>Alternatively, the following command will just be ignored in case of
2169     missing files or directories:</p>
2170
2171     <pre class="prettyprint lang-config">IncludeOptional conf/vhosts/*/*.conf</pre>
2172
2173
2174
2175 <h3>See also</h3>
2176 <ul>
2177 <li><code class="directive"><a href="#includeoptional">IncludeOptional</a></code></li>
2178 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2179 </ul>
2180 </div>
2181 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2182 <div class="directive-section"><h2><a name="IncludeOptional" id="IncludeOptional">IncludeOptional</a> <a name="includeoptional" id="includeoptional">Directive</a></h2>
2183 <table class="directive">
2184 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2185 the server configuration files</td></tr>
2186 <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>
2187 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2188 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2189 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2190 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in 2.3.6 and later</td></tr>
2191 </table>
2192     <p>This directive allows inclusion of other configuration files
2193     from within the server configuration files. It works identically to the
2194     <code class="directive"><a href="#include">Include</a></code> directive, with the
2195     exception that if wildcards do not match any file or directory, the
2196     <code class="directive"><a href="#includeoptional">IncludeOptional</a></code> directive will be
2197     silently ignored instead of causing an error.</p>
2198
2199 <h3>See also</h3>
2200 <ul>
2201 <li><code class="directive"><a href="#include">Include</a></code></li>
2202 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2203 </ul>
2204 </div>
2205 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2206 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
2207 <table class="directive">
2208 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
2209 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
2210 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
2211 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2212 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2213 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2214 </table>
2215     <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2216     connection feature of HTTP/1.1 provide long-lived HTTP sessions
2217     which allow multiple requests to be sent over the same TCP
2218     connection. In some cases this has been shown to result in an
2219     almost 50% speedup in latency times for HTML documents with
2220     many images. To enable Keep-Alive connections, set
2221     <code>KeepAlive On</code>.</p>
2222
2223     <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2224     used if they are specifically requested by a client. In
2225     addition, a Keep-Alive connection with an HTTP/1.0 client can
2226     only be used when the length of the content is known in
2227     advance. This implies that dynamic content such as CGI output,
2228     SSI pages, and server-generated directory listings will
2229     generally not use Keep-Alive connections to HTTP/1.0 clients.
2230     For HTTP/1.1 clients, persistent connections are the default
2231     unless otherwise specified. If the client requests it, chunked
2232     encoding will be used in order to send content of unknown
2233     length over persistent connections.</p>
2234
2235     <p>When a client uses a Keep-Alive connection it will be counted
2236     as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> directive, regardless
2237     of how many requests are sent using the connection.</p>
2238
2239 <h3>See also</h3>
2240 <ul>
2241 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
2242 </ul>
2243 </div>
2244 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2245 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
2246 <table class="directive">
2247 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
2248 requests on a persistent connection</td></tr>
2249 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
2250 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
2251 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2252 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2253 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2254 </table>
2255     <p>The number of seconds Apache httpd will wait for a subsequent
2256     request before closing the connection. By adding a postfix of ms the
2257     timeout can be also set in milliseconds. Once a request has been
2258     received, the timeout value specified by the
2259     <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
2260
2261     <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
2262     may cause performance problems in heavily loaded servers. The
2263     higher the timeout, the more server processes will be kept
2264     occupied waiting on connections with idle clients.</p>
2265
2266     <p>If <code class="directive">KeepAliveTimeout</code> is <strong>not</strong>
2267     set for a name-based virtual host, the value of the first defined
2268     virtual host best matching the local IP and port will be used.</p>
2269
2270 </div>
2271 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2272 <div class="directive-section"><h2><a name="Limit" id="Limit">&lt;Limit&gt;</a> <a name="limit" id="limit">Directive</a></h2>
2273 <table class="directive">
2274 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
2275 methods</td></tr>
2276 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Limit <var>method</var> [<var>method</var>] ... &gt; ...
2277     &lt;/Limit&gt;</code></td></tr>
2278 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2279 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</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>
2282 </table>
2283     <p>Access controls are normally effective for
2284     <strong>all</strong> access methods, and this is the usual
2285     desired behavior. <strong>In the general case, access control
2286     directives should not be placed within a
2287     <code class="directive">&lt;Limit&gt;</code> section.</strong></p>
2288
2289     <p>The purpose of the <code class="directive">&lt;Limit&gt;</code>
2290     directive is to restrict the effect of the access controls to the
2291     nominated HTTP methods. For all other methods, the access
2292     restrictions that are enclosed in the <code class="directive">&lt;Limit&gt;</code> bracket <strong>will have no
2293     effect</strong>. The following example applies the access control
2294     only to the methods <code>POST</code>, <code>PUT</code>, and
2295     <code>DELETE</code>, leaving all other methods unprotected:</p>
2296
2297     <pre class="prettyprint lang-config">&lt;Limit POST PUT DELETE&gt;
2298   Require valid-user
2299 &lt;/Limit&gt;</pre>
2300
2301
2302     <p>The method names listed can be one or more of: <code>GET</code>,
2303     <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2304     <code>CONNECT</code>, <code>OPTIONS</code>,
2305     <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2306     <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2307     <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2308     case-sensitive.</strong> If <code>GET</code> is used it will also
2309     restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2310     cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
2311
2312     <div class="warning">A <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section should always be
2313     used in preference to a <code class="directive">&lt;Limit&gt;</code>
2314     section when restricting access, since a <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section provides protection
2315     against arbitrary methods.</div>
2316
2317     <p>The <code class="directive">&lt;Limit&gt;</code> and
2318     <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code>
2319     directives may be nested.  In this case, each successive level of
2320     <code class="directive">&lt;Limit&gt;</code> or <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> directives must
2321     further restrict the set of methods to which access controls apply.</p>
2322
2323     <div class="warning">When using
2324     <code class="directive">&lt;Limit&gt;</code> or
2325     <code class="directive">&lt;LimitExcept&gt;</code> directives with
2326     the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
2327     note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
2328     to succeed authorizes the request, regardless of the presence of other
2329     <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
2330
2331     <p>For example, given the following configuration, all users will
2332     be authorized for <code>POST</code> requests, and the
2333     <code>Require group editors</code> directive will be ignored
2334     in all cases:</p>
2335
2336     <pre class="prettyprint lang-config">&lt;LimitExcept GET&gt;
2337   Require valid-user
2338 &lt;/LimitExcept&gt;
2339 &lt;Limit POST&gt;
2340   Require group editors
2341 &lt;/Limit&gt;</pre>
2342
2343
2344 </div>
2345 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2346 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept">&lt;LimitExcept&gt;</a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
2347 <table class="directive">
2348 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
2349 except the named ones</td></tr>
2350 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;LimitExcept <var>method</var> [<var>method</var>] ... &gt; ...
2351     &lt;/LimitExcept&gt;</code></td></tr>
2352 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2353 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2354 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2355 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2356 </table>
2357     <p><code class="directive">&lt;LimitExcept&gt;</code> and
2358     <code>&lt;/LimitExcept&gt;</code> are used to enclose
2359     a group of access control directives which will then apply to any
2360     HTTP access method <strong>not</strong> listed in the arguments;
2361     i.e., it is the opposite of a <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> section and can be used to control
2362     both standard and nonstandard/unrecognized methods. See the
2363     documentation for <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> for more details.</p>
2364
2365     <p>For example:</p>
2366
2367     <pre class="prettyprint lang-config">&lt;LimitExcept POST GET&gt;
2368   Require valid-user
2369 &lt;/LimitExcept&gt;</pre>
2370
2371
2372
2373 </div>
2374 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2375 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
2376 <table class="directive">
2377 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
2378 subrequests</td></tr>
2379 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
2380 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
2381 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</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>
2384 </table>
2385     <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
2386     redirects the original request to a CGI script. A subrequest is Apache httpd's
2387     mechanism to find out what would happen for some URI if it were requested.
2388     For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
2389     files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2390     directive.</p>
2391
2392     <p><code class="directive">LimitInternalRecursion</code> prevents the server
2393     from crashing when entering an infinite loop of internal redirects or
2394     subrequests. Such loops are usually caused by misconfigurations.</p>
2395
2396     <p>The directive stores two different limits, which are evaluated on
2397     per-request basis. The first <var>number</var> is the maximum number of
2398     internal redirects, that may follow each other. The second <var>number</var>
2399     determines, how deep subrequests may be nested. If you specify only one
2400     <var>number</var>, it will be assigned to both limits.</p>
2401
2402     <pre class="prettyprint lang-config">LimitInternalRecursion 5</pre>
2403
2404
2405 </div>
2406 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2407 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
2408 <table class="directive">
2409 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
2410 from the client</td></tr>
2411 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
2412 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
2413 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2414 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2415 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2416 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2417 </table>
2418     <p>This directive specifies the number of <var>bytes</var> from 0
2419     (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2420     request body. See the note below for the limited applicability
2421     to proxy requests.</p>
2422
2423     <p>The <code class="directive">LimitRequestBody</code> directive allows
2424     the user to set a limit on the allowed size of an HTTP request
2425     message body within the context in which the directive is given
2426     (server, per-directory, per-file or per-location). If the client
2427     request exceeds that limit, the server will return an error
2428     response instead of servicing the request. The size of a normal
2429     request message body will vary greatly depending on the nature of
2430     the resource and the methods allowed on that resource. CGI scripts
2431     typically use the message body for retrieving form information.
2432     Implementations of the <code>PUT</code> method will require
2433     a value at least as large as any representation that the server
2434     wishes to accept for that resource.</p>
2435
2436     <p>This directive gives the server administrator greater
2437     control over abnormal client request behavior, which may be
2438     useful for avoiding some forms of denial-of-service
2439     attacks.</p>
2440
2441     <p>If, for example, you are permitting file upload to a particular
2442     location, and wish to limit the size of the uploaded file to 100K,
2443     you might use the following directive:</p>
2444
2445     <pre class="prettyprint lang-config">LimitRequestBody 102400</pre>
2446
2447
2448     <div class="note"><p>For a full description of how this directive is interpreted by
2449     proxy requests, see the <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> documentation.</p>
2450     </div>
2451
2452
2453 </div>
2454 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2455 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
2456 <table class="directive">
2457 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
2458 will be accepted from the client</td></tr>
2459 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
2460 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
2461 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2462 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2463 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2464 </table>
2465     <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2466     32767. The default value is defined by the compile-time
2467     constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2468     distributed).</p>
2469
2470     <p>The <code class="directive">LimitRequestFields</code> directive allows
2471     the server administrator to modify the limit on the number of
2472     request header fields allowed in an HTTP request. A server needs
2473     this value to be larger than the number of fields that a normal
2474     client request might include. The number of request header fields
2475     used by a client rarely exceeds 20, but this may vary among
2476     different client implementations, often depending upon the extent
2477     to which a user has configured their browser to support detailed
2478     content negotiation. Optional HTTP extensions are often expressed
2479     using request header fields.</p>
2480
2481     <p>This directive gives the server administrator greater
2482     control over abnormal client request behavior, which may be
2483     useful for avoiding some forms of denial-of-service attacks.
2484     The value should be increased if normal clients see an error
2485     response from the server that indicates too many fields were
2486     sent in the request.</p>
2487
2488     <p>For example:</p>
2489
2490     <pre class="prettyprint lang-config">LimitRequestFields 50</pre>
2491
2492
2493      <div class="warning"><h3>Warning</h3>
2494      <p> When name-based virtual hosting is used, the value for this
2495      directive is taken from the default (first-listed) virtual host for the
2496      local IP and port combination.</p>
2497      </div>
2498
2499
2500 </div>
2501 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2502 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
2503 <table class="directive">
2504 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
2505 client</td></tr>
2506 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
2507 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
2508 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2509 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2510 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2511 </table>
2512     <p>This directive specifies the number of <var>bytes</var>
2513     that will be allowed in an HTTP request header.</p>
2514
2515     <p>The <code class="directive">LimitRequestFieldSize</code> directive
2516     allows the server administrator to set the limit
2517     on the allowed size of an HTTP request header field. A server
2518     needs this value to be large enough to hold any one header field
2519     from a normal client request. The size of a normal request header
2520     field will vary greatly among different client implementations,
2521     often depending upon the extent to which a user has configured
2522     their browser to support detailed content negotiation. SPNEGO
2523     authentication headers can be up to 12392 bytes.</p>
2524
2525     <p>This directive gives the server administrator greater
2526     control over abnormal client request behavior, which may be
2527     useful for avoiding some forms of denial-of-service attacks.</p>
2528
2529     <p>For example:</p>
2530
2531     <pre class="prettyprint lang-config">LimitRequestFieldSize 4094</pre>
2532
2533
2534     <div class="note">Under normal conditions, the value should not be changed from
2535     the default.</div>
2536
2537     <div class="warning"><h3>Warning</h3>
2538     <p> When name-based virtual hosting is used, the value for this
2539     directive is taken from the default (first-listed) virtual host best
2540     matching the current IP address and port combination.</p>
2541     </div>
2542
2543 </div>
2544 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2545 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
2546 <table class="directive">
2547 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
2548 from the client</td></tr>
2549 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
2550 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
2551 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2552 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2553 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2554 </table>
2555     <p>This directive sets the number of <var>bytes</var> that will be
2556     allowed on the HTTP request-line.</p>
2557
2558     <p>The <code class="directive">LimitRequestLine</code> directive allows
2559     the server administrator to set the limit on the allowed size
2560     of a client's HTTP request-line. Since the request-line consists of the
2561     HTTP method, URI, and protocol version, the
2562     <code class="directive">LimitRequestLine</code> directive places a
2563     restriction on the length of a request-URI allowed for a request
2564     on the server. A server needs this value to be large enough to
2565     hold any of its resource names, including any information that
2566     might be passed in the query part of a <code>GET</code> request.</p>
2567
2568     <p>This directive gives the server administrator greater
2569     control over abnormal client request behavior, which may be
2570     useful for avoiding some forms of denial-of-service attacks.</p>
2571
2572     <p>For example:</p>
2573
2574     <pre class="prettyprint lang-config">LimitRequestLine 4094</pre>
2575
2576
2577     <div class="note">Under normal conditions, the value should not be changed from
2578     the default.</div>
2579
2580     <div class="warning"><h3>Warning</h3>
2581     <p> When name-based virtual hosting is used, the value for this
2582     directive is taken from the default (first-listed) virtual host best
2583     matching the current IP address and port combination.</p>
2584     </div>
2585
2586
2587 </div>
2588 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2589 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
2590 <table class="directive">
2591 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
2592 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
2593 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
2594 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2595 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2596 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2597 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2598 </table>
2599     <p>Limit (in bytes) on maximum size of an XML-based request
2600     body. A value of <code>0</code> will disable any checking.</p>
2601
2602     <p>Example:</p>
2603
2604     <pre class="prettyprint lang-config">LimitXMLRequestBody 0</pre>
2605
2606
2607
2608 </div>
2609 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2610 <div class="directive-section"><h2><a name="Location" id="Location">&lt;Location&gt;</a> <a name="location" id="location">Directive</a></h2>
2611 <table class="directive">
2612 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2613 URLs</td></tr>
2614 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Location
2615     <var>URL-path</var>|<var>URL</var>&gt; ... &lt;/Location&gt;</code></td></tr>
2616 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2617 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2618 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2619 </table>
2620     <p>The <code class="directive">&lt;Location&gt;</code> directive
2621     limits the scope of the enclosed directives by URL. It is similar to the
2622     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
2623     directive, and starts a subsection which is terminated with a
2624     <code>&lt;/Location&gt;</code> directive. <code class="directive">&lt;Location&gt;</code> sections are processed in the
2625     order they appear in the configuration file, after the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections and
2626     <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files">&lt;Files&gt;</a></code> sections.</p>
2627
2628     <p><code class="directive">&lt;Location&gt;</code> sections operate
2629     completely outside the filesystem.  This has several consequences.
2630     Most importantly, <code class="directive">&lt;Location&gt;</code>
2631     directives should not be used to control access to filesystem
2632     locations.  Since several different URLs may map to the same
2633     filesystem location, such access controls may by circumvented.</p>
2634
2635     <p>The enclosed directives will be applied to the request if the path component
2636     of the URL meets <em>any</em> of the following criteria:
2637     </p>
2638     <ul>
2639       <li>The specified location matches exactly the path component of the URL.
2640       </li>
2641       <li>The specified location, which ends in a forward slash, is a prefix
2642       of the path component of the URL (treated as a context root).
2643       </li>
2644       <li>The specified location, with the addition of a trailing slash, is a
2645       prefix of the path component of the URL (also treated as a context root).
2646       </li>
2647     </ul>
2648     <p>
2649     In the example below, where no trailing slash is used, requests to
2650     /private1, /private1/ and /private1/file.txt will have the enclosed
2651     directives applied, but /private1other would not.
2652     </p>
2653     <pre class="prettyprint lang-config">&lt;Location /private1&gt;
2654     #  ...
2655 &lt;/Location&gt;</pre>
2656
2657     <p>
2658     In the example below, where a trailing slash is used, requests to
2659     /private2/ and /private2/file.txt will have the enclosed
2660     directives applied, but /private2 and /private2other would not.
2661     </p>
2662     <pre class="prettyprint lang-config">&lt;Location /private2<em>/</em>&gt;
2663     # ...
2664 &lt;/Location&gt;</pre>
2665
2666
2667     <div class="note"><h3>When to use <code class="directive">&lt;Location&gt;</code></h3>
2668
2669     <p>Use <code class="directive">&lt;Location&gt;</code> to apply
2670     directives to content that lives outside the filesystem.  For
2671     content that lives in the filesystem, use <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> and <code class="directive"><a href="#files">&lt;Files&gt;</a></code>.  An exception is
2672     <code>&lt;Location /&gt;</code>, which is an easy way to
2673     apply a configuration to the entire server.</p>
2674     </div>
2675
2676     <p>For all origin (non-proxy) requests, the URL to be matched is a
2677     URL-path of the form <code>/path/</code>.  <em>No scheme, hostname,
2678     port, or query string may be included.</em>  For proxy requests, the
2679     URL to be matched is of the form
2680     <code>scheme://servername/path</code>, and you must include the
2681     prefix.</p>
2682
2683     <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2684     any single character, and <code>*</code> matches any sequences of
2685     characters. Neither wildcard character matches a / in the URL-path.</p>
2686
2687     <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
2688     can also be used, with the addition of the <code>~</code>
2689     character. For example:</p>
2690
2691     <pre class="prettyprint lang-config">&lt;Location ~ "/(extra|special)/data"&gt;
2692     #...
2693 &lt;/Location&gt;</pre>
2694
2695
2696     <p>would match URLs that contained the substring <code>/extra/data</code>
2697     or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch">&lt;LocationMatch&gt;</a></code> behaves
2698     identical to the regex version of <code class="directive">&lt;Location&gt;</code>, and is preferred, for the
2699     simple reason that <code>~</code> is hard to distinguish from
2700     <code>-</code> in many fonts.</p>
2701
2702     <p>The <code class="directive">&lt;Location&gt;</code>
2703     functionality is especially useful when combined with the
2704     <code class="directive"><a href="#sethandler">SetHandler</a></code>
2705     directive. For example, to enable status requests, but allow them
2706     only from browsers at <code>example.com</code>, you might use:</p>
2707
2708     <pre class="prettyprint lang-config">&lt;Location /status&gt;
2709   SetHandler server-status
2710   Require host example.com
2711 &lt;/Location&gt;</pre>
2712
2713
2714     <div class="note"><h3>Note about / (slash)</h3>
2715       <p>The slash character has special meaning depending on where in a
2716       URL it appears. People may be used to its behavior in the filesystem
2717       where multiple adjacent slashes are frequently collapsed to a single
2718       slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2719       <code>/home/foo</code>). In URL-space this is not necessarily true.
2720       The <code class="directive"><a href="#locationmatch">&lt;LocationMatch&gt;</a></code>
2721       directive and the regex version of <code class="directive">&lt;Location&gt;</code> require you to explicitly specify multiple
2722       slashes if that is your intention.</p>
2723
2724       <p>For example, <code>&lt;LocationMatch ^/abc&gt;</code> would match
2725       the request URL <code>/abc</code> but not the request URL <code>
2726       //abc</code>. The (non-regex) <code class="directive">&lt;Location&gt;</code> directive behaves similarly when used for
2727       proxy requests. But when (non-regex) <code class="directive">&lt;Location&gt;</code> is used for non-proxy requests it will
2728       implicitly match multiple slashes with a single slash. For example,
2729       if you specify <code>&lt;Location /abc/def&gt;</code> and the
2730       request is to <code>/abc//def</code> then it will match.</p>
2731     </div>
2732
2733 <h3>See also</h3>
2734 <ul>
2735 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
2736     and &lt;Files&gt; sections work</a> for an explanation of how these
2737     different sections are combined when a request is received.</li>
2738 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
2739 </ul>
2740 </div>
2741 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2742 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch">&lt;LocationMatch&gt;</a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2743 <table class="directive">
2744 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2745 matching URLs</td></tr>
2746 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;LocationMatch
2747     <var>regex</var>&gt; ... &lt;/LocationMatch&gt;</code></td></tr>
2748 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2749 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2750 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2751 </table>
2752     <p>The <code class="directive">&lt;LocationMatch&gt;</code> directive
2753     limits the scope of the enclosed directives by URL, in an identical manner
2754     to <code class="directive"><a href="#location">&lt;Location&gt;</a></code>. However,
2755     it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2756     as an argument instead of a simple string. For example:</p>
2757
2758     <pre class="prettyprint lang-config">&lt;LocationMatch "/(extra|special)/data"&gt;
2759     # ...
2760 &lt;/LocationMatch&gt;</pre>
2761
2762
2763     <p>would match URLs that contained the substring <code>/extra/data</code>
2764     or <code>/special/data</code>.</p>
2765
2766     <div class="note"><p>If the intent is that a URL <strong>starts with</strong>
2767     <code>/extra/data</code>, rather than merely
2768     <strong>contains</strong> <code>/extra/data</code>, prefix the
2769     regular expression with a <code>^</code> to require this.</p>
2770
2771     <pre class="prettyprint lang-config">&lt;LocationMatch "^/(extra|special)/data"&gt;</pre>
2772
2773     </div>
2774
2775     <p>From 2.4.8 onwards, named groups and backreferences are captured and
2776     written to the environment with the corresponding name prefixed with
2777     "MATCH_" and in upper case. This allows elements of URLs to be referenced
2778     from within <a href="../expr.html">expressions</a> and modules like
2779     <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
2780     (unnamed) backreferences are ignored. Use named groups instead.</p>
2781
2782 <pre class="prettyprint lang-config">&lt;LocationMatch ^/combined/(?&lt;sitename&gt;[^/]+)&gt;
2783     require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
2784 &lt;/LocationMatch&gt;</pre>
2785
2786
2787 <h3>See also</h3>
2788 <ul>
2789 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
2790     and &lt;Files&gt; sections work</a> for an explanation of how these
2791     different sections are combined when a request is received</li>
2792 </ul>
2793 </div>
2794 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2795 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2796 <table class="directive">
2797 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2798 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel [<var>module</var>:]<var>level</var>
2799     [<var>module</var>:<var>level</var>] ...
2800 </code></td></tr>
2801 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2802 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2803 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2804 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2805 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Per-module and per-directory configuration is available in
2806     Apache HTTP Server 2.3.6 and later</td></tr>
2807 </table>
2808     <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2809     messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2810     <var>level</var>s are available, in order of decreasing
2811     significance:</p>
2812
2813     <table class="bordered">
2814     
2815       <tr>
2816         <th><strong>Level</strong> </th>
2817
2818         <th><strong>Description</strong> </th>
2819
2820         <th><strong>Example</strong> </th>
2821       </tr>
2822
2823       <tr>
2824         <td><code>emerg</code> </td>
2825
2826         <td>Emergencies - system is unusable.</td>
2827
2828         <td>"Child cannot open lock file. Exiting"</td>
2829       </tr>
2830
2831       <tr>
2832         <td><code>alert</code> </td>
2833
2834         <td>Action must be taken immediately.</td>
2835
2836         <td>"getpwuid: couldn't determine user name from uid"</td>
2837       </tr>
2838
2839       <tr>
2840         <td><code>crit</code> </td>
2841
2842         <td>Critical Conditions.</td>
2843
2844         <td>"socket: Failed to get a socket, exiting child"</td>
2845       </tr>
2846
2847       <tr>
2848         <td><code>error</code> </td>
2849
2850         <td>Error conditions.</td>
2851
2852         <td>"Premature end of script headers"</td>
2853       </tr>
2854
2855       <tr>
2856         <td><code>warn</code> </td>
2857
2858         <td>Warning conditions.</td>
2859
2860         <td>"child process 1234 did not exit, sending another
2861         SIGHUP"</td>
2862       </tr>
2863
2864       <tr>
2865         <td><code>notice</code> </td>
2866
2867         <td>Normal but significant condition.</td>
2868
2869         <td>"httpd: caught SIGBUS, attempting to dump core in
2870         ..."</td>
2871       </tr>
2872
2873       <tr>
2874         <td><code>info</code> </td>
2875
2876         <td>Informational.</td>
2877
2878         <td>"Server seems busy, (you may need to increase
2879         StartServers, or Min/MaxSpareServers)..."</td>
2880       </tr>
2881
2882       <tr>
2883         <td><code>debug</code> </td>
2884
2885         <td>Debug-level messages</td>
2886
2887         <td>"Opening config file ..."</td>
2888       </tr>
2889       <tr>
2890         <td><code>trace1</code> </td>
2891
2892         <td>Trace messages</td>
2893
2894         <td>"proxy: FTP: control connection complete"</td>
2895       </tr>
2896       <tr>
2897         <td><code>trace2</code> </td>
2898
2899         <td>Trace messages</td>
2900
2901         <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2902       </tr>
2903       <tr>
2904         <td><code>trace3</code> </td>
2905
2906         <td>Trace messages</td>
2907
2908         <td>"openssl: Handshake: start"</td>
2909       </tr>
2910       <tr>
2911         <td><code>trace4</code> </td>
2912
2913         <td>Trace messages</td>
2914
2915         <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2916       </tr>
2917       <tr>
2918         <td><code>trace5</code> </td>
2919
2920         <td>Trace messages</td>
2921
2922         <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2923       </tr>
2924       <tr>
2925         <td><code>trace6</code> </td>
2926
2927         <td>Trace messages</td>
2928
2929         <td>"cache lookup FAILED, forcing new map lookup"</td>
2930       </tr>
2931       <tr>
2932         <td><code>trace7</code> </td>
2933
2934         <td>Trace messages, dumping large amounts of data</td>
2935
2936         <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2937       </tr>
2938       <tr>
2939         <td><code>trace8</code> </td>
2940
2941         <td>Trace messages, dumping large amounts of data</td>
2942
2943         <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2944       </tr>
2945     </table>
2946
2947     <p>When a particular level is specified, messages from all
2948     other levels of higher significance will be reported as well.
2949     <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2950     then messages with log levels of <code>notice</code> and
2951     <code>warn</code> will also be posted.</p>
2952
2953     <p>Using a level of at least <code>crit</code> is
2954     recommended.</p>
2955
2956     <p>For example:</p>
2957
2958     <pre class="prettyprint lang-config">LogLevel notice</pre>
2959
2960
2961     <div class="note"><h3>Note</h3>
2962       <p>When logging to a regular file messages of the level
2963       <code>notice</code> cannot be suppressed and thus are always
2964       logged. However, this doesn't apply when logging is done
2965       using <code>syslog</code>.</p>
2966     </div>
2967
2968     <p>Specifying a level without a module name will reset the level
2969     for all modules to that level.  Specifying a level with a module
2970     name will set the level for that module only. It is possible to
2971     use the module source file name, the module identifier, or the
2972     module identifier with the trailing <code>_module</code> omitted
2973     as module specification. This means the following three specifications
2974     are equivalent:</p>
2975
2976     <pre class="prettyprint lang-config">LogLevel info ssl:warn
2977 LogLevel info mod_ssl.c:warn
2978 LogLevel info ssl_module:warn</pre>
2979
2980
2981     <p>It is also possible to change the level per directory:</p>
2982
2983     <pre class="prettyprint lang-config">LogLevel info
2984 &lt;Directory "/usr/local/apache/htdocs/app"&gt;
2985   LogLevel debug
2986 &lt;/Directory&gt;</pre>
2987
2988
2989     <div class="note">
2990         Per directory loglevel configuration only affects messages that are
2991         logged after the request has been parsed and that are associated with
2992         the request. Log messages which are associated with the server or
2993         the connection are not affected. The latter can be influenced by the
2994         <code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code> directive,
2995         though.
2996     </div>
2997
2998 <h3>See also</h3>
2999 <ul>
3000 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
3001 <li><code class="directive"><a href="#errorlogformat">ErrorLogFormat</a></code></li>
3002 <li><code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code></li>
3003 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
3004 </ul>
3005 </div>
3006 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3007 <div class="directive-section"><h2><a name="LogLevelOverride" id="LogLevelOverride">LogLevelOverride</a> <a name="logleveloverride" id="logleveloverride">Directive</a></h2>
3008 <table class="directive">
3009 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override the verbosity of the ErrorLog for certain clients</td></tr>
3010 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>ipaddress</var>[/<var>prefixlen</var>]
3011     [<var>module</var>:]<var>level</var> [<var>module</var>:<var>level</var>] ...
3012 </code></td></tr>
3013 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>unset</code></td></tr>
3014 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3015 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3016 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3017 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.5.0 and later</td></tr>
3018 </table>
3019     <p><code class="directive">LogLevelOverride</code> adjusts the
3020     <code class="directive"><a href="#loglevel">LogLevel</a></code> for requests coming from
3021     certain client IP addresses.
3022     This allows to enable verbose logging only for certain test clients.
3023     The IP address is checked at a very early state in the connection
3024     processing.  Therefore, <code class="directive">LogLevelOverride</code> allows to
3025     change the log level for things like the SSL handshake which happen before
3026     a <code class="directive"><a href="#loglevel">LogLevel</a></code> directive in an
3027     <code class="directive"><a href="#if">&lt;If&gt;</a></code> container would
3028     be evaluated.</p>
3029
3030     <p><code class="directive">LogLevelOverride</code> accepts either a single
3031     IP-address or a CIDR IP-address/len subnet specification.
3032     For the syntax of the loglevel specification, see the
3033     <code class="directive"><a href="#loglevel">LogLevel</a></code> directive.</p>
3034
3035     <p>For requests that match a <code class="directive">LogLevelOverride</code>
3036     directive, per-directory specifications of
3037     <code class="directive"><a href="#loglevel">LogLevel</a></code> are ignored.</p>
3038
3039     <p>Examples:</p>
3040
3041     <pre class="prettyprint lang-config">        LogLevelOverride 192.0.2.0/24 ssl:trace6
3042         LogLevelOverride 192.0.2.7 ssl:trace8</pre>
3043
3044
3045     <div class="note">
3046         <code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code> only affects
3047         log messages that are associated with the request or the connection.
3048         Log messages which are associated with the server not affected.
3049     </div>
3050
3051
3052 <h3>See also</h3>
3053 <ul>
3054 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
3055 </ul>
3056 </div>
3057 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3058 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
3059 <table class="directive">
3060 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
3061 connection</td></tr>
3062 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
3063 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
3064 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3065 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3066 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3067 </table>
3068     <p>The <code class="directive">MaxKeepAliveRequests</code> directive
3069     limits the number of requests allowed per connection when
3070     <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
3071     set to <code>0</code>, unlimited requests will be allowed. We
3072     recommend that this setting be kept to a high value for maximum
3073     server performance.</p>
3074
3075     <p>For example:</p>
3076
3077     <pre class="prettyprint lang-config">MaxKeepAliveRequests 500</pre>
3078
3079
3080 </div>
3081 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3082 <div class="directive-section"><h2><a name="MaxRangeOverlaps" id="MaxRangeOverlaps">MaxRangeOverlaps</a> <a name="maxrangeoverlaps" id="maxrangeoverlaps">Directive</a></h2>
3083 <table class="directive">
3084 <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
3085         resource </td></tr>
3086 <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>
3087 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeOverlaps 20</code></td></tr>
3088 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3089 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3090 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3091 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3092 </table>
3093         <p>The <code class="directive">MaxRangeOverlaps</code> directive
3094             limits the number of overlapping HTTP ranges the server is willing to
3095             return to the client. If more overlapping ranges than permitted are requested,
3096             the complete resource is returned instead.</p>
3097
3098         <dl>
3099             <dt><strong>default</strong></dt>
3100             <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3101
3102             <dt><strong>none</strong></dt>
3103             <dd>No overlapping Range headers are allowed.</dd>
3104
3105             <dt><strong>unlimited</strong></dt>
3106             <dd>The server does not limit the number of overlapping ranges it is
3107                 willing to satisfy.</dd>
3108
3109             <dt><var>number-of-ranges</var></dt>
3110             <dd>A positive number representing the maximum number of overlapping ranges the
3111                 server is willing to satisfy.</dd>
3112         </dl>
3113     
3114 </div>
3115 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3116 <div class="directive-section"><h2><a name="MaxRangeReversals" id="MaxRangeReversals">MaxRangeReversals</a> <a name="maxrangereversals" id="maxrangereversals">Directive</a></h2>
3117 <table class="directive">
3118 <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
3119         resource </td></tr>
3120 <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>
3121 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeReversals 20</code></td></tr>
3122 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3123 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3124 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3125 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3126 </table>
3127         <p>The <code class="directive">MaxRangeReversals</code> directive
3128             limits the number of HTTP Range reversals the server is willing to
3129             return to the client. If more ranges reversals than permitted are requested,
3130             the complete resource is returned instead.</p>
3131
3132         <dl>
3133             <dt><strong>default</strong></dt>
3134             <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3135
3136             <dt><strong>none</strong></dt>
3137             <dd>No Range reversals headers are allowed.</dd>
3138
3139             <dt><strong>unlimited</strong></dt>
3140             <dd>The server does not limit the number of range reversals it is
3141                 willing to satisfy.</dd>
3142
3143             <dt><var>number-of-ranges</var></dt>
3144             <dd>A positive number representing the maximum number of range reversals the
3145                 server is willing to satisfy.</dd>
3146         </dl>
3147     
3148 </div>
3149 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3150 <div class="directive-section"><h2><a name="MaxRanges" id="MaxRanges">MaxRanges</a> <a name="maxranges" id="maxranges">Directive</a></h2>
3151 <table class="directive">
3152 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of ranges allowed before returning the complete
3153 resource </td></tr>
3154 <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>
3155 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRanges 200</code></td></tr>
3156 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3157 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3158 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3159 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3160 </table>
3161     <p>The <code class="directive">MaxRanges</code> directive
3162     limits the number of HTTP ranges the server is willing to
3163     return to the client. If more ranges than permitted are requested,
3164     the complete resource is returned instead.</p>
3165
3166     <dl>
3167       <dt><strong>default</strong></dt>
3168       <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3169
3170       <dt><strong>none</strong></dt>
3171       <dd>Range headers are ignored.</dd>
3172
3173       <dt><strong>unlimited</strong></dt>
3174       <dd>The server does not limit the number of ranges it is
3175           willing to satisfy.</dd>
3176
3177       <dt><var>number-of-ranges</var></dt>
3178       <dd>A positive number representing the maximum number of ranges the
3179       server is willing to satisfy.</dd>
3180     </dl>
3181
3182 </div>
3183 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3184 <div class="directive-section"><h2><a name="MergeTrailers" id="MergeTrailers">MergeTrailers</a> <a name="mergetrailers" id="mergetrailers">Directive</a></h2>
3185 <table class="directive">
3186 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determins whether trailers are merged into headers</td></tr>
3187 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MergeTrailers [on|off]</code></td></tr>
3188 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MergeTrailers off</code></td></tr>
3189 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3190 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3191 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3192 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.4.10 and later</td></tr>
3193 </table>
3194     <p>This directive controls whether HTTP trailers are copied into the
3195     internal representation of HTTP headers. This mergeing occurs when the 
3196     request body has been completely consumed, long after most header 
3197     processing would have a chance to examine or modify request headers.</p>
3198     <p>This option is provided for compatibility with releases prior to 2.4.10,
3199     where trailers were always merged.</p>
3200
3201 </div>
3202 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3203 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
3204 <table class="directive">
3205 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
3206 or specified mutexes</td></tr>
3207 <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>
3208 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
3209 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3210 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3211 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3212 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.4 and later</td></tr>
3213 </table>
3214     <p>The <code class="directive">Mutex</code> directive sets the mechanism,
3215     and optionally the lock file location, that httpd and modules use
3216     to serialize access to resources.  Specify <code>default</code> as
3217     the first argument to change the settings for all mutexes; specify
3218     a mutex name (see table below) as the first argument to override
3219     defaults only for that mutex.</p>
3220
3221     <p>The <code class="directive">Mutex</code> directive is typically used in
3222     the following exceptional situations:</p>
3223
3224     <ul>
3225         <li>change the mutex mechanism when the default mechanism selected
3226         by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
3227         problem</li>
3228
3229         <li>change the directory used by file-based mutexes when the
3230         default directory does not support locking</li>
3231     </ul>
3232
3233     <div class="note"><h3>Supported modules</h3>
3234     <p>This directive only configures mutexes which have been registered
3235     with the core server using the <code>ap_mutex_register()</code> API.
3236     All modules bundled with httpd support the <code class="directive">Mutex</code>
3237     directive, but third-party modules may not.  Consult the documentation
3238     of the third-party module, which must indicate the mutex name(s) which
3239     can be configured if this directive is supported.</p>
3240     </div>
3241
3242     <p>The following mutex <em>mechanisms</em> are available:</p>
3243     <ul>
3244         <li><code>default | yes</code>
3245         <p>This selects the default locking implementation, as determined by
3246         <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>.  The default locking implementation can
3247         be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
3248         <code>-V</code> option.</p></li>
3249
3250         <li><code>none | no</code>
3251         <p>This effectively disables the mutex, and is only allowed for a
3252         mutex if the module indicates that it is a valid choice.  Consult the
3253         module documentation for more information.</p></li>
3254
3255         <li><code>posixsem</code>
3256         <p>This is a mutex variant based on a Posix semaphore.</p>
3257
3258         <div class="warning"><h3>Warning</h3>
3259         <p>The semaphore ownership is not recovered if a thread in the process
3260         holding the mutex segfaults, resulting in a hang of the web server.</p>
3261         </div>
3262         </li>
3263
3264         <li><code>sysvsem</code>
3265         <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3266
3267         <div class="warning"><h3>Warning</h3>
3268         <p>It is possible to "leak" SysV semaphores if processes crash
3269         before the semaphore is removed.</p>
3270         </div>
3271
3272         <div class="warning"><h3>Security</h3>
3273         <p>The semaphore API allows for a denial of service attack by any
3274         CGIs running under the same uid as the webserver (<em>i.e.</em>,
3275         all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
3276         or <code>cgiwrapper</code>).</p>
3277         </div>
3278         </li>
3279
3280         <li><code>sem</code>
3281         <p>This selects the "best" available semaphore implementation, choosing
3282         between Posix and SystemV IPC semaphores, in that order.</p></li>
3283
3284         <li><code>pthread</code>
3285         <p>This is a mutex variant based on cross-process Posix thread
3286         mutexes.</p>
3287
3288         <div class="warning"><h3>Warning</h3>
3289         <p>On most systems, if a child process terminates abnormally while
3290         holding a mutex that uses this implementation, the server will deadlock
3291         and stop responding to requests.  When this occurs, the server will
3292         require a manual restart to recover.</p>
3293         <p>Solaris is a notable exception as it provides a mechanism which
3294         usually allows the mutex to be recovered after a child process
3295         terminates abnormally while holding a mutex.</p>
3296         <p>If your system implements the
3297         <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3298         to use the <code>pthread</code> option safely.</p>
3299         </div>
3300         </li>
3301
3302         <li><code>fcntl:/path/to/mutex</code>
3303         <p>This is a mutex variant where a physical (lock-)file and the
3304         <code>fcntl()</code> function are used as the mutex.</p>
3305
3306         <div class="warning"><h3>Warning</h3>
3307         <p>When multiple mutexes based on this mechanism are used within
3308         multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3309         can be reported for valid mutex operations if <code>fcntl()</code>
3310         is not thread-aware, such as on Solaris.</p>
3311         </div>
3312         </li>
3313
3314         <li><code>flock:/path/to/mutex</code>
3315         <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3316         with the exception that the <code>flock()</code> function is used to
3317         provide file locking.</p></li>
3318
3319         <li><code>file:/path/to/mutex</code>
3320         <p>This selects the "best" available file locking implementation,
3321         choosing between <code>fcntl</code> and <code>flock</code>, in that
3322         order.</p></li>
3323     </ul>
3324
3325     <p>Most mechanisms are only available on selected platforms, where the
3326     underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it.  Mechanisms
3327     which aren't available on all platforms are <em>posixsem</em>,
3328     <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3329     <em>flock</em>, and <em>file</em>.</p>
3330
3331     <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3332     the path, if provided, is a directory where the lock file will be created.
3333     The default directory is httpd's run-time file directory,
3334     <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>.  If a relative
3335     path is provided, it is relative to
3336     <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>.  Always use a local
3337     disk filesystem for <code>/path/to/mutex</code> and never a directory residing
3338     on a NFS- or AFS-filesystem.  The basename of the file will be the mutex
3339     type, an optional instance string provided by the module, and unless the
3340     <code>OmitPID</code> keyword is specified, the process id of the httpd
3341     parent process will be appended to to make the file name unique, avoiding
3342     conflicts when multiple httpd instances share a lock file directory.  For
3343     example, if the mutex name is <code>mpm-accept</code> and the lock file
3344     directory is <code>/var/httpd/locks</code>, the lock file name for the
3345     httpd instance with parent process id 12345 would be
3346     <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3347
3348     <div class="warning"><h3>Security</h3>
3349     <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3350     directory such as <code>/var/tmp</code> because someone could create
3351     a denial of service attack and prevent the server from starting by
3352     creating a lockfile with the same name as the one the server will try
3353     to create.</p>
3354     </div>
3355
3356     <p>The following table documents the names of mutexes used by httpd
3357     and bundled modules.</p>
3358
3359     <table class="bordered"><tr class="header">
3360             <th>Mutex name</th>
3361             <th>Module(s)</th>
3362             <th>Protected resource</th>
3363         </tr>
3364 <tr>
3365             <td><code>mpm-accept</code></td>
3366             <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>
3367             <td>incoming connections, to avoid the thundering herd problem;
3368             for more information, refer to the
3369             <a href="../misc/perf-tuning.html">performance tuning</a>
3370             documentation</td>
3371         </tr>
3372 <tr class="odd">
3373             <td><code>authdigest-client</code></td>
3374             <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3375             <td>client list in shared memory</td>
3376         </tr>
3377 <tr>
3378             <td><code>authdigest-opaque</code></td>
3379             <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3380             <td>counter in shared memory</td>
3381         </tr>
3382 <tr class="odd">
3383             <td><code>ldap-cache</code></td>
3384             <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
3385             <td>LDAP result cache</td>
3386         </tr>
3387 <tr>
3388             <td><code>rewrite-map</code></td>
3389             <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
3390             <td>communication with external mapping programs, to avoid
3391             intermixed I/O from multiple requests</td>
3392         </tr>
3393 <tr class="odd">
3394             <td><code>ssl-cache</code></td>
3395             <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3396             <td>SSL session cache</td>
3397         </tr>
3398 <tr>
3399             <td><code>ssl-stapling</code></td>
3400             <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3401             <td>OCSP stapling response cache</td>
3402         </tr>
3403 <tr class="odd">
3404             <td><code>watchdog-callback</code></td>
3405             <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
3406             <td>callback function of a particular client module</td>
3407         </tr>
3408 </table>
3409
3410     <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3411     parent process id from the lock file name.</p>
3412
3413     <p>In the following example, the mutex mechanism for the MPM accept
3414     mutex will be changed from the compiled-in default to <code>fcntl</code>,
3415     with the associated lock file created in directory
3416     <code>/var/httpd/locks</code>.  The mutex mechanism for all other mutexes
3417     will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3418
3419     <pre class="prettyprint lang-config">Mutex sysvsem default
3420 Mutex fcntl:/var/httpd/locks mpm-accept</pre>
3421
3422
3423 </div>
3424 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3425 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
3426 <table class="directive">
3427 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>DEPRECATED: Designates an IP address for name-virtual
3428 hosting</td></tr>
3429 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
3430 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3431 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3432 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3433 </table>
3434
3435 <p>Prior to 2.3.11, <code class="directive">NameVirtualHost</code> was required
3436 to instruct the server that a particular IP address and port combination
3437 was usable as a name-based virtual host.  In 2.3.11 and later,
3438 any time an IP address and port combination is used in multiple virtual
3439 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3440
3441 <p>This directive currently has no effect.</p>
3442
3443 <h3>See also</h3>
3444 <ul>
3445 <li><a href="../vhosts/">Virtual Hosts
3446 documentation</a></li>
3447 </ul>
3448 </div>
3449 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3450 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
3451 <table class="directive">
3452 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
3453 directory</td></tr>
3454 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
3455     [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
3456 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options FollowSymlinks</code></td></tr>
3457 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3458 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</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>
3461 <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>
3462 </table>
3463     <p>The <code class="directive">Options</code> directive controls which
3464     server features are available in a particular directory.</p>
3465
3466     <p><var>option</var> can be set to <code>None</code>, in which
3467     case none of the extra features are enabled, or one or more of
3468     the following:</p>
3469
3470     <dl>
3471       <dt><code>All</code></dt>
3472
3473       <dd>All options except for <code>MultiViews</code>.</dd>
3474
3475       <dt><code>ExecCGI</code></dt>
3476
3477       <dd>
3478       Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
3479       is permitted.</dd>
3480
3481       <dt><code>FollowSymLinks</code></dt>
3482
3483       <dd>
3484       The server will follow symbolic links in this directory. This is
3485       the default setting.
3486       <div class="note">
3487       <p>Even though the server follows the symlink it does <em>not</em>
3488       change the pathname used to match against <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections.</p>
3489
3490       <p>The <code>FollowSymLinks</code> and
3491       <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections or
3492       <code>.htaccess</code> files.</p>
3493
3494       <p>Omitting this option should not be considered a security restriction,
3495       since symlink testing is subject to race conditions that make it
3496       circumventable.</p>
3497       </div></dd>
3498
3499       <dt><code>Includes</code></dt>
3500
3501       <dd>
3502       Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
3503       are permitted.</dd>
3504
3505       <dt><code>IncludesNOEXEC</code></dt>
3506
3507       <dd>
3508
3509       Server-side includes are permitted, but the <code>#exec
3510       cmd</code> and <code>#exec cgi</code> are disabled. It is still
3511       possible to <code>#include virtual</code> CGI scripts from
3512       <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
3513       directories.</dd>
3514
3515       <dt><code>Indexes</code></dt>
3516
3517       <dd>
3518       If a URL which maps to a directory is requested, and there
3519       is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
3520       (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3521       <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
3522       of the directory.</dd>
3523
3524       <dt><code>MultiViews</code></dt>
3525
3526       <dd>
3527       <a href="../content-negotiation.html">Content negotiated</a>
3528       "MultiViews" are allowed using
3529       <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.
3530       <div class="note"><h3>Note</h3> <p>This option gets ignored if set
3531       anywhere other than <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>, as <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>
3532       needs real resources to compare against and evaluate from.</p></div>
3533       </dd>
3534
3535       <dt><code>SymLinksIfOwnerMatch</code></dt>
3536
3537       <dd>The server will only follow symbolic links for which the
3538       target file or directory is owned by the same user id as the
3539       link.
3540
3541       <div class="note"><h3>Note</h3>
3542       <p>The <code>FollowSymLinks</code> and
3543       <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections or
3544       <code>.htaccess</code> files.</p>
3545
3546       <p>This option should not be considered a security restriction,
3547       since symlink testing is subject to race conditions that make it
3548       circumventable.</p>
3549       </div> </dd>
3550     </dl>
3551
3552     <p>Normally, if multiple <code class="directive">Options</code> could
3553     apply to a directory, then the most specific one is used and
3554     others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
3555     However if <em>all</em> the options on the
3556     <code class="directive">Options</code> directive are preceded by a
3557     <code>+</code> or <code>-</code> symbol, the options are
3558     merged. Any options preceded by a <code>+</code> are added to the
3559     options currently in force, and any options preceded by a
3560     <code>-</code> are removed from the options currently in
3561     force. </p>
3562
3563     <div class="note"><h3>Note</h3>
3564     <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
3565     <code>-</code> with those without is not valid syntax, and will be
3566     rejected during server startup by the syntax check with an abort.</p>
3567     </div>
3568
3569     <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3570
3571     <pre class="prettyprint lang-config">&lt;Directory "/web/docs"&gt;
3572   Options Indexes FollowSymLinks
3573 &lt;/Directory&gt;
3574
3575 &lt;Directory "/web/docs/spec"&gt;
3576   Options Includes
3577 &lt;/Directory&gt;</pre>
3578
3579
3580     <p>then only <code>Includes</code> will be set for the
3581     <code>/web/docs/spec</code> directory. However if the second
3582     <code class="directive">Options</code> directive uses the <code>+</code> and
3583     <code>-</code> symbols:</p>
3584
3585     <pre class="prettyprint lang-config">&lt;Directory "/web/docs"&gt;
3586   Options Indexes FollowSymLinks
3587 &lt;/Directory&gt;
3588
3589 &lt;Directory "/web/docs/spec"&gt;
3590   Options +Includes -Indexes
3591 &lt;/Directory&gt;</pre>
3592
3593
3594     <p>then the options <code>FollowSymLinks</code> and
3595     <code>Includes</code> are set for the <code>/web/docs/spec</code>
3596     directory.</p>
3597
3598     <div class="note"><h3>Note</h3>
3599       <p>Using <code>-IncludesNOEXEC</code> or
3600       <code>-Includes</code> disables server-side includes completely
3601       regardless of the previous setting.</p>
3602     </div>
3603
3604     <p>The default in the absence of any other settings is
3605     <code>FollowSymlinks</code>.</p>
3606
3607 </div>
3608 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3609 <div class="directive-section"><h2><a name="Protocol" id="Protocol">Protocol</a> <a name="protocol" id="protocol">Directive</a></h2>
3610 <table class="directive">
3611 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocol for a listening socket</td></tr>
3612 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocol <var>protocol</var></code></td></tr>
3613 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3614 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3615 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3616 <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>
3617 </table>
3618     <p>This directive specifies the protocol used for a specific listening socket.
3619        The protocol is used to determine which module should handle a request, and
3620        to apply protocol specific optimizations with the <code class="directive">AcceptFilter</code>
3621        directive.</p>
3622
3623     <p>You only need to set the protocol if you are running on non-standard ports, otherwise <code>http</code> is assumed for port 80 and <code>https</code> for port 443.</p>
3624
3625     <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3626
3627     <pre class="prettyprint lang-config">Protocol https</pre>
3628
3629
3630     <p>You can also specify the protocol using the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive.</p>
3631
3632 <h3>See also</h3>
3633 <ul>
3634 <li><code class="directive"><a href="#acceptfilter">AcceptFilter</a></code></li>
3635 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3636 </ul>
3637 </div>
3638 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3639 <div class="directive-section"><h2><a name="RegisterHttpMethod" id="RegisterHttpMethod">RegisterHttpMethod</a> <a name="registerhttpmethod" id="registerhttpmethod">Directive</a></h2>
3640 <table class="directive">
3641 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Register non-standard HTTP methods</td></tr>
3642 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RegisterHttpMethod <var>method</var> [<var>method</var> [...]]</code></td></tr>
3643 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3644 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3645 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3646 </table>
3647 <p>HTTP Methods that are not conforming to the relvant RFCs are normally
3648 rejected by request processing in Apache HTTPD. To avoid this, modules
3649 can register non-standard HTTP methods they support.
3650 The <code class="directive">RegisterHttpMethod</code> allows to register such
3651 methods manually. This can be useful for if such methods are forwared
3652 for external processing, e.g. to a CGI script.</p>
3653
3654 </div>
3655 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3656 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
3657 <table class="directive">
3658 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
3659 by Apache httpd children</td></tr>
3660 <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>
3661 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3662 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3663 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3664 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3665 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3666 </table>
3667     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3668     resource limit for all processes and the second parameter sets
3669     the maximum resource limit. Either parameter can be a number,
3670     or <code>max</code> to indicate to the server that the limit should
3671     be set to the maximum allowed by the operating system
3672     configuration. Raising the maximum resource limit requires that
3673     the server is running as <code>root</code>, or in the initial startup
3674     phase.</p>
3675
3676     <p>This applies to processes forked off from Apache httpd children
3677     servicing requests, not the Apache httpd children themselves. This
3678     includes CGI scripts and SSI exec commands, but not any
3679     processes forked off from the Apache httpd parent such as piped
3680     logs.</p>
3681
3682     <p>CPU resource limits are expressed in seconds per
3683     process.</p>
3684
3685 <h3>See also</h3>
3686 <ul>
3687 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3688 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3689 </ul>
3690 </div>
3691 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3692 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
3693 <table class="directive">
3694 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
3695 by Apache httpd children</td></tr>
3696 <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>
3697 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3698 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3699 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3700 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3701 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3702 </table>
3703     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3704     resource limit for all processes and the second parameter sets
3705     the maximum resource limit. Either parameter can be a number,
3706     or <code>max</code> to indicate to the server that the limit should
3707     be set to the maximum allowed by the operating system
3708     configuration. Raising the maximum resource limit requires that
3709     the server is running as <code>root</code>, or in the initial startup
3710     phase.</p>
3711
3712     <p>This applies to processes forked off from Apache httpd children
3713     servicing requests, not the Apache httpd children themselves. This
3714     includes CGI scripts and SSI exec commands, but not any
3715     processes forked off from the Apache httpd parent such as piped
3716     logs.</p>
3717
3718     <p>Memory resource limits are expressed in bytes per
3719     process.</p>
3720
3721 <h3>See also</h3>
3722 <ul>
3723 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3724 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3725 </ul>
3726 </div>
3727 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3728 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
3729 <table class="directive">
3730 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
3731 processes launched by Apache httpd children</td></tr>
3732 <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>
3733 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3734 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3735 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3736 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3737 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3738 </table>
3739     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3740     resource limit for all processes and the second parameter sets
3741     the maximum resource limit. Either parameter can be a number,
3742     or <code>max</code> to indicate to the server that the limit
3743     should be set to the maximum allowed by the operating system
3744     configuration. Raising the maximum resource limit requires that
3745     the server is running as <code>root</code>, or in the initial startup
3746     phase.</p>
3747
3748     <p>This applies to processes forked off from Apache httpd children
3749     servicing requests, not the Apache httpd children themselves. This
3750     includes CGI scripts and SSI exec commands, but not any
3751     processes forked off from the Apache httpd parent such as piped
3752     logs.</p>
3753
3754     <p>Process limits control the number of processes per user.</p>
3755
3756     <div class="note"><h3>Note</h3>
3757       <p>If CGI processes are <strong>not</strong> running
3758       under user ids other than the web server user id, this directive
3759       will limit the number of processes that the server itself can
3760       create. Evidence of this situation will be indicated by
3761       <strong><code>cannot fork</code></strong> messages in the
3762       <code>error_log</code>.</p>
3763     </div>
3764
3765 <h3>See also</h3>
3766 <ul>
3767 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3768 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3769 </ul>
3770 </div>
3771 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3772 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
3773 <table class="directive">
3774 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
3775 scripts</td></tr>
3776 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
3777 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
3778 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3779 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3780 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3781 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3782 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only.</td></tr>
3783 </table>
3784     <p>This directive is used to control how Apache httpd finds the
3785     interpreter used to run CGI scripts. The default setting is
3786     <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3787     by the shebang line (first line, starting with <code>#!</code>) in the
3788     script. On Win32 systems this line usually looks like:</p>
3789
3790     <pre class="prettyprint lang-perl">#!C:/Perl/bin/perl.exe</pre>
3791
3792
3793     <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3794
3795     <pre class="prettyprint lang-perl">#!perl</pre>
3796
3797
3798     <p>Setting <code>ScriptInterpreterSource Registry</code> will
3799     cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3800     searched using the script file extension (e.g., <code>.pl</code>) as a
3801     search key. The command defined by the registry subkey
3802     <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3803     <code>Shell\Open\Command</code> is used to open the script file. If the
3804     registry keys cannot be found, Apache httpd falls back to the behavior of the
3805     <code>Script</code> option.</p>
3806
3807     <div class="warning"><h3>Security</h3>
3808     <p>Be careful when using <code>ScriptInterpreterSource
3809     Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
3810     Apache httpd will try to execute <strong>every</strong> file within this
3811     directory. The <code>Registry</code> setting may cause undesired
3812     program calls on files which are typically not executed. For
3813     example, the default open command on <code>.htm</code> files on
3814     most Windows systems will execute Microsoft Internet Explorer, so
3815     any HTTP request for an <code>.htm</code> file existing within the
3816     script directory would start the browser in the background on the
3817     server. This is a good way to crash your system within a minute or
3818     so.</p>
3819     </div>
3820
3821     <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3822     2.0 does the same thing as <code>Registry</code> but uses only the
3823     subkey <code>Shell\ExecCGI\Command</code>. The
3824     <code>ExecCGI</code> key is not a common one. It must be
3825     configured manually in the windows registry and hence prevents
3826     accidental program calls on your system.</p>
3827
3828 </div>
3829 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3830 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
3831 <table class="directive">
3832 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
3833 of a request or the last 63, assuming the request itself is greater than
3834 63 chars.</td></tr>
3835 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
3836 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
3837 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3838 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3839 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3840 </table>
3841     <p>mod_status with <code>ExtendedStatus On</code>
3842     displays the actual request being handled.
3843     For historical purposes, only 63 characters of the request
3844     are actually stored for display purposes. This directive
3845     controls whether the 1st 63 characters are stored (the previous
3846     behavior and the default) or if the last 63 characters are. This
3847     is only applicable, of course, if the length of the request is
3848     64 characters or greater.</p>
3849
3850     <p>If Apache httpd is handling <code>GET&nbsp;/disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg&nbsp;HTTP/1.1</code> mod_status displays as follows:
3851     </p>
3852
3853     <table class="bordered">
3854       <tr>
3855         <th>Off (default)</th>
3856         <td>GET&nbsp;/disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3857       </tr>
3858       <tr>
3859         <th>On</th>
3860         <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg&nbsp;HTTP/1.1</td>
3861       </tr>
3862     </table>
3863
3864
3865 </div>
3866 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3867 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
3868 <table class="directive">
3869 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
3870 messages sent to the client</td></tr>
3871 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
3872 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3873 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3874 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3875 </table>
3876     <p>The <code class="directive">ServerAdmin</code> sets the contact address
3877     that the server includes in any error messages it returns to the
3878     client. If the <code>httpd</code> doesn't recognize the supplied argument
3879     as an URL, it
3880     assumes, that it's an <var>email-address</var> and prepends it with
3881     <code>mailto:</code> in hyperlink targets. However, it's recommended to
3882     actually use an email address, since there are a lot of CGI scripts that
3883     make that assumption. If you want to use an URL, it should point to another
3884     server under your control. Otherwise users may not be able to contact you in
3885     case of errors.</p>
3886
3887     <p>It may be worth setting up a dedicated address for this, e.g.</p>
3888
3889     <pre class="prettyprint lang-config">ServerAdmin www-admin@foo.example.com</pre>
3890
3891     <p>as users do not always mention that they are talking about the
3892     server!</p>
3893
3894 </div>
3895 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3896 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
3897 <table class="directive">
3898 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
3899 to name-virtual hosts</td></tr>
3900 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
3901 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3902 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3903 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3904 </table>
3905     <p>The <code class="directive">ServerAlias</code> directive sets the
3906     alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3907     <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
3908
3909     <pre class="prettyprint lang-config">&lt;VirtualHost *:80&gt;
3910   ServerName server.example.com
3911   ServerAlias server server2.example.com server2
3912   ServerAlias *.example.com
3913   UseCanonicalName Off
3914   # ...
3915 &lt;/VirtualHost&gt;</pre>
3916
3917
3918     <p>Name-based virtual hosts for the best-matching set of  <code class="directive"><a href="#virtualhost">&lt;virtualhost&gt;</a></code>s are processed
3919     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
3920     (nor for ServerName vs. ServerAlias).  </p>
3921
3922     <p>The complete list of names in the <code class="directive">VirtualHost</code>
3923     directive are treated just like a (non wildcard) 
3924     <code class="directive">ServerAlias</code>.</p>
3925
3926
3927 <h3>See also</h3>
3928 <ul>
3929 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3930 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
3931 </ul>
3932 </div>
3933 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3934 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
3935 <table class="directive">
3936 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
3937 itself</td></tr>
3938 <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>
3939 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3940 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3941 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3942 </table>
3943     <p>The <code class="directive">ServerName</code> directive sets the
3944     request scheme, hostname and
3945     port that the server uses to identify itself.  This is used when
3946     creating redirection URLs.</p>
3947
3948     <p>Additionally, <code class="directive">ServerName</code> is used (possibly
3949     in conjunction with <code class="directive">ServerAlias</code>) to uniquely
3950     identify a virtual host, when using <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3951
3952     <p>For example, if the name of the
3953     machine hosting the web server is <code>simple.example.com</code>,
3954     but the machine also has the DNS alias <code>www.example.com</code>
3955     and you wish the web server to be so identified, the following
3956     directive should be used:</p>
3957
3958     <pre class="prettyprint lang-config">ServerName www.example.com</pre>
3959
3960
3961     <p>The <code class="directive">ServerName</code> directive
3962     may appear anywhere within the definition of a server. However,
3963     each appearance overrides the previous appearance (within that
3964     server).</p>
3965
3966     <p>If no <code class="directive">ServerName</code> is specified, then the
3967     server attempts to deduce the client visible hostname by performing a
3968     reverse lookup on an IP address of the systems hostname.</p>
3969     
3970     <p>If no port is specified in the
3971     <code class="directive">ServerName</code>, then the server will use the
3972     port from the incoming request. For optimal reliability and
3973     predictability, you should specify an explicit hostname and port
3974     using the <code class="directive">ServerName</code> directive.</p>
3975
3976     <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
3977     the <code class="directive">ServerName</code> inside a
3978     <code class="directive"><a href="#virtualhost">&lt;VirtualHost&gt;</a></code>
3979     section specifies what hostname must appear in the request's
3980     <code>Host:</code> header to match this virtual host.</p>
3981
3982     <p>Sometimes, the server runs behind a device that processes SSL,
3983     such as a reverse proxy, load balancer or SSL offload
3984     appliance. When this is the case, specify the
3985     <code>https://</code> scheme and the port number to which the
3986     clients connect in the <code class="directive">ServerName</code> directive
3987     to make sure that the server generates the correct
3988     self-referential URLs.
3989     </p>
3990
3991     <p>See the description of the
3992     <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
3993     <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
3994     settings which determine whether self-referential URLs (e.g., by the
3995     <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
3996     specified port, or to the port number given in the client's request.
3997     </p>
3998
3999     <div class="warning">
4000     <p>Failure to set <code class="directive">ServerName</code> to a name that
4001     your server can resolve to an IP address will result in a startup
4002     warning. <code>httpd</code> will then use whatever hostname it can
4003     determine, using the system's <code>hostname</code> command. This
4004     will almost never be the hostname you actually want.</p>
4005     <div class="example"><p><code>
4006     httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
4007     </code></p></div>
4008     </div>
4009
4010
4011 <h3>See also</h3>
4012 <ul>
4013 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4014     Apache HTTP Server</a></li>
4015 <li><a href="../vhosts/">Apache HTTP Server virtual host
4016     documentation</a></li>
4017 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4018 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4019 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
4020 </ul>
4021 </div>
4022 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4023 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
4024 <table class="directive">
4025 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
4026 is accessed by an incompatible browser</td></tr>
4027 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
4028 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
4029 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4030 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4031 </table>
4032     <p>The <code class="directive">ServerPath</code> directive sets the legacy
4033     URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
4034
4035 <h3>See also</h3>
4036 <ul>
4037 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4038 </ul>
4039 </div>
4040 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4041 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
4042 <table class="directive">
4043 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
4044 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
4045 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
4046 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4047 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4048 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4049 </table>
4050     <p>The <code class="directive">ServerRoot</code> directive sets the
4051     directory in which the server lives. Typically it will contain the
4052     subdirectories <code>conf/</code> and <code>logs/</code>. Relative
4053     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
4054     relative to this directory.</p>
4055
4056     <pre class="prettyprint lang-config">ServerRoot "/home/httpd"</pre>
4057
4058
4059     <p>The default location of <code class="directive">ServerRoot</code> may be
4060     modified by using the <code>--prefix</code> argument to
4061     <a href="../programs/configure.html"><code>configure</code></a>, and
4062     most third-party distributions of the server have a different
4063     default location from the one listed above.</p>
4064
4065
4066 <h3>See also</h3>
4067 <ul>
4068 <li><a href="../invoking.html">the <code>-d</code>
4069     option to <code>httpd</code></a></li>
4070 <li><a href="../misc/security_tips.html#serverroot">the
4071     security tips</a> for information on how to properly set
4072     permissions on the <code class="directive">ServerRoot</code></li>
4073 </ul>
4074 </div>
4075 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4076 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
4077 <table class="directive">
4078 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
4079 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
4080 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
4081 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4082 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4083 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4084 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4085 </table>
4086     <p>The <code class="directive">ServerSignature</code> directive allows the
4087     configuration of a trailing footer line under server-generated
4088     documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
4089     listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
4090     would want to enable such a footer line is that in a chain of proxies,
4091     the user often has no possibility to tell which of the chained servers
4092     actually produced a returned error message.</p>
4093
4094     <p>The <code>Off</code>
4095     setting, which is the default, suppresses the footer line (and is
4096     therefore compatible with the behavior of Apache-1.2 and
4097     below). The <code>On</code> setting simply adds a line with the
4098     server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
4099     and the <code>EMail</code> setting additionally creates a
4100     "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
4101     document.</p>
4102
4103     <p>After version 2.0.44, the details of the server version number
4104     presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
4105
4106 <h3>See also</h3>
4107 <ul>
4108 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
4109 </ul>
4110 </div>
4111 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4112 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
4113 <table class="directive">
4114 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
4115 header</td></tr>
4116 <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>
4117 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
4118 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4119 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4120 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4121 </table>
4122     <p>This directive controls whether <code>Server</code> response
4123     header field which is sent back to clients includes a
4124     description of the generic OS-type of the server as well as
4125     information about compiled-in modules.</p>
4126
4127     <dl>
4128       <dt><code>ServerTokens Full</code> (or not specified)</dt>
4129
4130       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4131       (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4132
4133       <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4134
4135       <dd>Server sends (<em>e.g.</em>): <code>Server:
4136       Apache</code></dd>
4137
4138       <dt><code>ServerTokens Major</code></dt>
4139
4140       <dd>Server sends (<em>e.g.</em>): <code>Server:
4141       Apache/2</code></dd>
4142
4143       <dt><code>ServerTokens Minor</code></dt>
4144
4145       <dd>Server sends (<em>e.g.</em>): <code>Server:
4146       Apache/2.4</code></dd>
4147
4148       <dt><code>ServerTokens Min[imal]</code></dt>
4149
4150       <dd>Server sends (<em>e.g.</em>): <code>Server:
4151       Apache/2.4.2</code></dd>
4152
4153       <dt><code>ServerTokens OS</code></dt>
4154
4155       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4156       (Unix)</code></dd>
4157
4158     </dl>
4159
4160     <p>This setting applies to the entire server, and cannot be
4161     enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4162
4163     <p>After version 2.0.44, this directive also controls the
4164     information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
4165
4166     <div class="note">Setting <code class="directive">ServerTokens</code> to less than
4167     <code>minimal</code> is not recommended because it makes it more
4168     difficult to debug interoperational problems. Also note that
4169     disabling the Server: header does nothing at all to make your
4170     server more secure; the idea of "security through obscurity"
4171     is a myth and leads to a false sense of safety.</div>
4172
4173
4174 <h3>See also</h3>
4175 <ul>
4176 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
4177 </ul>
4178 </div>
4179 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4180 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
4181 <table class="directive">
4182 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
4183 handler</td></tr>
4184 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
4185 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4186 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4187 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4188 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4189 </table>
4190     <p>When placed into an <code>.htaccess</code> file or a
4191     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> or
4192     <code class="directive"><a href="#location">&lt;Location&gt;</a></code>
4193     section, this directive forces all matching files to be parsed
4194     through the <a href="../handler.html">handler</a> given by
4195     <var>handler-name</var>. For example, if you had a directory you
4196     wanted to be parsed entirely as imagemap rule files, regardless
4197     of extension, you might put the following into an
4198     <code>.htaccess</code> file in that directory:</p>
4199
4200     <pre class="prettyprint lang-config">SetHandler imap-file</pre>
4201
4202
4203     <p>Another example: if you wanted to have the server display a
4204     status report whenever a URL of
4205     <code>http://servername/status</code> was called, you might put
4206     the following into <code>httpd.conf</code>:</p>
4207
4208     <pre class="prettyprint lang-config">&lt;Location "/status"&gt;
4209   SetHandler server-status
4210 &lt;/Location&gt;</pre>
4211
4212
4213     <p>You could also use this directive to configure a particular
4214     handler for files with a particular file extension. For example:</p>
4215
4216     <pre class="prettyprint lang-config">&lt;FilesMatch \.php$&gt;
4217     SetHandler application/x-httpd-php
4218 &lt;/FilesMatch&gt;</pre>
4219
4220
4221     <p>You can override an earlier defined <code class="directive">SetHandler</code>
4222     directive by using the value <code>None</code>.</p>
4223
4224     <div class="note"><h3>Note</h3>
4225     <p>Because <code class="directive">SetHandler</code> overrides default handlers,
4226     normal behavior such as handling of URLs ending in a slash (/) as
4227     directories or index files is suppressed.</p></div>
4228
4229 <h3>See also</h3>
4230 <ul>
4231 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
4232 </ul>
4233 </div>
4234 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4235 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
4236 <table class="directive">
4237 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
4238 input</td></tr>
4239 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4240 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4241 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4242 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4243 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4244 </table>
4245     <p>The <code class="directive">SetInputFilter</code> directive sets the
4246     filter or filters which will process client requests and POST
4247     input when they are received by the server. This is in addition to
4248     any filters defined elsewhere, including the
4249     <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
4250     directive.</p>
4251
4252     <p>If more than one filter is specified, they must be separated
4253     by semicolons in the order in which they should process the
4254     content.</p>
4255
4256 <h3>See also</h3>
4257 <ul>
4258 <li><a href="../filter.html">Filters</a> documentation</li>
4259 </ul>
4260 </div>
4261 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4262 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
4263 <table class="directive">
4264 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
4265 server</td></tr>
4266 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4267 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4268 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4269 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4270 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4271 </table>
4272     <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
4273     which will process responses from the server before they are
4274     sent to the client. This is in addition to any filters defined
4275     elsewhere, including the
4276     <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
4277     directive.</p>
4278
4279     <p>For example, the following configuration will process all files
4280     in the <code>/www/data/</code> directory for server-side
4281     includes.</p>
4282
4283     <pre class="prettyprint lang-config">&lt;Directory "/www/data/"&gt;
4284   SetOutputFilter INCLUDES
4285 &lt;/Directory&gt;</pre>
4286
4287
4288     <p>If more than one filter is specified, they must be separated
4289     by semicolons in the order in which they should process the
4290     content.</p>
4291
4292 <h3>See also</h3>
4293 <ul>
4294 <li><a href="../filter.html">Filters</a> documentation</li>
4295 </ul>
4296 </div>
4297 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4298 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
4299 <table class="directive">
4300 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
4301 certain events before failing a request</td></tr>
4302 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
4303 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 60</code></td></tr>
4304 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4305 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4306 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4307 </table>
4308     <p>The <code class="directive">TimeOut</code> directive defines the length
4309     of time Apache httpd will wait for I/O in various circumstances:</p>
4310
4311     <ol>
4312       <li>When reading data from the client, the length of time to
4313       wait for a TCP packet to arrive if the read buffer is
4314       empty.</li>
4315
4316       <li>When writing data to the client, the length of time to wait
4317       for an acknowledgement of a packet if the send buffer is
4318       full.</li>
4319
4320       <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>, 
4321       the length of time to wait for output from a CGI script.</li>
4322
4323       <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
4324       wait for output from a filtering process.</li>
4325
4326       <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
4327       <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
4328       configured.</li>
4329     </ol>
4330
4331
4332 </div>
4333 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4334 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
4335 <table class="directive">
4336 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behavior on <code>TRACE</code> requests</td></tr>
4337 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
4338 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
4339 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4340 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4341 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4342 </table>
4343     <p>This directive overrides the behavior of <code>TRACE</code> for both
4344     the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>.  The default
4345     <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4346     RFC 2616, which disallows any request body to accompany the request.
4347     <code>TraceEnable off</code> causes the core server and
4348     <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
4349     allowed) error to the client.</p>
4350
4351     <p>Finally, for testing and diagnostic purposes only, request
4352     bodies may be allowed using the non-compliant <code>TraceEnable
4353     extended</code> directive.  The core (as an origin server) will
4354     restrict the request body to 64k (plus 8k for chunk headers if
4355     <code>Transfer-Encoding: chunked</code> is used).  The core will
4356     reflect the full headers and all chunk headers with the response
4357     body.  As a proxy server, the request body is not restricted to 64k.</p>
4358
4359     <div class="note"><h3>Note</h3>
4360     <p>Despite claims to the contrary, <code>TRACE</code> is not
4361     a security vulnerability and there is no viable reason for
4362     it to be disabled. Doing so necessarily makes your server
4363     non-compliant.</p>
4364     </div>
4365
4366 </div>
4367 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4368 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
4369 <table class="directive">
4370 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
4371 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
4372 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4373 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4374 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4375 </table>
4376     <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
4377     of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
4378     <p>This directive can be used to toggle the use of <code class="directive"><a href="#ifdefine">&lt;IfDefine&gt;</a></code> sections without needing to alter
4379     <code>-D</code> arguments in any startup scripts.</p>
4380     <p>While this directive is supported in virtual host context,
4381        the changes it makes are visible to any later configuration
4382        directives, beyond any enclosing virtual host</p>
4383
4384 </div>
4385 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4386 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
4387 <table class="directive">
4388 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
4389 port</td></tr>
4390 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
4391 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
4392 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4393 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4394 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4395 </table>
4396     <p>In many situations Apache httpd must construct a <em>self-referential</em>
4397     URL -- that is, a URL that refers back to the same server. With
4398     <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4399     specified in the <code class="directive"><a href="#servername">ServerName</a></code>
4400     directive to construct the canonical name for the server. This name
4401     is used in all self-referential URLs, and for the values of
4402     <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4403
4404     <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4405     self-referential URLs using the hostname and port supplied by
4406     the client if any are supplied (otherwise it will use the
4407     canonical name, as defined above). These values are the same
4408     that are used to implement <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
4409     and are available with the same clients. The CGI variables
4410     <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4411     constructed from the client supplied values as well.</p>
4412
4413     <p>An example where this may be useful is on an intranet server
4414     where you have users connecting to the machine using short
4415     names such as <code>www</code>. You'll notice that if the users
4416     type a shortname, and a URL which is a directory, such as
4417     <code>http://www/splat</code>, <em>without the trailing
4418     slash</em> then Apache httpd will redirect them to
4419     <code>http://www.example.com/splat/</code>. If you have
4420     authentication enabled, this will cause the user to have to
4421     authenticate twice (once for <code>www</code> and once again
4422     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">
4423     the FAQ on this subject for more information</a>). But if
4424     <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
4425     Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4426
4427     <p>There is a third option, <code>UseCanonicalName DNS</code>,
4428     which is intended for use with mass IP-based virtual hosting to
4429     support ancient clients that do not provide a
4430     <code>Host:</code> header. With this option Apache httpd does a
4431     reverse DNS lookup on the server IP address that the client
4432     connected to in order to work out self-referential URLs.</p>
4433
4434     <div class="warning"><h3>Warning</h3>
4435     <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
4436     they may be broken by this option. The client is essentially free
4437     to give whatever value they want as a hostname. But if the CGI is
4438     only using <code>SERVER_NAME</code> to construct self-referential URLs
4439     then it should be just fine.</p>
4440     </div>
4441
4442 <h3>See also</h3>
4443 <ul>
4444 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4445 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4446 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4447 </ul>
4448 </div>
4449 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4450 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
4451 <table class="directive">
4452 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own port</td></tr>
4453 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
4454 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
4455 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4456 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4457 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4458 </table>
4459     <p>In many situations Apache httpd must construct a <em>self-referential</em>
4460     URL -- that is, a URL that refers back to the same server. With
4461     <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
4462     constructing the canonical port for the server to honor
4463     the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
4464     provide the actual physical port number being used by this request
4465     as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
4466     Apache httpd will not ever use the actual physical port number, instead
4467     relying on all configured information to construct a valid port number.</p>
4468
4469     <div class="note"><h3>Note</h3>
4470     <p>The ordering of the lookup when the physical port is used is as
4471     follows:</p>
4472      <dl>
4473      <dt><code>UseCanonicalName On</code></dt>
4474      <dd>
4475      <ol>
4476       <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4477       <li>Physical port</li>
4478       <li>Default port</li>
4479      </ol>
4480      </dd>
4481      <dt><code>UseCanonicalName Off | DNS</code></dt>
4482      <dd>
4483      <ol>
4484       <li>Parsed port from <code>Host:</code> header</li>
4485       <li>Physical port</li>
4486       <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4487       <li>Default port</li>
4488      </ol>
4489      </dd>
4490      </dl>
4491
4492     <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4493     physical ports are removed from the ordering.</p>
4494     </div>
4495
4496
4497 <h3>See also</h3>
4498 <ul>
4499 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4500 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4501 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4502 </ul>
4503 </div>
4504 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4505 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost">&lt;VirtualHost&gt;</a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
4506 <table class="directive">
4507 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
4508 hostname or IP address</td></tr>
4509 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;VirtualHost
4510     <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4511     ...&gt; ... &lt;/VirtualHost&gt;</code></td></tr>
4512 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4513 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4514 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4515 </table>
4516     <p><code class="directive">&lt;VirtualHost&gt;</code> and
4517     <code>&lt;/VirtualHost&gt;</code> are used to enclose a group of
4518     directives that will apply only to a particular virtual host. Any
4519     directive that is allowed in a virtual host context may be
4520     used. When the server receives a request for a document on a
4521     particular virtual host, it uses the configuration directives
4522     enclosed in the <code class="directive">&lt;VirtualHost&gt;</code>
4523     section. <var>Addr</var> can be any of the following, optionally followed by
4524     a colon and a port number (or *):</p>
4525
4526     <ul>
4527       <li>The IP address of the virtual host;</li>
4528
4529       <li>A fully qualified domain name for the IP address of the
4530       virtual host (not recommended);</li>
4531
4532       <li>The character <code>*</code>, which acts as a wildcard and matches
4533       any IP address.</li>
4534
4535       <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4536
4537     </ul>
4538
4539     <pre class="prettyprint lang-config">&lt;VirtualHost 10.1.2.3:80&gt;
4540   ServerAdmin webmaster@host.example.com
4541   DocumentRoot /www/docs/host.example.com
4542   ServerName host.example.com
4543   ErrorLog logs/host.example.com-error_log
4544   TransferLog logs/host.example.com-access_log
4545 &lt;/VirtualHost&gt;</pre>
4546
4547
4548
4549     <p>IPv6 addresses must be specified in square brackets because
4550     the optional port number could not be determined otherwise.  An
4551     IPv6 example is shown below:</p>
4552
4553     <pre class="prettyprint lang-config">&lt;VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80&gt;
4554   ServerAdmin webmaster@host.example.com
4555   DocumentRoot /www/docs/host.example.com
4556   ServerName host.example.com
4557   ErrorLog logs/host.example.com-error_log
4558   TransferLog logs/host.example.com-access_log
4559 &lt;/VirtualHost&gt;</pre>
4560
4561
4562     <p>Each Virtual Host must correspond to a different IP address,
4563     different port number or a different host name for the server,
4564     in the former case the server machine must be configured to
4565     accept IP packets for multiple addresses. (If the machine does
4566     not have multiple network interfaces, then this can be
4567     accomplished with the <code>ifconfig alias</code> command -- if
4568     your OS supports it).</p>
4569
4570     <div class="note"><h3>Note</h3>
4571     <p>The use of <code class="directive">&lt;VirtualHost&gt;</code> does
4572     <strong>not</strong> affect what addresses Apache httpd listens on. You
4573     may need to ensure that Apache httpd is listening on the correct addresses
4574     using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
4575     </div>
4576
4577     <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
4578     specified inside each <code class="directive">&lt;VirtualHost&gt;</code> block. If it is absent, the
4579     <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
4580     server configuration will be inherited.</p>
4581
4582     <p>When a request is received, the server first maps it to the best matching
4583     <code class="directive">&lt;VirtualHost&gt;</code> based on the local
4584     IP address and port combination only.  Non-wildcards have a higher
4585     precedence. If no match based on IP and port occurs at all, the
4586     "main" server configuration is used.</p>
4587
4588     <p>If multiple virtual hosts contain the best matching IP address and port,
4589     the server selects from these virtual hosts the best match based on the
4590     requested hostname.  If no matching name-based virtual host is found,
4591     then the first listed virtual host that matched the IP address will be
4592     used.  As a consequence, the first listed virtual host for a given IP address
4593     and port combination is default virtual host for that IP and port
4594     combination.</p>
4595
4596     <div class="warning"><h3>Security</h3>
4597     <p>See the <a href="../misc/security_tips.html">security tips</a>
4598     document for details on why your security could be compromised if the
4599     directory where log files are stored is writable by anyone other
4600     than the user that starts the server.</p>
4601     </div>
4602
4603 <h3>See also</h3>
4604 <ul>
4605 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4606 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4607     Apache HTTP Server</a></li>
4608 <li><a href="../bind.html">Setting
4609     which addresses and ports Apache HTTP Server uses</a></li>
4610 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
4611     and &lt;Files&gt; sections work</a> for an explanation of how these
4612     different sections are combined when a request is received</li>
4613 </ul>
4614 </div>
4615 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4616 <div class="directive-section"><h2><a name="Warning" id="Warning">Warning</a> <a name="warning" id="warning">Directive</a></h2>
4617 <table class="directive">
4618 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Warn from configuration parsing with a custom message</td></tr>
4619 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Warning <var>message</var></code></td></tr>
4620 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4621 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4622 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4623 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5 and later</td></tr>
4624 </table>
4625     <p>If an issue can be detected from within the configuration, this
4626     directive can be used to generate a custom warning message. The
4627     configuration parsing is not halted. The typical use it to check
4628     whether some user define options are set, and warn if not.</p>
4629
4630     <pre class="prettyprint lang-config"># Example
4631 # tell when ReverseProxy is not set
4632 &lt;IfDefine !ReverseProxy&gt;
4633   Warning "reverse proxy is not started, hope this is okay!"
4634 &lt;/IfDefine&gt;
4635
4636 &lt;IfDefine ReverseProxy&gt;
4637   # define custom proxy configuration
4638 &lt;/IfDefine&gt;</pre>
4639
4640
4641
4642 </div>
4643 </div>
4644 <div class="bottomlang">
4645 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
4646 <a href="../en/mod/core.html" title="English">&nbsp;en&nbsp;</a> |
4647 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
4648 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
4649 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
4650 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
4651 </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&amp;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>
4652 <script type="text/javascript"><!--//--><![CDATA[//><!--
4653 var comments_shortname = 'httpd';
4654 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/core.html';
4655 (function(w, d) {
4656     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
4657         d.write('<div id="comments_thread"><\/div>');
4658         var s = d.createElement('script');
4659         s.type = 'text/javascript';
4660         s.async = true;
4661         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
4662         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
4663     }
4664     else {
4665         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
4666     }
4667 })(window, document);
4668 //--><!]]></script></div><div id="footer">
4669 <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>
4670 <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[//><!--
4671 if (typeof(prettyPrint) !== 'undefined') {
4672     prettyPrint();
4673 }
4674 //--><!]]></script>
4675 </body></html>