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