2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
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
14 http://www.apache.org/licenses/LICENSE-2.0
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.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Core Apache HTTP Server features that are always
27 available</description>
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>
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&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>
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
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>
59 <p>The default values on FreeBSD are:</p>
60 <highlight language="config">
61 AcceptFilter http httpready
62 AcceptFilter https dataready
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&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&sektion=9">
71 accf_data(9)</a> filter is used.</p>
73 <p>The default values on Linux are:</p>
74 <highlight language="config">
75 AcceptFilter http data
76 AcceptFilter https data
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
83 <a href="http://man7.org/linux/man-pages/man7/tcp.7.html">
84 tcp(7)</a> man page.</p>
86 <p>The default values on Windows are:</p>
87 <highlight language="config">
88 AcceptFilter http connect
89 AcceptFilter https connect
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>
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
104 <note type="warning">
105 <title>The <code>data</code> AcceptFilter (Windows)</title>
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>
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>
121 <seealso><directive module="core">Protocol</directive></seealso>
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>
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
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>
150 <p>The three possible arguments for the
151 <directive>AcceptPathInfo</directive> directive are:</p>
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>
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>
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>
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
183 <highlight language="config">
184 <Files "mypaths.shtml">
186 SetOutputFilter INCLUDES
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>
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>
209 <highlight language="config">
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>
219 <highlight language="config">
220 <Directory "/">
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>
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>
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).
256 <highlight language="config">
257 AddDefaultCharset utf-8
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>
271 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
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>
283 NoDecode option available in 2.3.12 and later.</compatibility>
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>
291 <p>With the default value, <code>Off</code>, such URLs are refused
292 with a 404 (Not found) error.</p>
294 <p>With the value <code>On</code>, such URLs are accepted, and encoded
295 slashes are decoded like all other encoded characters.</p>
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>
300 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
301 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
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>
309 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
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>
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>
327 <note><title>Only available in <Directory> 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.
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>
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>
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>
353 <dt><a href="overrides.html#override-authconfig">AuthConfig</a></dt>
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>
366 <dt><a href="overrides.html#override-fileinfo">FileInfo</a></dt>
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>.
403 <dt><a href="overrides.html#override-indexes">Indexes</a></dt>
406 Allow use of the directives controlling directory indexing
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>,
422 <dt><a href="overrides.html#override-limit">Limit</a></dt>
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>
430 <!-- TODO - Update this for 2.4 syntax -->
433 <dt>Nonfatal=[Override|Unknown|All]</dt>
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:
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>
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.
458 <dt><a href="overrides.html#override-options">Options</a>[=<var>Option</var>,...]</dt>
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.
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.
478 AllowOverride Options=Indexes,MultiViews
485 <highlight language="config">
486 AllowOverride AuthConfig Indexes
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
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><Directory "/"></code> block. Instead, find (or
496 create) the <code><Directory></code> block that refers to the
497 directory where you're actually planning to place a
498 <code>.htaccess</code> file.</p>
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>
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>
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>
523 <note><title>Only available in <Directory> 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.
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>
540 <highlight language="config">
542 AllowOverrideList Redirect RedirectMatch
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>
551 <highlight language="config">
552 AllowOverride AuthConfig
553 AllowOverrideList CookieTracking CookieName
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>
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>
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>
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>
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>
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>
596 <override>FileInfo</override>
597 <compatibility>NetWare only</compatibility>
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>
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>
616 <override>AuthConfig</override>
617 <compatibility>Available in Apache HTTP Server 2.4.13 and later</compatibility>
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
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>
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
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>
651 <override>FileInfo</override>
652 <compatibility>Available in Apache HTTP Server 2.4.21 and later</compatibility>
655 <p>This directive controls how some CGI variables are set.</p>
657 <p><strong>REQUEST_URI</strong> rules:</p>
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
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>
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>
680 <override>Options</override>
681 <status>Experimental</status>
684 <p>This directive enables the generation of
685 <code>Content-MD5</code> headers as defined in RFC1864
686 respectively RFC2616.</p>
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>
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>
699 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
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>
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>
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>
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>
727 <p><strong>Example</strong></p>
728 <highlight language="config">
729 DefaultRuntimeDir scratch/
732 <p>The default location of <directive>DefaultRuntimeDir</directive> may be
733 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
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>
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>
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.
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>
758 <override>FileInfo</override>
759 <compatibility>All choices except <code>none</code> are DISABLED for 2.3.x and later.
763 <p>This directive has been disabled. For backwards compatibility
764 of configuration files, it may be specified with the value
765 <code>none</code>, meaning no default media type. For example:</p>
767 <highlight language="config">
771 <p><code>DefaultType None</code> is only available in
772 httpd-2.2.7 and later.</p>
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>
782 <seealso><directive module="core">UnDefine</directive></seealso>
783 <seealso><directive module="core">IfDefine</directive></seealso>
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>
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
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>
806 <highlight language="config">
807 <IfDefine TEST>
808 Define servername test.example.com
810 <IfDefine !TEST>
811 Define servername www.example.com
815 DocumentRoot "/var/www/${servername}/htdocs"
818 <p>Variable names may not contain colon ":" characters, to avoid clashes
819 with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
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>
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><Directory <var>directory-path</var>>
832 ... </Directory></syntax>
833 <contextlist><context>server config</context><context>virtual host</context>
837 <p><directive type="section">Directory</directive> and
838 <code></Directory></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><Directory
848 "/*/public_html"></code> will not match
849 <code>/home/user/public_html</code>, but <code><Directory
850 "/home/*/public_html"></code> will match. Example:</p>
852 <highlight language="config">
853 <Directory "/usr/local/httpd/htdocs">
854 Options Indexes FollowSymLinks
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>
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><Directory></code> will not apply to files accessed from
867 that same directory via a different path, such as via different symbolic
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>
875 <highlight language="config">
876 <Directory ~ "^/www/[0-9]{3}">
881 <p>would match directories in <code>/www/</code> that consisted of
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,
892 <highlight language="config">
893 <Directory "/">
897 <Directory "/home">
898 AllowOverride FileInfo
902 <p>for access to the document <code>/home/web/dir/doc.html</code>
906 <li>Apply directive <code>AllowOverride None</code>
907 (disabling <code>.htaccess</code> files).</li>
909 <li>Apply directive <code>AllowOverride FileInfo</code> (for
910 directory <code>/home</code>).</li>
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>
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>
922 <highlight language="config">
923 <Directory ~ "abc$">
924 # ... directives here ...
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
935 <p><strong>Note that the default access for
936 <code><Directory "/"></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
941 <highlight language="config">
942 <Directory "/">
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>
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>
958 <seealso><a href="../sections.html">How <Directory>,
959 <Location> and <Files> sections work</a> for an
960 explanation of how these different sections are combined when a
961 request is received</seealso>
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><DirectoryMatch <var>regex</var>>
969 ... </DirectoryMatch></syntax>
970 <contextlist><context>server config</context><context>virtual host</context>
974 <p><directive type="section">DirectoryMatch</directive> and
975 <code></DirectoryMatch></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>
981 <highlight language="config">
982 <DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
984 </DirectoryMatch>
987 <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
988 that consist of three numbers.</p>
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
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.
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>
1011 <highlight language="config">
1012 <DirectoryMatch "^/var/www/combined/(?<sitename>[^/]+)">
1013 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1014 </DirectoryMatch>
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>
1021 href="../sections.html">How <Directory>, <Location> and
1022 <Files> sections work</a> for an explanation of how these different
1023 sections are combined when a request is received</seealso>
1024 </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>
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>
1042 <highlight language="config">
1043 DocumentRoot "/usr/web"
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>
1052 <p>The <directive>DocumentRoot</directive> should be specified without
1053 a trailing slash.</p>
1055 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1056 Locations</a></seealso>
1057 </directivesynopsis>
1059 <directivesynopsis type="section">
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><Else> ... </Else></syntax>
1066 <contextlist><context>server config</context><context>virtual host</context>
1067 <context>directory</context><context>.htaccess</context>
1069 <override>All</override>
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>
1079 <highlight language="config">
1080 <If "-z req('Host')">
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>
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 <Directory>, <Location>,
1097 <Files> 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>
1104 <directivesynopsis type="section">
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><ElseIf <var>expression</var>> ... </ElseIf></syntax>
1112 <contextlist><context>server config</context><context>virtual host</context>
1113 <context>directory</context><context>.htaccess</context>
1115 <override>All</override>
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>
1124 <highlight language="config">
1125 <If "-R '10.1.0.0/16'">
1128 <ElseIf "-R '10.0.0.0/8'">
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>
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 <Directory>, <Location>,
1146 <Files> 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>
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>
1163 <override>FileInfo</override>
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>
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>
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.
1186 <p>For server configurations that are vulnerable to these problems,
1187 you should disable memory-mapping of delivered files by specifying:</p>
1189 <highlight language="config">
1193 <p>For NFS mounted files, this feature may be disabled explicitly for
1194 the offending files by specifying:</p>
1196 <highlight language="config">
1197 <Directory "/path-to-nfs-files">
1202 </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>
1212 <override>FileInfo</override>
1213 <compatibility>Default changed to Off in
1214 version 2.3.9.</compatibility>
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>
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>
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
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
1244 <p>For server configurations that are not vulnerable to these problems,
1245 you may enable this feature by specifying:</p>
1247 <highlight language="config">
1251 <p>For network mounted files, this feature may be disabled explicitly
1252 for the offending files by specifying:</p>
1254 <highlight language="config">
1255 <Directory "/path-to-nfs-files">
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.
1266 </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>
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 §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 §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>
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)
1293 <p>The directive accepts three parameters from the following list
1294 of choices, applying the default to the ones not specified:</p>
1297 <dt>Strict|Unsafe</dt>
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 §9.4 Request Splitting</a> and
1304 <a href="https://tools.ietf.org/html/rfc7230#section-9.5"
1305 >§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 §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>
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>
1325 <title>Example of a request leading to HTTP 400 with Strict mode</title>
1326 # Missing CRLF<br />
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>
1339 <dt>RegisteredMethods|LenientMethods</dt>
1341 <p><a href="https://tools.ietf.org/html/rfc7231#section-4.1"
1342 >RFC 7231 §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>
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>
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 />
1366 <dt>Allow0.9|Require1.0</dt>
1368 <p><a href="https://tools.ietf.org/html/rfc2616#section-19.6"
1369 >RFC 2616 §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
1379 <title>Example of a request leading to HTTP 400 with Require1.0 mode</title>
1380 # Unsupported HTTP version<br />
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>
1392 </directivesynopsis>
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>
1401 <override>All</override>
1402 <compatibility>2.3.9 and later</compatibility>
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>
1410 <highlight language="config">
1412 # ensure that mod_include is loaded
1413 <IfModule !include_module>
1414 Error "mod_include is required by mod_foo. Load it with LoadModule."
1417 # ensure that exactly one of SSL,NOSSL is defined
1418 <IfDefine SSL>
1419 <IfDefine NOSSL>
1420 Error "Both SSL and NOSSL are defined. Define only one of them."
1423 <IfDefine !SSL>
1424 <IfDefine !NOSSL>
1425 Error "Either SSL or NOSSL must be defined."
1431 </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>
1441 <override>FileInfo</override>
1444 <p>In the event of a problem or error, Apache httpd can be configured
1445 to do one of four things,</p>
1448 <li>output a simple hardcoded error message</li>
1450 <li>output a customized message</li>
1452 <li>internally redirect to a local <var>URL-path</var> to handle the
1455 <li>redirect to an external <var>URL</var> to handle the
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>
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>
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>
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}}
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>
1490 <highlight language="config">
1491 ErrorDocument 404 /cgi-bin/bad_urls.pl
1493 <Directory "/web/docs">
1494 ErrorDocument 404 default
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>
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"
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
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>
1538 <seealso><a href="../custom-error.html">documentation of
1539 customizable responses</a></seealso>
1540 </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>
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>
1556 <highlight language="config">
1557 ErrorLog "/var/log/httpd/error_log"
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>
1564 <highlight language="config">
1565 ErrorLog "|/usr/local/bin/httpd_errors"
1568 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1569 more information.</p>
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>
1583 <highlight language="config">
1584 ErrorLog syslog:user
1585 ErrorLog syslog:user:httpd.srv1
1586 ErrorLog syslog::httpd.srv2
1589 <p>Additional modules can provide their own ErrorLog providers. The syntax
1590 is similar to the <code>syslog</code> example above.</p>
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>
1604 <seealso><directive module="core">LogLevel</directive></seealso>
1605 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1606 </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>
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>
1620 <highlight language="config">
1622 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
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
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 </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 '% '
1645 (percent space) is a zero-width field delimiter that does not produce any
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
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>
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>
1664 <table border="1" style="zebra">
1665 <columnspec><column width=".3"/><column width=".7"/></columnspec>
1667 <tr><th>Modified Token</th><th>Meaning</th></tr>
1670 <td><code>%-{Referer}i</code></td>
1671 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1675 <td><code>%+{Referer}i</code></td>
1676 <td>Omits the entire line if <code>Referer</code> is not set.</td>
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>
1687 <p>Some format string items accept additional parameters in braces.</p>
1689 <table border="1" style="zebra">
1690 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1692 <tr><th>Format String</th> <th>Description</th></tr>
1694 <tr><td><code>%%</code></td>
1695 <td>The percent sign</td></tr>
1697 <tr><td><code>%a</code></td>
1698 <td>Client IP address and port of the request</td></tr>
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>
1704 <tr><td><code>%A</code></td>
1705 <td>Local IP-address and port</td></tr>
1707 <tr><td><code>%{<em>name</em>}e</code></td>
1708 <td>Request environment variable <em>name</em></td></tr>
1710 <tr><td><code>%E</code></td>
1711 <td>APR/OS error status code and string</td></tr>
1713 <tr><td><code>%F</code></td>
1714 <td>Source file name and line number of the log call</td></tr>
1716 <tr><td><code>%{<em>name</em>}i</code></td>
1717 <td>Request header <em>name</em></td></tr>
1719 <tr><td><code>%k</code></td>
1720 <td>Number of keep-alive requests on this connection</td></tr>
1722 <tr><td><code>%l</code></td>
1723 <td>Loglevel of the message</td></tr>
1725 <tr><td><code>%L</code></td>
1726 <td>Log ID of the request</td></tr>
1728 <tr><td><code>%{c}L</code></td>
1729 <td>Log ID of the connection</td></tr>
1731 <tr><td><code>%{C}L</code></td>
1732 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1734 <tr><td><code>%m</code></td>
1735 <td>Name of the module logging the message</td></tr>
1737 <tr><td><code>%M</code></td>
1738 <td>The actual log message</td></tr>
1740 <tr><td><code>%{<em>name</em>}n</code></td>
1741 <td>Request note <em>name</em></td></tr>
1743 <tr><td><code>%P</code></td>
1744 <td>Process ID of current process</td></tr>
1746 <tr><td><code>%T</code></td>
1747 <td>Thread ID of current thread</td></tr>
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>
1753 <tr><td><code>%t</code></td>
1754 <td>The current time</td></tr>
1756 <tr><td><code>%{u}t</code></td>
1757 <td>The current time including micro-seconds</td></tr>
1759 <tr><td><code>%{cu}t</code></td>
1760 <td>The current time in compact ISO 8601 format, including
1761 micro-seconds</td></tr>
1763 <tr><td><code>%v</code></td>
1764 <td>The canonical <directive module="core">ServerName</directive>
1765 of the current server.</td></tr>
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>
1772 <tr><td><code>\ </code> (backslash space)</td>
1773 <td>Non-field delimiting space</td></tr>
1775 <tr><td><code>% </code> (percent space)</td>
1776 <td>Field delimiter (no output)</td></tr>
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>
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% ,\ referer\ %{Referer}i"
1792 <p>This would result in error messages such as:</p>
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
1798 <p>Notice that, as discussed above, some fields are omitted
1799 entirely because they are not defined.</p>
1801 <highlight language="config">
1802 #Example (similar to the 2.2.x format)
1803 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
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"
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>
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>
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>
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>
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>
1853 </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>
1864 <override>FileInfo</override>
1865 <compatibility>The default used to be "INode MTime Size" in 2.3.14 and
1866 earlier.</compatibility>
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:
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
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>
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>
1902 <p>If a directory's configuration includes
1903 <code>FileETag INode MTime Size</code>, and a
1904 subdirectory's includes <code>FileETag -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 MTime 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 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>.
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.
1923 </directivesynopsis>
1925 <directivesynopsis type="section">
1927 <description>Contains directives that apply to matched
1928 filenames</description>
1929 <syntax><Files <var>filename</var>> ... </Files></syntax>
1930 <contextlist><context>server config</context><context>virtual host</context>
1931 <context>directory</context><context>.htaccess</context>
1933 <override>All</override>
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></Files></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>
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 <Files "cat.html">
1959 # Insert stuff that applies to cat.html here
1962 <Files "?at.*">
1963 # This would apply to cat.html, bat.html, hat.php and so on.
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>
1970 <highlight language="config">
1971 <Files ~ "\.(gif|jpe?g|png)$">
1976 <p>would match most common Internet graphics formats. <directive
1977 module="core" type="section">FilesMatch</directive> is preferred,
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>
1988 <seealso><a href="../sections.html">How <Directory>, <Location>
1989 and <Files> sections work</a> for an explanation of how these
1990 different sections are combined when a request is received</seealso>
1991 </directivesynopsis>
1993 <directivesynopsis type="section">
1994 <name>FilesMatch</name>
1995 <description>Contains directives that apply to regular-expression matched
1996 filenames</description>
1997 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1998 <contextlist><context>server config</context><context>virtual host</context>
1999 <context>directory</context><context>.htaccess</context>
2001 <override>All</override>
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>
2010 <highlight language="config">
2011 <FilesMatch ".+\.(gif|jpe?g|png)$">
2016 <p>would match most common Internet graphics formats.</p>
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>
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>
2029 <highlight language="config">
2030 <FilesMatch "^(?<sitename>[^/]+)">
2031 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
2036 <seealso><a href="../sections.html">How <Directory>, <Location>
2037 and <Files> sections work</a> for an explanation of how these
2038 different sections are combined when a request is received</seealso>
2039 </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>
2048 <override>FileInfo</override>
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>
2061 <highlight language="config">
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>
2069 <p>You can also override more general
2070 <directive>ForceType</directive> settings
2071 by using the value of <code>None</code>:</p>
2073 <highlight language="config">
2074 # force all files to be image/gif:
2075 <Location "/images">
2079 # but normal mime-type associations here:
2080 <Location "/images/mixed">
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>
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>
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.
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.
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>
2115 </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>
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>
2130 <p>This directive currently only works with the <module>prefork</module>
2133 </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>
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>
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>
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
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>
2179 </directivesynopsis>
2181 <directivesynopsis type="section">
2183 <description>Contains directives that apply only if a condition is
2184 satisfied by a request at runtime</description>
2185 <syntax><If <var>expression</var>> ... </If></syntax>
2186 <contextlist><context>server config</context><context>virtual host</context>
2187 <context>directory</context><context>.htaccess</context>
2189 <override>All</override>
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.
2197 <highlight language="config">
2198 <If "-z req('Host')">
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><</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>
2208 <highlight language="config">
2209 <If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/">
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>
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>
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).
2229 <note type="warning">
2230 Certain variables, such as <code>CONTENT_TYPE</code> and other
2231 response headers, are set after <If> conditions have already
2232 been evaluated, and so will not be available to use in this
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 <Directory>, <Location>,
2243 <Files> 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>
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><IfDefine [!]<var>parameter-name</var>> ...
2255 </IfDefine></syntax>
2256 <contextlist><context>server config</context><context>virtual host</context>
2257 <context>directory</context><context>.htaccess</context>
2259 <override>All</override>
2262 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
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
2269 <p>The <var>test</var> in the <directive type="section"
2270 >IfDefine</directive> section directive can be one of two forms:</p>
2273 <li><var>parameter-name</var></li>
2275 <li><code>!</code><var>parameter-name</var></li>
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>
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>
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>
2293 <example>httpd -DReverseProxy -DUseCache -DMemCache ...</example>
2294 <highlight language="config">
2295 <IfDefine ReverseProxy>
2296 LoadModule proxy_module modules/mod_proxy.so
2297 LoadModule proxy_http_module modules/mod_proxy_http.so
2298 <IfDefine UseCache>
2299 LoadModule cache_module modules/mod_cache.so
2300 <IfDefine MemCache>
2301 LoadModule mem_cache_module modules/mod_mem_cache.so
2303 <IfDefine !MemCache>
2304 LoadModule cache_disk_module modules/mod_cache_disk.so
2310 </directivesynopsis>
2312 <directivesynopsis type="section">
2314 <description>Encloses directives that will be processed only
2315 if file exists at startup</description>
2316 <syntax><IfFile [!]<var>parameter-name</var>> ...
2317 </IfFile></syntax>
2318 <contextlist><context>server config</context><context>virtual host</context>
2319 <context>directory</context><context>.htaccess</context>
2321 <override>All</override>
2324 <p>The <code><IfFile <var>filename</var>>...</IfFile>
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>
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>.
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>
2348 </directivesynopsis>
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><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2355 </IfModule></syntax>
2356 <contextlist><context>server config</context><context>virtual host</context>
2357 <context>directory</context><context>.htaccess</context>
2359 <override>All</override>
2362 <p>The <code><IfModule <var>test</var>>...</IfModule></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>
2369 <p>The <var>test</var> in the <directive type="section"
2370 >IfModule</directive> section directive can be one of two forms:</p>
2373 <li><var>module</var></li>
2375 <li>!<var>module</var></li>
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>
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>
2393 <p><directive type="section">IfModule</directive> sections are
2394 nest-able, which can be used to implement simple multiple-module
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>
2403 </directivesynopsis>
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><IfDirective [!]<var>directive-name</var>> ...
2410 </IfDirective></syntax>
2411 <contextlist><context>server config</context><context>virtual host</context>
2412 <context>directory</context><context>.htaccess</context>
2414 <override>All</override>
2417 <p>The <code><IfDirective <var>test</var>>...</IfDirective></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>
2424 <p>The <var>test</var> in the <directive type="section"
2425 >IfDirective</directive> section can be one of two forms:</p>
2428 <li><var>directive-name</var></li>
2430 <li>!<var>directive-name</var></li>
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>
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>
2446 <seealso><directive module="core" type="section">IfSection</directive></seealso>
2447 </directivesynopsis>
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><IfSection [!]<var>section-name</var>> ...
2454 </IfSection></syntax>
2455 <contextlist><context>server config</context><context>virtual host</context>
2456 <context>directory</context><context>.htaccess</context>
2458 <override>All</override>
2461 <p>The <code><IfSection
2462 <var>test</var>>...</IfSection></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
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>
2474 <p>The <var>section-name</var> must be specified without either
2475 the leading "<" or closing ">". The <var>test</var> in the
2476 <directive type="section">IfSection</directive> section can be one
2480 <li><var>section-name</var></li>
2481 <li>!<var>section-name</var></li>
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>
2493 <highlight language="config">
2494 <IfSection VirtualHost>
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>
2505 <seealso><directive module="core" type="section">IfDirective</directive></seealso>
2506 </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>
2516 <compatibility>Directory
2517 wildcard matching available in 2.3.6 and later</compatibility>
2520 <p>This directive allows inclusion of other configuration files
2521 from within the server configuration files.</p>
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>
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>
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>
2544 <highlight language="config">
2545 Include /usr/local/apache2/conf/ssl.conf
2546 Include /usr/local/apache2/conf/vhosts/*.conf
2549 <p>Or, providing paths relative to your <directive
2550 module="core">ServerRoot</directive> directory:</p>
2552 <highlight language="config">
2553 Include conf/ssl.conf
2554 Include conf/vhosts/*.conf
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>
2561 <highlight language="config">
2562 Include conf/vhosts/*/*.conf
2565 <p>Alternatively, the following command will just be ignored in case of
2566 missing files or directories:</p>
2568 <highlight language="config">
2569 IncludeOptional conf/vhosts/*/*.conf
2574 <seealso><directive module="core">IncludeOptional</directive></seealso>
2575 <seealso><program>apachectl</program></seealso>
2576 </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>
2586 <compatibility>Available in 2.3.6 and later</compatibility>
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>
2597 <seealso><directive module="core">Include</directive></seealso>
2598 <seealso><program>apachectl</program></seealso>
2599 </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>
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>
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>
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>
2636 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
2637 </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>
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>
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>
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>
2664 </directivesynopsis>
2666 <directivesynopsis type="section">
2668 <description>Restrict enclosed access controls to only certain HTTP
2669 methods</description>
2670 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
2671 </Limit></syntax>
2672 <contextlist><context>directory</context><context>.htaccess</context>
2674 <override>AuthConfig, Limit</override>
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>
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>
2692 <highlight language="config">
2693 <Limit POST PUT DELETE>
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>
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>
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>
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>
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
2736 <highlight language="config">
2737 <LimitExcept GET>
2739 </LimitExcept>
2741 Require group editors
2745 </directivesynopsis>
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><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2752 </LimitExcept></syntax>
2753 <contextlist><context>directory</context><context>.htaccess</context>
2755 <override>AuthConfig, Limit</override>
2758 <p><directive type="section">LimitExcept</directive> and
2759 <code></LimitExcept></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>
2770 <highlight language="config">
2771 <LimitExcept POST GET>
2773 </LimitExcept>
2777 </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>
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>
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>
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>
2807 <highlight language="config">
2808 LimitInternalRecursion 5
2811 </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>
2822 <override>All</override>
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>
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>
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
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>
2852 <highlight language="config">
2853 LimitRequestBody 102400
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>
2861 </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>
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
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>
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>
2897 <highlight language="config">
2898 LimitRequestFields 50
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>
2908 </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>
2919 <p>This directive specifies the number of <var>bytes</var>
2920 that will be allowed in an HTTP request header.</p>
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>
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>
2938 <highlight language="config">
2939 LimitRequestFieldSize 4094
2942 <note>Under normal conditions, the value should not be changed from
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>
2951 </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>
2962 <p>This directive sets the number of <var>bytes</var> that will be
2963 allowed on the HTTP request-line.</p>
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>
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>
2981 <highlight language="config">
2982 LimitRequestLine 4094
2985 <note>Under normal conditions, the value should not be changed from
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>
2995 </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>
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>
3012 <highlight language="config">
3013 LimitXMLRequestBody 0
3017 </directivesynopsis>
3019 <directivesynopsis type="section">
3020 <name>Location</name>
3021 <description>Applies the enclosed directives only to matching
3023 <syntax><Location
3024 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
3025 <contextlist><context>server config</context><context>virtual host</context>
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></Location></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>
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>
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:
3051 <li>The specified location matches exactly the path component of the URL.
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).
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).
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.
3065 <highlight language="config">
3066 <Location "/private1">
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.
3075 <highlight language="config">
3076 <Location "/private2<em>/</em>">
3081 <note><title>When to use <directive
3082 type="section">Location</directive></title>
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><Location "/"></code>, which is an easy way to
3090 apply a configuration to the entire server.</p>
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
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>
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>
3108 <highlight language="config">
3109 <Location ~ "/(extra|special)/data">
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>
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>
3128 <highlight language="config">
3129 <Location "/status">
3130 SetHandler server-status
3131 Require host example.com
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>
3146 <p>For example, <code><LocationMatch "^/abc"></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><Location "/abc/def"></code> and the
3154 request is to <code>/abc//def</code> then it will match.</p>
3157 <seealso><a href="../sections.html">How <Directory>, <Location>
3158 and <Files> 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>
3163 <directivesynopsis type="section">
3164 <name>LocationMatch</name>
3165 <description>Applies the enclosed directives only to regular-expression
3166 matching URLs</description>
3167 <syntax><LocationMatch
3168 <var>regex</var>> ... </LocationMatch></syntax>
3169 <contextlist><context>server config</context><context>virtual host</context>
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>
3179 <highlight language="config">
3180 <LocationMatch "/(extra|special)/data">
3182 </LocationMatch>
3185 <p>would match URLs that contained the substring <code>/extra/data</code>
3186 or <code>/special/data</code>.</p>
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>
3193 <highlight language="config">
3194 <LocationMatch "^/(extra|special)/data">
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>
3205 <highlight language="config">
3206 <LocationMatch "^/combined/(?<sitename>[^/]+)">
3207 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
3208 </LocationMatch>
3212 <seealso><a href="../sections.html">How <Directory>, <Location>
3213 and <Files> sections work</a> for an explanation of how these
3214 different sections are combined when a request is received</seealso>
3215 </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>] ...
3223 <default>LogLevel warn</default>
3224 <contextlist><context>server config</context><context>virtual host</context>
3225 <context>directory</context>
3227 <compatibility>Per-module and per-directory configuration is available in
3228 Apache HTTP Server 2.3.6 and later</compatibility>
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
3238 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
3241 <th><strong>Level</strong> </th>
3243 <th><strong>Description</strong> </th>
3245 <th><strong>Example</strong> </th>
3249 <td><code>emerg</code> </td>
3251 <td>Emergencies - system is unusable.</td>
3253 <td>"Child cannot open lock file. Exiting"</td>
3257 <td><code>alert</code> </td>
3259 <td>Action must be taken immediately.</td>
3261 <td>"getpwuid: couldn't determine user name from uid"</td>
3265 <td><code>crit</code> </td>
3267 <td>Critical Conditions.</td>
3269 <td>"socket: Failed to get a socket, exiting child"</td>
3273 <td><code>error</code> </td>
3275 <td>Error conditions.</td>
3277 <td>"Premature end of script headers"</td>
3281 <td><code>warn</code> </td>
3283 <td>Warning conditions.</td>
3285 <td>"child process 1234 did not exit, sending another
3290 <td><code>notice</code> </td>
3292 <td>Normal but significant condition.</td>
3294 <td>"httpd: caught SIGBUS, attempting to dump core in
3299 <td><code>info</code> </td>
3301 <td>Informational.</td>
3303 <td>"Server seems busy, (you may need to increase
3304 StartServers, or Min/MaxSpareServers)..."</td>
3308 <td><code>debug</code> </td>
3310 <td>Debug-level messages</td>
3312 <td>"Opening config file ..."</td>
3315 <td><code>trace1</code> </td>
3317 <td>Trace messages</td>
3319 <td>"proxy: FTP: control connection complete"</td>
3322 <td><code>trace2</code> </td>
3324 <td>Trace messages</td>
3326 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
3329 <td><code>trace3</code> </td>
3331 <td>Trace messages</td>
3333 <td>"openssl: Handshake: start"</td>
3336 <td><code>trace4</code> </td>
3338 <td>Trace messages</td>
3340 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
3343 <td><code>trace5</code> </td>
3345 <td>Trace messages</td>
3347 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
3350 <td><code>trace6</code> </td>
3352 <td>Trace messages</td>
3354 <td>"cache lookup FAILED, forcing new map lookup"</td>
3357 <td><code>trace7</code> </td>
3359 <td>Trace messages, dumping large amounts of data</td>
3361 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
3364 <td><code>trace8</code> </td>
3366 <td>Trace messages, dumping large amounts of data</td>
3368 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
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>
3378 <p>Using a level of at least <code>crit</code> is
3383 <highlight language="config">
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>
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
3402 <highlight language="config">
3403 LogLevel info ssl:warn
3404 LogLevel info mod_ssl.c:warn
3405 LogLevel info ssl_module:warn
3408 <p>It is also possible to change the level per directory:</p>
3410 <highlight language="config">
3412 <Directory "/usr/local/apache/htdocs/app">
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,
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>
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>] ...
3438 <default>unset</default>
3439 <contextlist><context>server config</context><context>virtual host</context>
3441 <compatibility>Available in Apache HTTP Server 2.5.0 and later</compatibility>
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
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>
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>
3466 <highlight language="config">
3467 LogLevelOverride 192.0.2.0/24 ssl:trace6
3468 LogLevelOverride 192.0.2.7 ssl:trace8
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.
3478 <seealso><directive module="core">LogLevel</directive></seealso>
3479 </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>
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>
3500 <highlight language="config">
3501 MaxKeepAliveRequests 500
3504 </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>
3515 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
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>
3524 <dt><strong>default</strong></dt>
3525 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3527 <dt><strong>none</strong></dt>
3528 <dd>Range headers are ignored.</dd>
3530 <dt><strong>unlimited</strong></dt>
3531 <dd>The server does not limit the number of ranges it is
3532 willing to satisfy.</dd>
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>
3539 </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>
3550 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
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>
3559 <dt><strong>default</strong></dt>
3560 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3562 <dt><strong>none</strong></dt>
3563 <dd>No overlapping Range headers are allowed.</dd>
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>
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>
3574 </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>
3585 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
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>
3594 <dt><strong>default</strong></dt>
3595 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3597 <dt><strong>none</strong></dt>
3598 <dd>No Range reversals headers are allowed.</dd>
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>
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>
3609 </directivesynopsis>
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>
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>
3628 <p>The <directive>Mutex</directive> directive is typically used in
3629 the following exceptional situations:</p>
3632 <li>change the mutex mechanism when the default mechanism selected
3633 by <glossary>APR</glossary> has a functional or performance
3636 <li>change the directory used by file-based mutexes when the
3637 default directory does not support locking</li>
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>
3649 <p>The following mutex <em>mechanisms</em> are available:</p>
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>
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>
3662 <li><code>posixsem</code>
3663 <p>This is a mutex variant based on a Posix semaphore.</p>
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>
3671 <li><code>sysvsem</code>
3672 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
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>
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>
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>
3691 <li><code>pthread</code>
3692 <p>This is a mutex variant based on cross-process Posix thread
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>
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>
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>
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>
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
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>
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>
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
3763 <p>The following table documents the names of mutexes used by httpd
3764 and bundled modules.</p>
3766 <table border="1" style="zebra">
3770 <th>Protected resource</th>
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>
3781 <td><code>authdigest-client</code></td>
3782 <td><module>mod_auth_digest</module></td>
3783 <td>client list in shared memory</td>
3786 <td><code>authdigest-opaque</code></td>
3787 <td><module>mod_auth_digest</module></td>
3788 <td>counter in shared memory</td>
3791 <td><code>ldap-cache</code></td>
3792 <td><module>mod_ldap</module></td>
3793 <td>LDAP result cache</td>
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>
3802 <td><code>ssl-cache</code></td>
3803 <td><module>mod_ssl</module></td>
3804 <td>SSL session cache</td>
3807 <td><code>ssl-stapling</code></td>
3808 <td><module>mod_ssl</module></td>
3809 <td>OCSP stapling response cache</td>
3812 <td><code>watchdog-callback</code></td>
3813 <td><module>mod_watchdog</module></td>
3814 <td>callback function of a particular client module</td>
3818 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3819 parent process id from the lock file name.</p>
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>
3827 <highlight language="config">
3828 Mutex sysvsem default
3829 Mutex fcntl:/var/httpd/locks mpm-accept
3832 </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>
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>
3849 <p>This directive currently has no effect.</p>
3852 <seealso><a href="../vhosts/">Virtual Hosts
3853 documentation</a></seealso>
3855 </directivesynopsis>
3858 <name>Options</name>
3859 <description>Configures what features are available in a particular
3860 directory</description>
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>
3867 <override>Options</override>
3868 <compatibility>The default was changed from All to FollowSymlinks in 2.3.11</compatibility>
3871 <p>The <directive>Options</directive> directive controls which
3872 server features are available in a particular directory.</p>
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
3879 <dt><code>All</code></dt>
3881 <dd>All options except for <code>MultiViews</code>.</dd>
3883 <dt><code>ExecCGI</code></dt>
3886 Execution of CGI scripts using <module>mod_cgi</module>
3889 <dt><code>FollowSymLinks</code></dt>
3892 The server will follow symbolic links in this directory. This is
3893 the default setting.
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>
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>
3905 <p>Omitting this option should not be considered a security restriction,
3906 since symlink testing is subject to race conditions that make it
3910 <dt><code>Includes</code></dt>
3913 Server-side includes provided by <module>mod_include</module>
3916 <dt><code>IncludesNOEXEC</code></dt>
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
3926 <dt><code>Indexes</code></dt>
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>
3935 <dt><code>MultiViews</code></dt>
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>
3947 <dt><code>SymLinksIfOwnerMatch</code></dt>
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
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>
3960 <p>This option should not be considered a security restriction,
3961 since symlink testing is subject to race conditions that make it
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
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>
3984 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3986 <highlight language="config">
3987 <Directory "/web/docs">
3988 Options Indexes FollowSymLinks
3991 <Directory "/web/docs/spec">
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>
4001 <highlight language="config">
4002 <Directory "/web/docs">
4003 Options Indexes FollowSymLinks
4006 <Directory "/web/docs/spec">
4007 Options +Includes -Indexes
4011 <p>then the options <code>FollowSymLinks</code> and
4012 <code>Includes</code> are set for the <code>/web/docs/spec</code>
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>
4021 <p>The default in the absence of any other settings is
4022 <code>FollowSymlinks</code>.</p>
4024 </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>
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>
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>
4043 <p>For example, if you are running <code>https</code> on a non-standard port,
4044 specify the protocol explicitly:</p>
4046 <highlight language="config">
4050 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
4052 <seealso><directive module="core">AcceptFilter</directive></seealso>
4053 <seealso><directive module="mpm_common">Listen</directive></seealso>
4054 </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>
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>
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
4075 <p>For example, if you want to support HTTP/2 for a server with TLS,
4078 <highlight language="config">
4079 Protocols h2 http/1.1
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>
4086 <p>It is safe to specify protocols that are unavailable/disabled. Such
4087 protocol names will simply be ignored.</p>
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.
4096 <seealso><directive module="core">ProtocolsHonorOrder</directive></seealso>
4097 </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>
4109 <p>This directive specifies if the server should honor the order in which
4110 the <directive>Protocols</directive> directive lists protocols.</p>
4112 <p>If configured Off, the client supplied list order of protocols has
4113 precedence over the order in the server configuration.</p>
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
4121 <seealso><directive module="core">Protocols</directive></seealso>
4122 </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>
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
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
4151 <p>CPU resource limits are expressed in seconds per
4154 <seealso><directive module="core">RLimitMEM</directive></seealso>
4155 <seealso><directive module="core">RLimitNPROC</directive></seealso>
4156 </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>
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
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
4184 <p>Memory resource limits are expressed in bytes per
4187 <seealso><directive module="core">RLimitCPU</directive></seealso>
4188 <seealso><directive module="core">RLimitNPROC</directive></seealso>
4189 </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>
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
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
4217 <p>Process limits control the number of processes per user.</p>
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>
4228 <seealso><directive module="core">RLimitMEM</directive></seealso>
4229 <seealso><directive module="core">RLimitCPU</directive></seealso>
4230 </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>
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>
4250 <highlight language="perl">
4251 #!C:/Perl/bin/perl.exe
4254 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
4256 <highlight language="perl">
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>
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
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>
4291 </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>
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>
4312 <p>If Apache httpd is handling <code
4313 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
4314 > mod_status displays as follows:
4319 <th>Off (default)</th>
4320 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
4324 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
4329 </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>
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
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
4351 <p>It may be worth setting up a dedicated address for this, e.g.</p>
4353 <highlight language="config">
4354 ServerAdmin www-admin@foo.example.com
4356 <p>as users do not always mention that they are talking about the
4359 </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>
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>
4374 <highlight language="config">
4375 <VirtualHost *:80>
4376 ServerName server.example.com
4377 ServerAlias server server2.example.com server2
4378 ServerAlias *.example.com
4379 UseCanonicalName Off
4381 </VirtualHost>
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>
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>
4397 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4398 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4399 </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>
4410 <p>The <directive>ServerName</directive> directive sets the
4411 request scheme, hostname and port that the server uses to identify itself.
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>
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
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>
4430 <highlight language="config">
4431 ServerName www.example.com
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
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>
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>
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>
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.
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.
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>
4481 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
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>
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>
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>
4508 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4509 </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>
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>
4527 <highlight language="config">
4528 ServerRoot "/home/httpd"
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>
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>
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>
4553 <override>All</override>
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>
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
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>
4579 <seealso><directive module="core">ServerTokens</directive></seealso>
4580 </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>
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>
4597 <dt><code>ServerTokens Full</code> (or not specified)</dt>
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>
4602 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4604 <dd>Server sends (<em>e.g.</em>): <code>Server:
4607 <dt><code>ServerTokens Major</code></dt>
4609 <dd>Server sends (<em>e.g.</em>): <code>Server:
4610 Apache/2</code></dd>
4612 <dt><code>ServerTokens Minor</code></dt>
4614 <dd>Server sends (<em>e.g.</em>): <code>Server:
4615 Apache/2.4</code></dd>
4617 <dt><code>ServerTokens Min[imal]</code></dt>
4619 <dd>Server sends (<em>e.g.</em>): <code>Server:
4620 Apache/2.4.2</code></dd>
4622 <dt><code>ServerTokens OS</code></dt>
4624 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4629 <p>This setting applies to the entire server, and cannot be
4630 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
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>
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>
4643 <seealso><directive module="core">ServerSignature</directive></seealso>
4644 </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>
4654 <override>FileInfo</override>
4655 <compatibility>2.5 and later</compatibility>
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>
4668 <highlight language="config">
4669 SetHandler imap-file
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>
4677 <highlight language="config">
4678 <Location "/status">
4679 SetHandler server-status
4683 <p>You could also use this directive to configure a particular
4684 handler for files with a particular file extension. For example:</p>
4686 <highlight language="config">
4687 <FilesMatch "\.php$">
4688 SetHandler application/x-httpd-php
4692 <p>String-valued expressions can be used to reference per-request
4693 variables, including backreferences to named regular expressions:</p>
4695 <highlight language="config">
4696 <LocationMatch ^/app/(?<sub>[^/]+)/>
4697 SetHandler "proxy:unix:/var/run/app_%{env:MATCH_sub}.sock|fcgi://localhost:8080"
4698 </LocationMatch>
4701 <p>You can override an earlier defined <directive>SetHandler</directive>
4702 directive by using the value <code>None</code>.</p>
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>
4710 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
4712 </directivesynopsis>
4715 <name>SetInputFilter</name>
4716 <description>Sets the filters that will process client requests and POST
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>
4722 <override>FileInfo</override>
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>
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
4736 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4737 </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>
4747 <override>FileInfo</override>
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>
4757 <p>For example, the following configuration will process all files
4758 in the <code>/www/data/</code> directory for server-side
4761 <highlight language="config">
4762 <Directory "/www/data/">
4763 SetOutputFilter INCLUDES
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
4771 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4772 </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>
4783 <p>The <directive>TimeOut</directive> directive defines the length
4784 of time Apache httpd will wait for I/O in various circumstances:</p>
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
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>
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
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>
4803 <li>In <module>mod_ext_filter</module>, the length of time to
4804 wait for output from a filtering process.</li>
4806 <li>In <module>mod_proxy</module>, the default timeout value if
4807 <directive module="mod_proxy">ProxyTimeout</directive> is not
4812 </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>
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>
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>
4838 <note><title>Note</title>
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>
4847 </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>
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>
4866 <seealso><directive module="core">Define</directive></seealso>
4867 <seealso><directive module="core">IfDefine</directive></seealso>
4868 </directivesynopsis>
4871 <name>UseCanonicalName</name>
4872 <description>Configures how the server determines its own name and
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>
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>
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>
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>
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>
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>
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>
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>
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>
4952 <note><title>Note</title>
4953 <p>The ordering of the lookup when the physical port is used is as
4956 <dt><code>UseCanonicalName On</code></dt>
4959 <li>Port provided in <directive module="core">Servername</directive></li>
4960 <li>Physical port</li>
4961 <li>Default port</li>
4964 <dt><code>UseCanonicalName Off | DNS</code></dt>
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>
4975 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4976 physical ports are removed from the ordering.</p>
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>
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><VirtualHost
4990 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4991 ...> ... </VirtualHost></syntax>
4992 <contextlist><context>server config</context></contextlist>
4995 <p><directive type="section">VirtualHost</directive> and
4996 <code></VirtualHost></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>
5006 <li>The IP address of the virtual host;</li>
5008 <li>A fully qualified domain name for the IP address of the
5009 virtual host (not recommended);</li>
5011 <li>The character <code>*</code>, which acts as a wildcard and matches
5012 any IP address.</li>
5014 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
5018 <highlight language="config">
5019 <VirtualHost 10.1.2.3:80>
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 </VirtualHost>
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>
5033 <highlight language="config">
5034 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
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 </VirtualHost>
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>
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>
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>
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>
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
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>
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 <Directory>, <Location>
5091 and <Files> sections work</a> for an explanation of how these
5092 different sections are combined when a request is received</seealso>
5093 </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>
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>
5109 </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>
5118 <override>All</override>
5119 <compatibility>2.5 and later</compatibility>
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>
5127 <highlight language="config">
5129 # tell when ReverseProxy is not set
5130 <IfDefine !ReverseProxy>
5131 Warning "reverse proxy is not started, hope this is okay!"
5134 <IfDefine ReverseProxy>
5135 # define custom proxy configuration
5140 </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>
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>
5158 </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>
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>
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.
5184 </directivesynopsis>