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</directive>
557 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>DefaultStateDir</name>
748 <description>Base directory for the persistent state files</description>
749 <syntax>DefaultStateDir <var>directory-path</var></syntax>
750 <default>DefaultStateDir DEFAULT_REL_STATEDIR (state/)</default>
751 <contextlist><context>server config</context></contextlist>
752 <compatibility>Available in Apache 2.5.1 and later</compatibility>
755 <p>The <directive>DefaultStateDir</directive> directive sets the
756 directory in which the server will create various persistent state
757 files (databases, long-lived caches, etc.). If set as a relative
758 path, the full path will be relative to
759 <directive module="core">ServerRoot</directive>.</p>
761 <p><strong>Example</strong></p>
762 <highlight language="config">
763 DefaultStateDir state/
766 <p>The default location of <directive>DefaultStateDir</directive> may be
767 modified by changing the <code>DEFAULT_REL_STATEDIR</code> #define
770 <p>Note: <directive module="core">ServerRoot</directive> should be specified before this
771 directive is used. Otherwise, the default value of <directive module="core">ServerRoot</directive>
772 would be used to set the base directory.</p>
775 <seealso><a href="../misc/security_tips.html#serverroot">the
776 security tips</a> for information on how to properly set
777 permissions on the <directive module="core">ServerRoot</directive></seealso>
781 <name>DefaultType</name>
782 <description>This directive has no effect other than to emit warnings
783 if the value is not <code>none</code>. In prior versions, DefaultType
784 would specify a default media type to assign to response content for
785 which no other media type configuration could be found.
787 <syntax>DefaultType <var>media-type|none</var></syntax>
788 <default>DefaultType none</default>
789 <contextlist><context>server config</context><context>virtual host</context>
790 <context>directory</context><context>.htaccess</context>
792 <override>FileInfo</override>
793 <compatibility>All choices except <code>none</code> are DISABLED for 2.3.x and later.
797 <p>This directive has been disabled. For backwards compatibility
798 of configuration files, it may be specified with the value
799 <code>none</code>, meaning no default media type. For example:</p>
801 <highlight language="config">
805 <p><code>DefaultType None</code> is only available in
806 httpd-2.2.7 and later.</p>
808 <p>Use the mime.types configuration file and the
809 <directive module="mod_mime">AddType</directive> to configure media
810 type assignments via file extensions, or the
811 <directive module="core">ForceType</directive> directive to configure
812 the media type for specific resources. Otherwise, the server will
813 send the response without a Content-Type header field and the
814 recipient may attempt to guess the media type.</p>
816 <seealso><directive module="core">UnDefine</directive></seealso>
817 <seealso><directive module="core">IfDefine</directive></seealso>
822 <description>Define a variable</description>
823 <syntax>Define <var>parameter-name</var> [<var>parameter-value</var>]</syntax>
824 <contextlist><context>server config</context><context>virtual host</context>
828 <p>In its one parameter form, <directive>Define</directive> is
829 equivalent to passing the <code>-D</code> argument to
830 <program>httpd</program>. It can be used to toggle the use of
831 <directive module="core" type="section">IfDefine</directive>
832 sections without needing to alter <code>-D</code> arguments in any
835 <p>In addition to that, if the second parameter is given, a config variable
836 is set to this value. The variable can be used in the configuration using
837 the <code>${VAR}</code> syntax. The variable is always globally defined
838 and not limited to the scope of the surrounding config section.</p>
840 <highlight language="config">
841 <IfDefine TEST>
842 Define servername test.example.com
844 <IfDefine !TEST>
845 Define servername www.example.com
849 DocumentRoot "/var/www/${servername}/htdocs"
852 <p>Variable names may not contain colon ":" characters, to avoid clashes
853 with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
855 <note><title>Virtual Host scope and pitfalls</title>
856 <p>While this directive is supported in virtual host context,
857 the changes it makes are visible to any later configuration
858 directives, beyond any enclosing virtual host.</p>
863 <directivesynopsis type="section">
864 <name>Directory</name>
865 <description>Enclose a group of directives that apply only to the
866 named file-system directory, sub-directories, and their contents.</description>
867 <syntax><Directory <var>directory-path</var>>
868 ... </Directory></syntax>
869 <contextlist><context>server config</context><context>virtual host</context>
873 <p><directive type="section">Directory</directive> and
874 <code></Directory></code> are used to enclose a group of
875 directives that will apply only to the named directory,
876 sub-directories of that directory, and the files within the respective
877 directories. Any directive that is allowed
878 in a directory context may be used. <var>Directory-path</var> is
879 either the full path to a directory, or a wild-card string using
880 Unix shell-style matching. In a wild-card string, <code>?</code> matches
881 any single character, and <code>*</code> matches any sequences of
882 characters. You may also use <code>[]</code> character ranges. None
883 of the wildcards match a `/' character, so <code><Directory
884 "/*/public_html"></code> will not match
885 <code>/home/user/public_html</code>, but <code><Directory
886 "/home/*/public_html"></code> will match. Example:</p>
888 <highlight language="config">
889 <Directory "/usr/local/httpd/htdocs">
890 Options Indexes FollowSymLinks
894 <p>Directory paths <em>may</em> be quoted, if you like, however, it
895 <em>must</em> be quoted if the path contains spaces. This is because a
896 space would otherwise indicate the end of an argument.</p>
899 <p>Be careful with the <var>directory-path</var> arguments:
900 They have to literally match the filesystem path which Apache httpd uses
901 to access the files. Directives applied to a particular
902 <code><Directory></code> will not apply to files accessed from
903 that same directory via a different path, such as via different symbolic
907 <p><glossary ref="regex">Regular
908 expressions</glossary> can also be used, with the addition of the
909 <code>~</code> character. For example:</p>
911 <highlight language="config">
912 <Directory ~ "^/www/[0-9]{3}">
917 <p>would match directories in <code>/www/</code> that consisted of
920 <p>If multiple (non-regular expression) <directive
921 type="section">Directory</directive> sections
922 match the directory (or one of its parents) containing a document,
923 then the directives are applied in the order of shortest match
924 first, interspersed with the directives from the <a
925 href="#accessfilename">.htaccess</a> files. For example,
928 <highlight language="config">
929 <Directory "/">
933 <Directory "/home">
934 AllowOverride FileInfo
938 <p>for access to the document <code>/home/web/dir/doc.html</code>
942 <li>Apply directive <code>AllowOverride None</code>
943 (disabling <code>.htaccess</code> files).</li>
945 <li>Apply directive <code>AllowOverride FileInfo</code> (for
946 directory <code>/home</code>).</li>
948 <li>Apply any <code>FileInfo</code> directives in
949 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
950 <code>/home/web/dir/.htaccess</code> in that order.</li>
953 <p>Regular expressions are not considered until after all of the
954 normal sections have been applied. Then all of the regular
955 expressions are tested in the order they appeared in the
956 configuration file. For example, with</p>
958 <highlight language="config">
959 <Directory ~ "abc$">
960 # ... directives here ...
964 <p>the regular expression section won't be considered until after
965 all normal <directive type="section">Directory</directive>s and
966 <code>.htaccess</code> files have been applied. Then the regular
967 expression will match on <code>/home/abc/public_html/abc</code> and
968 the corresponding <directive type="section">Directory</directive> will
971 <p><strong>Note that the default access for
972 <code><Directory "/"></code> is to permit all access.
973 This means that Apache httpd will serve any file mapped from an URL. It is
974 recommended that you change this with a block such
977 <highlight language="config">
978 <Directory "/">
983 <p><strong>and then override this for directories you
984 <em>want</em> accessible. See the <a
985 href="../misc/security_tips.html">Security Tips</a> page for more
986 details.</strong></p>
988 <p>The directory sections occur in the <code>httpd.conf</code> file.
989 <directive type="section">Directory</directive> directives
990 cannot nest, and cannot appear in a <directive module="core"
991 type="section">Limit</directive> or <directive module="core"
992 type="section">LimitExcept</directive> section.</p>
994 <seealso><a href="../sections.html">How <Directory>,
995 <Location> and <Files> sections work</a> for an
996 explanation of how these different sections are combined when a
997 request is received</seealso>
1000 <directivesynopsis type="section">
1001 <name>DirectoryMatch</name>
1002 <description>Enclose directives that apply to
1003 the contents of file-system directories matching a regular expression.</description>
1004 <syntax><DirectoryMatch <var>regex</var>>
1005 ... </DirectoryMatch></syntax>
1006 <contextlist><context>server config</context><context>virtual host</context>
1010 <p><directive type="section">DirectoryMatch</directive> and
1011 <code></DirectoryMatch></code> are used to enclose a group
1012 of directives which will apply only to the named directory (and the files within),
1013 the same as <directive module="core" type="section">Directory</directive>.
1014 However, it takes as an argument a
1015 <glossary ref="regex">regular expression</glossary>. For example:</p>
1017 <highlight language="config">
1018 <DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
1020 </DirectoryMatch>
1023 <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
1024 that consist of three numbers.</p>
1026 <note><title>Compatibility</title>
1027 Prior to 2.3.9, this directive implicitly applied to sub-directories
1028 (like <directive module="core" type="section">Directory</directive>) and
1029 could not match the end of line symbol ($). In 2.3.9 and later,
1030 only directories that match the expression are affected by the enclosed
1034 <note><title>Trailing Slash</title>
1035 This directive applies to requests for directories that may or may
1036 not end in a trailing slash, so expressions that are anchored to the
1037 end of line ($) must be written with care.
1040 <p>From 2.4.8 onwards, named groups and backreferences are captured and
1041 written to the environment with the corresponding name prefixed with
1042 "MATCH_" and in upper case. This allows elements of paths to be referenced
1043 from within <a href="../expr.html">expressions</a> and modules like
1044 <module>mod_rewrite</module>. In order to prevent confusion, numbered
1045 (unnamed) backreferences are ignored. Use named groups instead.</p>
1047 <highlight language="config">
1048 <DirectoryMatch "^/var/www/combined/(?<sitename>[^/]+)">
1049 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1050 </DirectoryMatch>
1053 <seealso><directive type="section" module="core">Directory</directive> for
1054 a description of how regular expressions are mixed in with normal
1055 <directive type="section">Directory</directive>s</seealso>
1057 href="../sections.html">How <Directory>, <Location> and
1058 <Files> sections work</a> for an explanation of how these different
1059 sections are combined when a request is received</seealso>
1060 </directivesynopsis>
1063 <name>DocumentRoot</name>
1064 <description>Directory that forms the main document tree visible
1065 from the web</description>
1066 <syntax>DocumentRoot <var>directory-path</var></syntax>
1067 <default>DocumentRoot "/usr/local/apache/htdocs"</default>
1068 <contextlist><context>server config</context><context>virtual host</context>
1072 <p>This directive sets the directory from which <program>httpd</program>
1073 will serve files. Unless matched by a directive like <directive
1074 module="mod_alias">Alias</directive>, the server appends the
1075 path from the requested URL to the document root to make the
1076 path to the document. Example:</p>
1078 <highlight language="config">
1079 DocumentRoot "/usr/web"
1082 <p>then an access to
1083 <code>http://my.example.com/index.html</code> refers to
1084 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
1085 not absolute then it is assumed to be relative to the <directive
1086 module="core">ServerRoot</directive>.</p>
1088 <p>The <directive>DocumentRoot</directive> should be specified without
1089 a trailing slash.</p>
1091 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1092 Locations</a></seealso>
1093 </directivesynopsis>
1095 <directivesynopsis type="section">
1097 <description>Contains directives that apply only if the condition of a
1098 previous <directive type="section" module="core">If</directive> or
1099 <directive type="section" module="core">ElseIf</directive> section is not
1100 satisfied by a request at runtime</description>
1101 <syntax><Else> ... </Else></syntax>
1102 <contextlist><context>server config</context><context>virtual host</context>
1103 <context>directory</context><context>.htaccess</context>
1105 <override>All</override>
1106 <compatibility>Nested conditions are evaluated in 2.4.26 and later</compatibility>
1109 <p>The <directive type="section">Else</directive> applies the enclosed
1110 directives if and only if the most recent
1111 <directive type="section">If</directive> or
1112 <directive type="section">ElseIf</directive> section
1113 in the same scope has not been applied.
1114 For example: In </p>
1116 <highlight language="config">
1117 <If "-z req('Host')">
1125 <p> The <directive type="section">If</directive> would match HTTP/1.0
1126 requests without a <var>Host:</var> header and the
1127 <directive type="section">Else</directive> would match requests
1128 with a <var>Host:</var> header.</p>
1131 <seealso><directive type="section" module="core">If</directive></seealso>
1132 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
1133 <seealso><a href="../sections.html">How <Directory>, <Location>,
1134 <Files> sections work</a> for an explanation of how these
1135 different sections are combined when a request is received.
1136 <directive type="section">If</directive>,
1137 <directive type="section">ElseIf</directive>, and
1138 <directive type="section">Else</directive> are applied last.</seealso>
1139 </directivesynopsis>
1141 <directivesynopsis type="section">
1143 <description>Contains directives that apply only if a condition is satisfied
1144 by a request at runtime while the condition of a previous
1145 <directive type="section" module="core">If</directive> or
1146 <directive type="section">ElseIf</directive> section is not
1147 satisfied</description>
1148 <syntax><ElseIf <var>expression</var>> ... </ElseIf></syntax>
1149 <contextlist><context>server config</context><context>virtual host</context>
1150 <context>directory</context><context>.htaccess</context>
1152 <override>All</override>
1153 <compatibility>Nested conditions are evaluated in 2.4.26 and later</compatibility>
1156 <p>The <directive type="section">ElseIf</directive> applies the enclosed
1157 directives if and only if both the given condition evaluates to true and
1158 the most recent <directive type="section">If</directive> or
1159 <directive type="section">ElseIf</directive> section in the same scope has
1160 not been applied. For example: In </p>
1162 <highlight language="config">
1163 <If "-R '10.1.0.0/16'">
1166 <ElseIf "-R '10.0.0.0/8'">
1174 <p>The <directive type="section">ElseIf</directive> would match if
1175 the remote address of a request belongs to the subnet 10.0.0.0/8 but
1176 not to the subnet 10.1.0.0/16.</p>
1179 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1180 for a complete reference and more examples.</seealso>
1181 <seealso><directive type="section" module="core">If</directive></seealso>
1182 <seealso><directive type="section" module="core">Else</directive></seealso>
1183 <seealso><a href="../sections.html">How <Directory>, <Location>,
1184 <Files> sections work</a> for an explanation of how these
1185 different sections are combined when a request is received.
1186 <directive type="section">If</directive>,
1187 <directive type="section">ElseIf</directive>, and
1188 <directive type="section">Else</directive> are applied last.</seealso>
1189 </directivesynopsis>
1194 <name>EnableMMAP</name>
1195 <description>Use memory-mapping to read files during delivery</description>
1196 <syntax>EnableMMAP On|Off</syntax>
1197 <default>EnableMMAP On</default>
1198 <contextlist><context>server config</context><context>virtual host</context>
1199 <context>directory</context><context>.htaccess</context>
1201 <override>FileInfo</override>
1204 <p>This directive controls whether the <program>httpd</program> may use
1205 memory-mapping if it needs to read the contents of a file during
1206 delivery. By default, when the handling of a request requires
1207 access to the data within a file -- for example, when delivering a
1208 server-parsed file using <module>mod_include</module> -- Apache httpd
1209 memory-maps the file if the OS supports it.</p>
1211 <p>This memory-mapping sometimes yields a performance improvement.
1212 But in some environments, it is better to disable the memory-mapping
1213 to prevent operational problems:</p>
1216 <li>On some multiprocessor systems, memory-mapping can reduce the
1217 performance of the <program>httpd</program>.</li>
1218 <li>Deleting or truncating a file while <program>httpd</program>
1219 has it memory-mapped can cause <program>httpd</program> to
1220 crash with a segmentation fault.
1224 <p>For server configurations that are vulnerable to these problems,
1225 you should disable memory-mapping of delivered files by specifying:</p>
1227 <highlight language="config">
1231 <p>For NFS mounted files, this feature may be disabled explicitly for
1232 the offending files by specifying:</p>
1234 <highlight language="config">
1235 <Directory "/path-to-nfs-files">
1240 </directivesynopsis>
1243 <name>EnableSendfile</name>
1244 <description>Use the kernel sendfile support to deliver files to the client</description>
1245 <syntax>EnableSendfile On|Off</syntax>
1246 <default>EnableSendfile Off</default>
1247 <contextlist><context>server config</context><context>virtual host</context>
1248 <context>directory</context><context>.htaccess</context>
1250 <override>FileInfo</override>
1251 <compatibility>Default changed to Off in
1252 version 2.3.9.</compatibility>
1255 <p>This directive controls whether <program>httpd</program> may use the
1256 sendfile support from the kernel to transmit file contents to the client.
1257 By default, when the handling of a request requires no access
1258 to the data within a file -- for example, when delivering a
1259 static file -- Apache httpd uses sendfile to deliver the file contents
1260 without ever reading the file if the OS supports it.</p>
1262 <p>This sendfile mechanism avoids separate read and send operations,
1263 and buffer allocations. But on some platforms or within some
1264 filesystems, it is better to disable this feature to avoid
1265 operational problems:</p>
1268 <li>Some platforms may have broken sendfile support that the build
1269 system did not detect, especially if the binaries were built on
1270 another box and moved to such a machine with broken sendfile
1272 <li>On Linux the use of sendfile triggers TCP-checksum
1273 offloading bugs on certain networking cards when using IPv6.</li>
1274 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1275 files over 2GB in size.</li>
1276 <li>With a network-mounted <directive
1277 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
1278 the kernel may be unable to serve the network file through
1282 <p>For server configurations that are not vulnerable to these problems,
1283 you may enable this feature by specifying:</p>
1285 <highlight language="config">
1289 <p>For network mounted files, this feature may be disabled explicitly
1290 for the offending files by specifying:</p>
1292 <highlight language="config">
1293 <Directory "/path-to-nfs-files">
1297 <p>Please note that the per-directory and .htaccess configuration
1298 of <directive>EnableSendfile</directive> is not supported by
1299 <module>mod_cache_disk</module>.
1300 Only global definition of <directive>EnableSendfile</directive>
1301 is taken into account by the module.
1304 </directivesynopsis>
1307 <name>HttpProtocolOptions</name>
1308 <description>Modify restrictions on HTTP Request Messages</description>
1309 <syntax>HttpProtocolOptions [Strict|Unsafe] [RegisteredMethods|LenientMethods]
1310 [Allow0.9|Require1.0]</syntax>
1311 <default>HttpProtocolOptions Strict LenientMethods Allow0.9</default>
1312 <contextlist><context>server config</context>
1313 <context>virtual host</context></contextlist>
1314 <compatibility>2.2.32 or 2.4.24 and later</compatibility>
1317 <p>This directive changes the rules applied to the HTTP Request Line
1318 (<a href="https://tools.ietf.org/html/rfc7230#section-3.1.1"
1319 >RFC 7230 §3.1.1</a>) and the HTTP Request Header Fields
1320 (<a href="https://tools.ietf.org/html/rfc7230#section-3.2"
1321 >RFC 7230 §3.2</a>), which are now applied by default or using
1322 the <code>Strict</code> option. Due to legacy modules, applications or
1323 custom user-agents which must be deprecated the <code>Unsafe</code>
1324 option has been added to revert to the legacy behaviors.</p>
1326 <p>These rules are applied prior to request processing,
1327 so must be configured at the global or default (first) matching
1328 virtual host section, by IP/port interface (and not by name)
1331 <p>The directive accepts three parameters from the following list
1332 of choices, applying the default to the ones not specified:</p>
1335 <dt>Strict|Unsafe</dt>
1337 <p>Prior to the introduction of this directive, the Apache HTTP Server
1338 request message parsers were tolerant of a number of forms of input
1339 which did not conform to the protocol.
1340 <a href="https://tools.ietf.org/html/rfc7230#section-9.4"
1341 >RFC 7230 §9.4 Request Splitting</a> and
1342 <a href="https://tools.ietf.org/html/rfc7230#section-9.5"
1343 >§9.5 Response Smuggling</a> call out only two of the potential
1344 risks of accepting non-conformant request messages, while
1345 <a href="https://tools.ietf.org/html/rfc7230#section-3.5"
1346 >RFC 7230 §3.5</a> "Message Parsing Robustness" identify the
1347 risks of accepting obscure whitespace and request message formatting.
1348 As of the introduction of this directive, all grammar rules of the
1349 specification are enforced in the default <code>Strict</code> operating
1350 mode, and the strict whitespace suggested by section 3.5 is enforced
1351 and cannot be relaxed.</p>
1353 <note type="warning"><title>Security risks of Unsafe</title>
1354 <p>Users are strongly cautioned against toggling the <code>Unsafe</code>
1355 mode of operation, particularly on outward-facing, publicly accessible
1356 server deployments. If an interface is required for faulty monitoring
1357 or other custom service consumers running on an intranet, users should
1358 toggle the Unsafe option only on a specific virtual host configured
1359 to service their internal private network.</p>
1363 <title>Example of a request leading to HTTP 400 with Strict mode</title>
1364 # Missing CRLF<br />
1367 <note type="warning"><title>Command line tools and CRLF</title>
1368 <p>Some tools need to be forced to use CRLF, otherwise httpd will return
1369 a HTTP 400 response like described in the above use case. For example,
1370 the <strong>OpenSSL s_client needs the -crlf parameter to work
1371 properly</strong>.</p>
1372 <p>The <directive module="mod_dumpio">DumpIOInput</directive> directive
1373 can help while reviewing the HTTP request to identify issues like the
1374 absence of CRLF.</p>
1377 <dt>RegisteredMethods|LenientMethods</dt>
1379 <p><a href="https://tools.ietf.org/html/rfc7231#section-4.1"
1380 >RFC 7231 §4.1</a> "Request Methods" "Overview" requires that
1381 origin servers shall respond with a HTTP 501 status code when an
1382 unsupported method is encountered in the request line.
1383 This already happens when the <code>LenientMethods</code> option is used,
1384 but administrators may wish to toggle the <code>RegisteredMethods</code>
1385 option and register any non-standard methods using the
1386 <directive module="core">RegisterHttpMethod</directive>
1387 directive, particularly if the <code>Unsafe</code>
1388 option has been toggled.</p>
1390 <note type="warning"><title>Forward Proxy compatibility</title>
1391 <p>The <code>RegisteredMethods</code> option should <strong>not</strong>
1392 be toggled for forward proxy hosts, as the methods supported by the
1393 origin servers are unknown to the proxy server.</p>
1397 <title>Example of a request leading to HTTP 501 with LenientMethods mode</title>
1398 # Unknown HTTP method<br />
1399 WOW / HTTP/1.0\r\n\r\n<br /><br />
1400 # Lowercase HTTP method<br />
1401 get / HTTP/1.0\r\n\r\n<br />
1404 <dt>Allow0.9|Require1.0</dt>
1406 <p><a href="https://tools.ietf.org/html/rfc2616#section-19.6"
1407 >RFC 2616 §19.6</a> "Compatibility With Previous Versions" had
1408 encouraged HTTP servers to support legacy HTTP/0.9 requests. RFC 7230
1409 supersedes this with "The expectation to support HTTP/0.9 requests has
1410 been removed" and offers additional comments in
1411 <a href="https://tools.ietf.org/html/rfc7230#appendix-A"
1412 >RFC 7230 Appendix A</a>. The <code>Require1.0</code> option allows
1413 the user to remove support of the default <code>Allow0.9</code> option's
1417 <title>Example of a request leading to HTTP 400 with Require1.0 mode</title>
1418 # Unsupported HTTP version<br />
1423 <p>Reviewing the messages logged to the
1424 <directive module="core">ErrorLog</directive>, configured with
1425 <directive module="core">LogLevel</directive> <code>debug</code> level,
1426 can help identify such faulty requests along with their origin.
1427 Users should pay particular attention to the 400 responses in the access
1428 log for invalid requests which were unexpectedly rejected.</p>
1430 </directivesynopsis>
1434 <description>Abort configuration parsing with a custom error message</description>
1435 <syntax>Error <var>message</var></syntax>
1436 <contextlist><context>server config</context><context>virtual host</context>
1437 <context>directory</context><context>.htaccess</context>
1439 <override>All</override>
1440 <compatibility>2.3.9 and later</compatibility>
1443 <p>If an error can be detected within the configuration, this
1444 directive can be used to generate a custom error message, and halt
1445 configuration parsing. The typical use is for reporting required
1446 modules which are missing from the configuration.</p>
1448 <highlight language="config">
1450 # ensure that mod_include is loaded
1451 <IfModule !include_module>
1452 Error "mod_include is required by mod_foo. Load it with LoadModule."
1455 # ensure that exactly one of SSL,NOSSL is defined
1456 <IfDefine SSL>
1457 <IfDefine NOSSL>
1458 Error "Both SSL and NOSSL are defined. Define only one of them."
1461 <IfDefine !SSL>
1462 <IfDefine !NOSSL>
1463 Error "Either SSL or NOSSL must be defined."
1469 </directivesynopsis>
1472 <name>ErrorDocument</name>
1473 <description>What the server will return to the client
1474 in case of an error</description>
1475 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
1476 <contextlist><context>server config</context><context>virtual host</context>
1477 <context>directory</context><context>.htaccess</context>
1479 <override>FileInfo</override>
1482 <p>In the event of a problem or error, Apache httpd can be configured
1483 to do one of four things,</p>
1486 <li>output a simple hardcoded error message</li>
1488 <li>output a customized message</li>
1490 <li>internally redirect to a local <var>URL-path</var> to handle the
1493 <li>redirect to an external <var>URL</var> to handle the
1497 <p>The first option is the default, while options 2-4 are
1498 configured using the <directive>ErrorDocument</directive>
1499 directive, which is followed by the HTTP response code and a URL
1500 or a message. Apache httpd will sometimes offer additional information
1501 regarding the problem/error.</p>
1503 <p>From 2.4.13, <a href="../expr.html">expression syntax</a> can be
1504 used inside the directive to produce dynamic strings and URLs.</p>
1506 <p>URLs can begin with a slash (/) for local web-paths (relative
1507 to the <directive module="core">DocumentRoot</directive>), or be a
1508 full URL which the client can resolve. Alternatively, a message
1509 can be provided to be displayed by the browser. Note that deciding
1510 whether the parameter is an URL, a path or a message is performed
1511 before any expression is parsed. Examples:</p>
1513 <highlight language="config">
1514 ErrorDocument 500 http://example.com/cgi-bin/server-error.cgi
1515 ErrorDocument 404 /errors/bad_urls.php
1516 ErrorDocument 401 /subscription_info.html
1517 ErrorDocument 403 "Sorry, can't allow you access today"
1518 ErrorDocument 403 Forbidden!
1519 ErrorDocument 403 /errors/forbidden.py?referrer=%{escape:%{HTTP_REFERER}}
1522 <p>Additionally, the special value <code>default</code> can be used
1523 to specify Apache httpd's simple hardcoded message. While not required
1524 under normal circumstances, <code>default</code> will restore
1525 Apache httpd's simple hardcoded message for configurations that would
1526 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
1528 <highlight language="config">
1529 ErrorDocument 404 /cgi-bin/bad_urls.pl
1531 <Directory "/web/docs">
1532 ErrorDocument 404 default
1536 <p>Note that when you specify an <directive>ErrorDocument</directive>
1537 that points to a remote URL (ie. anything with a method such as
1538 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1539 client to tell it where to find the document, even if the
1540 document ends up being on the same server. This has several
1541 implications, the most important being that the client will not
1542 receive the original error status code, but instead will
1543 receive a redirect status code. This in turn can confuse web
1544 robots and other clients which try to determine if a URL is
1545 valid using the status code. In addition, if you use a remote
1546 URL in an <code>ErrorDocument 401</code>, the client will not
1547 know to prompt the user for a password since it will not
1548 receive the 401 status code. Therefore, <strong>if you use an
1549 <code>ErrorDocument 401</code> directive, then it must refer to a local
1550 document.</strong></p>
1552 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1553 server-generated error messages when they are "too small" and substitute
1554 its own "friendly" error messages. The size threshold varies depending on
1555 the type of error, but in general, if you make your error document
1556 greater than 512 bytes, then MSIE will show the server-generated
1557 error rather than masking it. More information is available in
1558 Microsoft Knowledge Base article <a
1559 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1562 <p>Although most error messages can be overridden, there are certain
1563 circumstances where the internal messages are used regardless of the
1564 setting of <directive module="core">ErrorDocument</directive>. In
1565 particular, if a malformed request is detected, normal request processing
1566 will be immediately halted and the internal error message returned.
1567 This is necessary to guard against security problems caused by
1570 <p>If you are using mod_proxy, you may wish to enable
1571 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1572 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1573 Apache httpd will not generate custom error documents for proxied content.</p>
1576 <seealso><a href="../custom-error.html">documentation of
1577 customizable responses</a></seealso>
1578 </directivesynopsis>
1581 <name>ErrorLog</name>
1582 <description>Location where the server will log errors</description>
1583 <syntax> ErrorLog <var>file-path</var>|syslog[:[<var>facility</var>][:<var>tag</var>]]</syntax>
1584 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1585 <contextlist><context>server config</context><context>virtual host</context>
1589 <p>The <directive>ErrorLog</directive> directive sets the name of
1590 the file to which the server will log any errors it encounters. If
1591 the <var>file-path</var> is not absolute then it is assumed to be
1592 relative to the <directive module="core">ServerRoot</directive>.</p>
1594 <highlight language="config">
1595 ErrorLog "/var/log/httpd/error_log"
1598 <p>If the <var>file-path</var>
1599 begins with a pipe character "<code>|</code>" then it is assumed to be a
1600 command to spawn to handle the error log.</p>
1602 <highlight language="config">
1603 ErrorLog "|/usr/local/bin/httpd_errors"
1606 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1607 more information.</p>
1609 <p>Using <code>syslog</code> instead of a filename enables logging
1610 via syslogd(8) if the system supports it and if <module>mod_syslog</module>
1611 is loaded. The default is to use syslog facility <code>local7</code>,
1612 but you can override this by using the <code>syslog:<var>facility</var></code>
1613 syntax where <var>facility</var> can be one of the names usually documented in
1614 syslog(1). The facility is effectively global, and if it is changed
1615 in individual virtual hosts, the final facility specified affects the
1616 entire server. Same rules apply for the syslog tag, which by default
1617 uses the Apache binary name, <code>httpd</code> in most cases. You can
1618 also override this by using the <code>syslog::<var>tag</var></code>
1621 <highlight language="config">
1622 ErrorLog syslog:user
1623 ErrorLog syslog:user:httpd.srv1
1624 ErrorLog syslog::httpd.srv2
1627 <p>Additional modules can provide their own ErrorLog providers. The syntax
1628 is similar to the <code>syslog</code> example above.</p>
1630 <p>SECURITY: See the <a
1631 href="../misc/security_tips.html#serverroot">security tips</a>
1632 document for details on why your security could be compromised
1633 if the directory where log files are stored is writable by
1634 anyone other than the user that starts the server.</p>
1635 <note type="warning"><title>Note</title>
1636 <p>When entering a file path on non-Unix platforms, care should be taken
1637 to make sure that only forward slashes are used even though the platform
1638 may allow the use of back slashes. In general it is a good idea to always
1639 use forward slashes throughout the configuration files.</p>
1642 <seealso><directive module="core">LogLevel</directive></seealso>
1643 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1644 </directivesynopsis>
1647 <name>ErrorLogFormat</name>
1648 <description>Format specification for error log entries</description>
1649 <syntax> ErrorLogFormat [connection|request] <var>format</var></syntax>
1650 <contextlist><context>server config</context><context>virtual host</context>
1654 <p><directive>ErrorLogFormat</directive> allows to specify what
1655 supplementary information is logged in the error log in addition to the
1656 actual log message.</p>
1658 <highlight language="config">
1660 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1663 <p>Specifying <code>connection</code> or <code>request</code> as first
1664 parameter allows to specify additional formats, causing additional
1665 information to be logged when the first message is logged for a specific
1666 connection or request, respectively. This additional information is only
1667 logged once per connection/request. If a connection or request is processed
1668 without causing any log message, the additional information is not logged
1671 <p>It can happen that some format string items do not produce output. For
1672 example, the Referer header is only present if the log message is
1673 associated to a request and the log message happens at a time when the
1674 Referer header has already been read from the client. If no output is
1675 produced, the default behavior is to delete everything from the preceding
1676 space character to the next space character. This means the log line is
1677 implicitly divided into fields on non-whitespace to whitespace transitions.
1678 If a format string item does not produce output, the whole field is
1679 omitted. For example, if the remote address <code>%a</code> in the log
1680 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1681 brackets are not logged either. Space characters can be escaped with a
1682 backslash to prevent them from delimiting a field. The combination '% '
1683 (percent space) is a zero-width field delimiter that does not produce any
1686 <p>The above behavior can be changed by adding modifiers to the format
1687 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1688 respective item does not produce any output. In once-per-connection/request
1689 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1690 item with the plus modifier does not produce any output, the whole line is
1693 <p>A number as modifier can be used to assign a log severity level to a
1694 format item. The item will only be logged if the severity of the log
1695 message is not higher than the specified log severity level. The number can
1696 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1698 <p>For example, here's what would happen if you added modifiers to
1699 the <code>%{Referer}i</code> token, which logs the
1700 <code>Referer</code> request header.</p>
1702 <table border="1" style="zebra">
1703 <columnspec><column width=".3"/><column width=".7"/></columnspec>
1705 <tr><th>Modified Token</th><th>Meaning</th></tr>
1708 <td><code>%-{Referer}i</code></td>
1709 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1713 <td><code>%+{Referer}i</code></td>
1714 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1718 <td><code>%4{Referer}i</code></td>
1719 <td>Logs the <code>Referer</code> only if the log message severity
1720 is higher than 4.</td>
1725 <p>Some format string items accept additional parameters in braces.</p>
1727 <table border="1" style="zebra">
1728 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1730 <tr><th>Format String</th> <th>Description</th></tr>
1732 <tr><td><code>%%</code></td>
1733 <td>The percent sign</td></tr>
1735 <tr><td><code>%a</code></td>
1736 <td>Client IP address and port of the request</td></tr>
1738 <tr><td><code>%{c}a</code></td>
1739 <td>Underlying peer IP address and port of the connection (see the
1740 <module>mod_remoteip</module> module)</td></tr>
1742 <tr><td><code>%A</code></td>
1743 <td>Local IP-address and port</td></tr>
1745 <tr><td><code>%{<em>name</em>}e</code></td>
1746 <td>Request environment variable <em>name</em></td></tr>
1748 <tr><td><code>%E</code></td>
1749 <td>APR/OS error status code and string</td></tr>
1751 <tr><td><code>%F</code></td>
1752 <td>Source file name and line number of the log call</td></tr>
1754 <tr><td><code>%{<em>name</em>}i</code></td>
1755 <td>Request header <em>name</em></td></tr>
1757 <tr><td><code>%k</code></td>
1758 <td>Number of keep-alive requests on this connection</td></tr>
1760 <tr><td><code>%l</code></td>
1761 <td>Loglevel of the message</td></tr>
1763 <tr><td><code>%L</code></td>
1764 <td>Log ID of the request</td></tr>
1766 <tr><td><code>%{c}L</code></td>
1767 <td>Log ID of the connection</td></tr>
1769 <tr><td><code>%{C}L</code></td>
1770 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1772 <tr><td><code>%m</code></td>
1773 <td>Name of the module logging the message</td></tr>
1775 <tr><td><code>%M</code></td>
1776 <td>The actual log message</td></tr>
1778 <tr><td><code>%{<em>name</em>}n</code></td>
1779 <td>Request note <em>name</em></td></tr>
1781 <tr><td><code>%P</code></td>
1782 <td>Process ID of current process</td></tr>
1784 <tr><td><code>%T</code></td>
1785 <td>Thread ID of current thread</td></tr>
1787 <tr><td><code>%{g}T</code></td>
1788 <td>System unique thread ID of current thread (the same ID as
1789 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1791 <tr><td><code>%t</code></td>
1792 <td>The current time</td></tr>
1794 <tr><td><code>%{u}t</code></td>
1795 <td>The current time including micro-seconds</td></tr>
1797 <tr><td><code>%{cu}t</code></td>
1798 <td>The current time in compact ISO 8601 format, including
1799 micro-seconds</td></tr>
1801 <tr><td><code>%v</code></td>
1802 <td>The canonical <directive module="core">ServerName</directive>
1803 of the current server.</td></tr>
1805 <tr><td><code>%V</code></td>
1806 <td>The server name of the server serving the request according to the
1807 <directive module="core" >UseCanonicalName</directive>
1810 <tr><td><code>\ </code> (backslash space)</td>
1811 <td>Non-field delimiting space</td></tr>
1813 <tr><td><code>% </code> (percent space)</td>
1814 <td>Field delimiter (no output)</td></tr>
1817 <p>The log ID format <code>%L</code> produces a unique id for a connection
1818 or request. This can be used to correlate which log lines belong to the
1819 same connection or request, which request happens on which connection.
1820 A <code>%L</code> format string is also available in
1821 <module>mod_log_config</module> to allow to correlate access log entries
1822 with error log lines. If <module>mod_unique_id</module> is loaded, its
1823 unique id will be used as log ID for requests.</p>
1825 <highlight language="config">
1826 #Example (default format for threaded MPMs)
1827 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1830 <p>This would result in error messages such as:</p>
1833 [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
1836 <p>Notice that, as discussed above, some fields are omitted
1837 entirely because they are not defined.</p>
1839 <highlight language="config">
1840 #Example (similar to the 2.2.x format)
1841 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1844 <highlight language="config">
1845 #Advanced example with request/connection log IDs
1846 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1847 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1848 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1849 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1850 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"
1854 <seealso><directive module="core">ErrorLog</directive></seealso>
1855 <seealso><directive module="core">LogLevel</directive></seealso>
1856 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1857 </directivesynopsis>
1860 <name>ExtendedStatus</name>
1861 <description>Keep track of extended status information for each
1862 request</description>
1863 <syntax>ExtendedStatus On|Off</syntax>
1864 <default>ExtendedStatus Off[*]</default>
1865 <contextlist><context>server config</context></contextlist>
1868 <p>This option tracks additional data per worker about the
1869 currently executing request and creates a utilization summary.
1870 You can see these variables during runtime by configuring
1871 <module>mod_status</module>. Note that other modules may
1872 rely on this scoreboard.</p>
1874 <p>This setting applies to the entire server and cannot be
1875 enabled or disabled on a virtualhost-by-virtualhost basis.
1876 The collection of extended status information can slow down
1877 the server. Also note that this setting cannot be changed
1878 during a graceful restart.</p>
1881 <p>Note that loading <module>mod_status</module> will change
1882 the default behavior to ExtendedStatus On, while other
1883 third party modules may do the same. Such modules rely on
1884 collecting detailed information about the state of all workers.
1885 The default is changed by <module>mod_status</module> beginning
1886 with version 2.3.6. The previous default was always Off.</p>
1891 </directivesynopsis>
1894 <name>FileETag</name>
1895 <description>File attributes used to create the ETag
1896 HTTP response header for static files</description>
1897 <syntax>FileETag <var>component</var> ...</syntax>
1898 <default>FileETag MTime Size</default>
1899 <contextlist><context>server config</context><context>virtual host</context>
1900 <context>directory</context><context>.htaccess</context>
1902 <override>FileInfo</override>
1903 <compatibility>The default used to be "INode MTime Size" in 2.3.14 and
1904 earlier.</compatibility>
1908 The <directive>FileETag</directive> directive configures the file
1909 attributes that are used to create the <code>ETag</code> (entity
1910 tag) response header field when the document is based on a static file.
1911 (The <code>ETag</code> value is used in cache management to save
1912 network bandwidth.) The
1913 <directive>FileETag</directive> directive allows you to choose
1914 which of these -- if any -- should be used. The recognized keywords are:
1918 <dt><strong>INode</strong></dt>
1919 <dd>The file's i-node number will be included in the calculation</dd>
1920 <dt><strong>MTime</strong></dt>
1921 <dd>The date and time the file was last modified will be included</dd>
1922 <dt><strong>Size</strong></dt>
1923 <dd>The number of bytes in the file will be included</dd>
1924 <dt><strong>All</strong></dt>
1925 <dd>All available fields will be used. This is equivalent to:
1926 <highlight language="config">
1927 FileETag INode MTime Size
1929 <dt><strong>None</strong></dt>
1930 <dd>If a document is file-based, no <code>ETag</code> field will be
1931 included in the response</dd>
1934 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1935 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1936 which allow changes to be made to the default setting inherited
1937 from a broader scope. Any keyword appearing without such a prefix
1938 immediately and completely cancels the inherited setting.</p>
1940 <p>If a directory's configuration includes
1941 <code>FileETag INode MTime Size</code>, and a
1942 subdirectory's includes <code>FileETag -INode</code>,
1943 the setting for that subdirectory (which will be inherited by
1944 any sub-subdirectories that don't override it) will be equivalent to
1945 <code>FileETag MTime Size</code>.</p>
1946 <note type="warning"><title>Warning</title>
1947 Do not change the default for directories or locations that have WebDAV
1948 enabled and use <module>mod_dav_fs</module> as a storage provider.
1949 <module>mod_dav_fs</module> uses <code>MTime Size</code>
1950 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1951 These conditional requests will break if the <code>ETag</code> format is
1952 changed via <directive>FileETag</directive>.
1954 <note><title>Server Side Includes</title>
1955 An ETag is not generated for responses parsed by <module>mod_include</module>
1956 since the response entity can change without a change of the INode, MTime, or Size
1957 of the static file with embedded SSI directives.
1961 </directivesynopsis>
1963 <directivesynopsis type="section">
1965 <description>Contains directives that apply to matched
1966 filenames</description>
1967 <syntax><Files <var>filename</var>> ... </Files></syntax>
1968 <contextlist><context>server config</context><context>virtual host</context>
1969 <context>directory</context><context>.htaccess</context>
1971 <override>All</override>
1974 <p>The <directive type="section">Files</directive> directive
1975 limits the scope of the enclosed directives by filename. It is comparable
1976 to the <directive module="core" type="section">Directory</directive>
1977 and <directive module="core" type="section">Location</directive>
1978 directives. It should be matched with a <code></Files></code>
1979 directive. The directives given within this section will be applied to
1980 any object with a basename (last component of filename) matching the
1981 specified filename. <directive type="section">Files</directive>
1982 sections are processed in the order they appear in the
1983 configuration file, after the <directive module="core"
1984 type="section">Directory</directive> sections and
1985 <code>.htaccess</code> files are read, but before <directive
1986 type="section" module="core">Location</directive> sections. Note
1987 that <directive type="section">Files</directive> can be nested
1988 inside <directive type="section"
1989 module="core">Directory</directive> sections to restrict the
1990 portion of the filesystem they apply to.</p>
1992 <p>The <var>filename</var> argument should include a filename, or
1993 a wild-card string, where <code>?</code> matches any single character,
1994 and <code>*</code> matches any sequences of characters.</p>
1995 <highlight language="config">
1996 <Files "cat.html">
1997 # Insert stuff that applies to cat.html here
2000 <Files "?at.*">
2001 # This would apply to cat.html, bat.html, hat.php and so on.
2004 <p><glossary ref="regex">Regular expressions</glossary>
2005 can also be used, with the addition of the
2006 <code>~</code> character. For example:</p>
2008 <highlight language="config">
2009 <Files ~ "\.(gif|jpe?g|png)$">
2014 <p>would match most common Internet graphics formats. <directive
2015 module="core" type="section">FilesMatch</directive> is preferred,
2018 <p>Note that unlike <directive type="section"
2019 module="core">Directory</directive> and <directive type="section"
2020 module="core">Location</directive> sections, <directive
2021 type="section">Files</directive> sections can be used inside
2022 <code>.htaccess</code> files. This allows users to control access to
2023 their own files, at a file-by-file level.</p>
2026 <seealso><a href="../sections.html">How <Directory>, <Location>
2027 and <Files> sections work</a> for an explanation of how these
2028 different sections are combined when a request is received</seealso>
2029 </directivesynopsis>
2031 <directivesynopsis type="section">
2032 <name>FilesMatch</name>
2033 <description>Contains directives that apply to regular-expression matched
2034 filenames</description>
2035 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
2036 <contextlist><context>server config</context><context>virtual host</context>
2037 <context>directory</context><context>.htaccess</context>
2039 <override>All</override>
2042 <p>The <directive type="section">FilesMatch</directive> directive
2043 limits the scope of the enclosed directives by filename, just as the
2044 <directive module="core" type="section">Files</directive> directive
2045 does. However, it accepts a <glossary ref="regex">regular
2046 expression</glossary>. For example:</p>
2048 <highlight language="config">
2049 <FilesMatch ".+\.(gif|jpe?g|png)$">
2054 <p>would match most common Internet graphics formats.</p>
2056 <note>The <code>.+</code> at the start of the regex ensures that
2057 files named <code>.png</code>, or <code>.gif</code>, for example,
2058 are not matched.</note>
2060 <p>From 2.4.8 onwards, named groups and backreferences are captured and
2061 written to the environment with the corresponding name prefixed with
2062 "MATCH_" and in upper case. This allows elements of files to be referenced
2063 from within <a href="../expr.html">expressions</a> and modules like
2064 <module>mod_rewrite</module>. In order to prevent confusion, numbered
2065 (unnamed) backreferences are ignored. Use named groups instead.</p>
2067 <highlight language="config">
2068 <FilesMatch "^(?<sitename>[^/]+)">
2069 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
2074 <seealso><a href="../sections.html">How <Directory>, <Location>
2075 and <Files> sections work</a> for an explanation of how these
2076 different sections are combined when a request is received</seealso>
2077 </directivesynopsis>
2080 <name>ForceType</name>
2081 <description>Forces all matching files to be served with the specified
2082 media type in the HTTP Content-Type header field</description>
2083 <syntax>ForceType <var>media-type</var>|None</syntax>
2084 <contextlist><context>directory</context><context>.htaccess</context>
2086 <override>FileInfo</override>
2089 <p>When placed into an <code>.htaccess</code> file or a
2090 <directive type="section" module="core">Directory</directive>, or
2091 <directive type="section" module="core">Location</directive> or
2092 <directive type="section" module="core">Files</directive>
2093 section, this directive forces all matching files to be served
2094 with the content type identification given by
2095 <var>media-type</var>. For example, if you had a directory full of
2096 GIF files, but did not want to label them all with <code>.gif</code>,
2097 you might want to use:</p>
2099 <highlight language="config">
2103 <p>Note that this directive overrides other indirect media type
2104 associations defined in mime.types or via the
2105 <directive module="mod_mime">AddType</directive>.</p>
2107 <p>You can also override more general
2108 <directive>ForceType</directive> settings
2109 by using the value of <code>None</code>:</p>
2111 <highlight language="config">
2112 # force all files to be image/gif:
2113 <Location "/images">
2117 # but normal mime-type associations here:
2118 <Location "/images/mixed">
2123 <p>This directive primarily overrides the content types generated for
2124 static files served out of the filesystem. For resources other than
2125 static files, where the generator of the response typically specifies
2126 a Content-Type, this directive has no effect.</p>
2129 <note><title>Note</title>
2130 <p>If no handler is explicitly set for a request, the specified content
2131 type will also be used as the handler name. </p>
2133 <p>When explicit directives such as
2134 <directive module="core" >SetHandler</directive> or
2135 <directive module="mod_mime">AddHandler</directive> do not apply
2136 to the current request, the internal handler name normally set by those
2137 directives is instead set to the content type specified by this directive.
2140 This is a historical behavior that some third-party modules
2141 (such as mod_php) may look for a "synthetic" content type used only to
2142 signal the module to take responsibility for the matching request.
2145 <p>Configurations that rely on such "synthetic" types should be avoided.
2146 Additionally, configurations that restrict access to
2147 <directive module="core" >SetHandler</directive> or
2148 <directive module="mod_mime">AddHandler</directive> should
2149 restrict access to this directive as well.</p>
2153 </directivesynopsis>
2155 <name>GprofDir</name>
2156 <description>Directory to write gmon.out profiling data to. </description>
2157 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
2158 <contextlist><context>server config</context><context>virtual host</context>
2162 <p>When the server has been compiled with gprof profiling support,
2163 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
2164 be written to the specified directory when the process exits. If the
2165 argument ends with a percent symbol ('%'), subdirectories are created
2166 for each process id.</p>
2168 <p>This directive currently only works with the <module>prefork</module>
2171 </directivesynopsis>
2174 <name>HostnameLookups</name>
2175 <description>Enables DNS lookups on client IP addresses</description>
2176 <syntax>HostnameLookups On|Off|Double</syntax>
2177 <default>HostnameLookups Off</default>
2178 <contextlist><context>server config</context><context>virtual host</context>
2179 <context>directory</context></contextlist>
2182 <p>This directive enables DNS lookups so that host names can be
2183 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
2184 The value <code>Double</code> refers to doing double-reverse
2185 DNS lookup. That is, after a reverse lookup is performed, a forward
2186 lookup is then performed on that result. At least one of the IP
2187 addresses in the forward lookup must match the original
2188 address. (In "tcpwrappers" terminology this is called
2189 <code>PARANOID</code>.)</p>
2191 <p>Regardless of the setting, when <module>mod_authz_host</module> is
2192 used for controlling access by hostname, a double reverse lookup
2193 will be performed. This is necessary for security. Note that the
2194 result of this double-reverse isn't generally available unless you
2195 set <code>HostnameLookups Double</code>. For example, if only
2196 <code>HostnameLookups On</code> and a request is made to an object
2197 that is protected by hostname restrictions, regardless of whether
2198 the double-reverse fails or not, CGIs will still be passed the
2199 single-reverse result in <code>REMOTE_HOST</code>.</p>
2201 <p>The default is <code>Off</code> in order to save the network
2202 traffic for those sites that don't truly need the reverse
2203 lookups done. It is also better for the end users because they
2204 don't have to suffer the extra latency that a lookup entails.
2205 Heavily loaded sites should leave this directive
2206 <code>Off</code>, since DNS lookups can take considerable
2207 amounts of time. The utility <program>logresolve</program>, compiled by
2208 default to the <code>bin</code> subdirectory of your installation
2209 directory, can be used to look up host names from logged IP addresses
2212 <p>Finally, if you have <a
2213 href="mod_authz_host.html#reqhost">hostname-based Require
2214 directives</a>, a hostname lookup will be performed regardless of
2215 the setting of <code>HostnameLookups</code>.</p>
2217 </directivesynopsis>
2219 <directivesynopsis type="section">
2221 <description>Contains directives that apply only if a condition is
2222 satisfied by a request at runtime</description>
2223 <syntax><If <var>expression</var>> ... </If></syntax>
2224 <contextlist><context>server config</context><context>virtual host</context>
2225 <context>directory</context><context>.htaccess</context>
2227 <override>All</override>
2228 <compatibility>Nested conditions are evaluated in 2.4.26 and later</compatibility>
2231 <p>The <directive type="section">If</directive> directive
2232 evaluates an expression at runtime, and applies the enclosed
2233 directives if and only if the expression evaluates to true.
2236 <highlight language="config">
2237 <If "-z req('Host')">
2240 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
2241 Expressions may contain various shell-like operators for string
2242 comparison (<code>==</code>, <code>!=</code>, <code><</code>, ...),
2243 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
2244 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
2245 It is also possible to use regular expressions, </p>
2247 <highlight language="config">
2248 <If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/">
2251 <p>shell-like pattern matches and many other operations. These operations
2252 can be done on request headers (<code>req</code>), environment variables
2253 (<code>env</code>), and a large number of other properties. The full
2254 documentation is available in <a href="../expr.html">Expressions in
2255 Apache HTTP Server</a>.</p>
2257 <p>Only directives that support the <a href="directive-dict.html#Context"
2258 >directory context</a> can be used within this configuration section.</p>
2260 <note type="warning">
2261 Certain variables, such as <code>CONTENT_TYPE</code> and other
2262 response headers, are set after <If> conditions have already
2263 been evaluated, and so will not be available to use in this
2269 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
2270 for a complete reference and more examples.</seealso>
2271 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
2272 <seealso><directive type="section" module="core">Else</directive></seealso>
2273 <seealso><a href="../sections.html">How <Directory>, <Location>,
2274 <Files> sections work</a> for an explanation of how these
2275 different sections are combined when a request is received.
2276 <directive type="section">If</directive>,
2277 <directive type="section">ElseIf</directive>, and
2278 <directive type="section">Else</directive> are applied last.</seealso>
2279 </directivesynopsis>
2281 <directivesynopsis type="section">
2282 <name>IfDefine</name>
2283 <description>Encloses directives that will be processed only
2284 if a test is true at startup</description>
2285 <syntax><IfDefine [!]<var>parameter-name</var>> ...
2286 </IfDefine></syntax>
2287 <contextlist><context>server config</context><context>virtual host</context>
2288 <context>directory</context><context>.htaccess</context>
2290 <override>All</override>
2293 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
2294 </code> section is used to mark directives that are conditional. The
2295 directives within an <directive type="section">IfDefine</directive>
2296 section are only processed if the <var>test</var> is true. If <var>
2297 test</var> is false, everything between the start and end markers is
2300 <p>The <var>test</var> in the <directive type="section"
2301 >IfDefine</directive> section directive can be one of two forms:</p>
2304 <li><var>parameter-name</var></li>
2306 <li><code>!</code><var>parameter-name</var></li>
2309 <p>In the former case, the directives between the start and end
2310 markers are only processed if the parameter named
2311 <var>parameter-name</var> is defined. The second format reverses
2312 the test, and only processes the directives if
2313 <var>parameter-name</var> is <strong>not</strong> defined.</p>
2315 <p>The <var>parameter-name</var> argument is a define as given on the
2316 <program>httpd</program> command line via <code>-D<var>parameter</var>
2317 </code> at the time the server was started or by the <directive
2318 module="core">Define</directive> directive.</p>
2320 <p><directive type="section">IfDefine</directive> sections are
2321 nest-able, which can be used to implement simple
2322 multiple-parameter tests. Example:</p>
2324 <example>httpd -DReverseProxy -DUseCache -DMemCache ...</example>
2325 <highlight language="config">
2326 <IfDefine ReverseProxy>
2327 LoadModule proxy_module modules/mod_proxy.so
2328 LoadModule proxy_http_module modules/mod_proxy_http.so
2329 <IfDefine UseCache>
2330 LoadModule cache_module modules/mod_cache.so
2331 <IfDefine MemCache>
2332 LoadModule mem_cache_module modules/mod_mem_cache.so
2334 <IfDefine !MemCache>
2335 LoadModule cache_disk_module modules/mod_cache_disk.so
2341 </directivesynopsis>
2343 <directivesynopsis type="section">
2345 <description>Encloses directives that will be processed only
2346 if file exists at startup</description>
2347 <syntax><IfFile [!]<var>parameter-name</var>> ...
2348 </IfFile></syntax>
2349 <contextlist><context>server config</context><context>virtual host</context>
2350 <context>directory</context><context>.htaccess</context>
2352 <override>All</override>
2353 <compatibility>Available in 2.4.34 and later</compatibility>
2356 <p>The <code><IfFile <var>filename</var>>...</IfFile>
2357 </code> section is used to mark directives that are conditional on
2358 the existence of a file on disk. The directives within an
2359 <directive type="section">IfFile</directive> section are only
2360 processed if <var>filename</var> exists. If <var>filename</var>
2361 doesn't exist, everything between the start and end markers is
2362 ignored. <var>filename</var> can be an absolute path or a path
2363 relative to the server root.</p>
2365 <p>The <var>filename</var> in the <directive type="section"
2366 >IfFile</directive> section directive can take the same forms as the
2367 <var>test</var> variable in the <directive type="section" module="core"
2368 >IfDefine</directive> section, i.e. the test can be negated if the <code>
2369 !</code> character is placed directly before <var>filename</var>.
2372 <p>If a relative <var>filename</var> is supplied, the check is
2373 <directive module="core">ServerRoot</directive> relative. In the case where
2374 this directive occurs before the <directive module="core">ServerRoot</directive>,
2375 the path will be checked relative to the compiled-in server root or
2376 the server root passed in on the command line via the <code>-d</code>
2379 <note type="warning"><title>Warning</title>
2380 In 2.4.34, it is not possible to specify a <var>filename</var>
2381 with surrounding quotes. This would generate a parsing error at start-up.
2382 The main impact is that filenames with spaces can't be used.
2383 This behavior is fixed in 2.4.35.</note>
2386 </directivesynopsis>
2388 <directivesynopsis type="section">
2389 <name>IfModule</name>
2390 <description>Encloses directives that are processed conditional on the
2391 presence or absence of a specific module</description>
2392 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2393 </IfModule></syntax>
2394 <contextlist><context>server config</context><context>virtual host</context>
2395 <context>directory</context><context>.htaccess</context>
2397 <override>All</override>
2400 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
2401 section is used to mark directives that are conditional on the presence of
2402 a specific module. The directives within an <directive type="section"
2403 >IfModule</directive> section are only processed if the <var>test</var>
2404 is true. If <var>test</var> is false, everything between the start and
2405 end markers is ignored.</p>
2407 <p>The <var>test</var> in the <directive type="section"
2408 >IfModule</directive> section directive can be one of two forms:</p>
2411 <li><var>module</var></li>
2413 <li>!<var>module</var></li>
2416 <p>In the former case, the directives between the start and end
2417 markers are only processed if the module named <var>module</var>
2418 is included in Apache httpd -- either compiled in or
2419 dynamically loaded using <directive module="mod_so"
2420 >LoadModule</directive>. The second format reverses the test,
2421 and only processes the directives if <var>module</var> is
2422 <strong>not</strong> included.</p>
2424 <p>The <var>module</var> argument can be either the module identifier or
2425 the file name of the module, at the time it was compiled. For example,
2426 <code>rewrite_module</code> is the identifier and
2427 <code>mod_rewrite.c</code> is the file name. If a module consists of
2428 several source files, use the name of the file containing the string
2429 <code>STANDARD20_MODULE_STUFF</code>.</p>
2431 <p><directive type="section">IfModule</directive> sections are
2432 nest-able, which can be used to implement simple multiple-module
2435 <note>This section should only be used if you need to have one
2436 configuration file that works whether or not a specific module
2437 is available. In normal operation, directives need not be
2438 placed in <directive type="section">IfModule</directive>
2441 </directivesynopsis>
2443 <directivesynopsis type="section">
2444 <name>IfDirective</name>
2445 <description>Encloses directives that are processed conditional on the
2446 presence or absence of a specific directive</description>
2447 <syntax><IfDirective [!]<var>directive-name</var>> ...
2448 </IfDirective></syntax>
2449 <contextlist><context>server config</context><context>virtual host</context>
2450 <context>directory</context><context>.htaccess</context>
2452 <override>All</override>
2453 <compatibility>Available in 2.4.34 and later</compatibility>
2456 <p>The <code><IfDirective <var>test</var>>...</IfDirective></code>
2457 section is used to mark directives that are conditional on the presence of
2458 a specific directive. The directives within an <directive type="section"
2459 >IfDirective</directive> section are only processed if the <var>test</var>
2460 is true. If <var>test</var> is false, everything between the start and
2461 end markers is ignored.</p>
2463 <p>The <var>test</var> in the <directive type="section"
2464 >IfDirective</directive> section can be one of two forms:</p>
2467 <li><var>directive-name</var></li>
2469 <li>!<var>directive-name</var></li>
2472 <p>In the former case, the directives between the start and end
2473 markers are only processed if a directive of the given name is
2474 available at the time of processing. The second format reverses the test,
2475 and only processes the directives if <var>directive-name</var> is
2476 <strong>not</strong> available.</p>
2478 <note>This section should only be used if you need to have one
2479 configuration file that works across multiple versions of
2480 <program>httpd</program>, regardless of whether a particular
2481 directive is available. In normal operation, directives need not
2482 be placed in <directive type="section">IfDirective</directive>
2485 <seealso><directive module="core" type="section">IfSection</directive></seealso>
2486 </directivesynopsis>
2488 <directivesynopsis type="section">
2489 <name>IfSection</name>
2490 <description>Encloses directives that are processed conditional on the
2491 presence or absence of a specific section directive</description>
2492 <syntax><IfSection [!]<var>section-name</var>> ...
2493 </IfSection></syntax>
2494 <contextlist><context>server config</context><context>virtual host</context>
2495 <context>directory</context><context>.htaccess</context>
2497 <override>All</override>
2498 <compatibility>Available in 2.4.34 and later</compatibility>
2501 <p>The <code><IfSection
2502 <var>test</var>>...</IfSection></code> section is used
2503 to mark directives that are conditional on the presence of a
2504 specific section directive. A section directive is any directive
2505 such as <directive type="section">VirtualHost</directive> which
2506 encloses other directives, and has a directive name with a leading
2509 <p>The directives within an <directive type="section"
2510 >IfSection</directive> section are only processed if the <var>test</var>
2511 is true. If <var>test</var> is false, everything between the start and
2512 end markers is ignored.</p>
2514 <p>The <var>section-name</var> must be specified without either
2515 the leading "<" or closing ">". The <var>test</var> in the
2516 <directive type="section">IfSection</directive> section can be one
2520 <li><var>section-name</var></li>
2521 <li>!<var>section-name</var></li>
2524 <p>In the former case, the directives between the start and end
2525 markers are only processed if a section directive of the given
2526 name is available at the time of processing. The second format
2527 reverses the test, and only processes the directives if
2528 <var>section-name</var> is <strong>not</strong> an available
2529 section directive.</p>
2533 <highlight language="config">
2534 <IfSection VirtualHost>
2539 <note>This section should only be used if you need to have one
2540 configuration file that works across multiple versions of <program>httpd</program>,
2541 regardless of whether a particular section directive is
2542 available. In normal operation, directives need not be placed in
2543 <directive type="section">IfSection</directive> sections.</note>
2545 <seealso><directive module="core" type="section">IfDirective</directive></seealso>
2546 </directivesynopsis>
2549 <name>Include</name>
2550 <description>Includes other configuration files from within
2551 the server configuration files</description>
2552 <syntax>Include <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2553 <contextlist><context>server config</context><context>virtual host</context>
2554 <context>directory</context>
2556 <compatibility>Directory
2557 wildcard matching available in 2.3.6 and later</compatibility>
2560 <p>This directive allows inclusion of other configuration files
2561 from within the server configuration files.</p>
2563 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2564 in the filename or directory parts of the path to include several files
2565 at once, in alphabetical order. In addition, if
2566 <directive>Include</directive> points to a directory, rather than a file,
2567 Apache httpd will read all files in that directory and any subdirectory.
2568 However, including entire directories is not recommended, because it is
2569 easy to accidentally leave temporary files in a directory that can cause
2570 <program>httpd</program> to fail. Instead, we encourage you to use the
2571 wildcard syntax shown below, to include files that match a particular
2572 pattern, such as *.conf, for example.</p>
2574 <p>The <directive module="core">Include</directive> directive will
2575 <strong>fail with an error</strong> if a wildcard expression does not
2576 match any file. The <directive module="core">IncludeOptional</directive>
2577 directive can be used if non-matching wildcards should be ignored.</p>
2579 <p>The file path specified may be an absolute path, or may be relative
2580 to the <directive module="core">ServerRoot</directive> directory.</p>
2584 <highlight language="config">
2585 Include /usr/local/apache2/conf/ssl.conf
2586 Include /usr/local/apache2/conf/vhosts/*.conf
2589 <p>Or, providing paths relative to your <directive
2590 module="core">ServerRoot</directive> directory:</p>
2592 <highlight language="config">
2593 Include conf/ssl.conf
2594 Include conf/vhosts/*.conf
2597 <p>Wildcards may be included in the directory or file portion of the
2598 path. This example will fail if there is no subdirectory in conf/vhosts
2599 that contains at least one *.conf file:</p>
2601 <highlight language="config">
2602 Include conf/vhosts/*/*.conf
2605 <p>Alternatively, the following command will just be ignored in case of
2606 missing files or directories:</p>
2608 <highlight language="config">
2609 IncludeOptional conf/vhosts/*/*.conf
2614 <seealso><directive module="core">IncludeOptional</directive></seealso>
2615 <seealso><program>apachectl</program></seealso>
2616 </directivesynopsis>
2619 <name>IncludeOptional</name>
2620 <description>Includes other configuration files from within
2621 the server configuration files</description>
2622 <syntax>IncludeOptional <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2623 <contextlist><context>server config</context><context>virtual host</context>
2624 <context>directory</context>
2626 <compatibility>Available in 2.3.6 and later. Not existent file paths without wildcards
2627 do not cause SyntaxError after 2.4.30</compatibility>
2630 <p>This directive allows inclusion of other configuration files
2631 from within the server configuration files. It works identically to the
2632 <directive module="core">Include</directive> directive, but it will be
2633 silently ignored (instead of causing an error) if wildcards are used and
2634 they do not match any file or directory or if a file path does not exist
2635 on the file system.</p>
2638 <seealso><directive module="core">Include</directive></seealso>
2639 <seealso><program>apachectl</program></seealso>
2640 </directivesynopsis>
2643 <name>KeepAlive</name>
2644 <description>Enables HTTP persistent connections</description>
2645 <syntax>KeepAlive On|Off</syntax>
2646 <default>KeepAlive On</default>
2647 <contextlist><context>server config</context><context>virtual host</context>
2651 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2652 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2653 which allow multiple requests to be sent over the same TCP
2654 connection. In some cases this has been shown to result in an
2655 almost 50% speedup in latency times for HTML documents with
2656 many images. To enable Keep-Alive connections, set
2657 <code>KeepAlive On</code>.</p>
2659 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2660 used if they are specifically requested by a client. In
2661 addition, a Keep-Alive connection with an HTTP/1.0 client can
2662 only be used when the length of the content is known in
2663 advance. This implies that dynamic content such as CGI output,
2664 SSI pages, and server-generated directory listings will
2665 generally not use Keep-Alive connections to HTTP/1.0 clients.
2666 For HTTP/1.1 clients, persistent connections are the default
2667 unless otherwise specified. If the client requests it, chunked
2668 encoding will be used in order to send content of unknown
2669 length over persistent connections.</p>
2671 <p>When a client uses a Keep-Alive connection, it will be counted
2672 as a single "request" for the <directive module="mpm_common"
2673 >MaxConnectionsPerChild</directive> directive, regardless
2674 of how many requests are sent using the connection.</p>
2677 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
2678 </directivesynopsis>
2681 <name>KeepAliveTimeout</name>
2682 <description>Amount of time the server will wait for subsequent
2683 requests on a persistent connection</description>
2684 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
2685 <default>KeepAliveTimeout 5</default>
2686 <contextlist><context>server config</context><context>virtual host</context>
2690 <p>The number of seconds Apache httpd will wait for a subsequent
2691 request before closing the connection. By adding a postfix of ms the
2692 timeout can be also set in milliseconds. Once a request has been
2693 received, the timeout value specified by the
2694 <directive module="core">Timeout</directive> directive applies.</p>
2696 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
2697 may cause performance problems in heavily loaded servers. The
2698 higher the timeout, the more server processes will be kept
2699 occupied waiting on connections with idle clients.</p>
2701 <p>If <directive>KeepAliveTimeout</directive> is <strong>not</strong>
2702 set for a name-based virtual host, the value of the first defined
2703 virtual host best matching the local IP and port will be used.</p>
2705 </directivesynopsis>
2707 <directivesynopsis type="section">
2709 <description>Restrict enclosed access controls to only certain HTTP
2710 methods</description>
2711 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
2712 </Limit></syntax>
2713 <contextlist><context>directory</context><context>.htaccess</context>
2715 <override>AuthConfig, Limit</override>
2718 <p>Access controls are normally effective for
2719 <strong>all</strong> access methods, and this is the usual
2720 desired behavior. <strong>In the general case, access control
2721 directives should not be placed within a
2722 <directive type="section">Limit</directive> section.</strong></p>
2724 <p>The purpose of the <directive type="section">Limit</directive>
2725 directive is to restrict the effect of the access controls to the
2726 nominated HTTP methods. For all other methods, the access
2727 restrictions that are enclosed in the <directive
2728 type="section">Limit</directive> bracket <strong>will have no
2729 effect</strong>. The following example applies the access control
2730 only to the methods <code>POST</code>, <code>PUT</code>, and
2731 <code>DELETE</code>, leaving all other methods unprotected:</p>
2733 <highlight language="config">
2734 <Limit POST PUT DELETE>
2739 <p>The method names listed can be one or more of: <code>GET</code>,
2740 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2741 <code>CONNECT</code>, <code>OPTIONS</code>,
2742 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2743 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2744 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2745 case-sensitive.</strong> If <code>GET</code> is used, it will also
2746 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2747 cannot be limited (see <directive module="core"
2748 >TraceEnable</directive>).</p>
2750 <note type="warning">A <directive type="section"
2751 module="core">LimitExcept</directive> section should always be
2752 used in preference to a <directive type="section">Limit</directive>
2753 section when restricting access, since a <directive type="section"
2754 module="core">LimitExcept</directive> section provides protection
2755 against arbitrary methods.</note>
2757 <p>The <directive type="section">Limit</directive> and
2758 <directive type="section" module="core">LimitExcept</directive>
2759 directives may be nested. In this case, each successive level of
2760 <directive type="section">Limit</directive> or <directive
2761 type="section" module="core">LimitExcept</directive> directives must
2762 further restrict the set of methods to which access controls apply.</p>
2764 <note type="warning">When using
2765 <directive type="section">Limit</directive> or
2766 <directive type="section">LimitExcept</directive> directives with
2767 the <directive module="mod_authz_core">Require</directive> directive,
2768 note that the first <directive module="mod_authz_core">Require</directive>
2769 to succeed authorizes the request, regardless of the presence of other
2770 <directive module="mod_authz_core">Require</directive> directives.</note>
2772 <p>For example, given the following configuration, all users will
2773 be authorized for <code>POST</code> requests, and the
2774 <code>Require group editors</code> directive will be ignored
2777 <highlight language="config">
2778 <LimitExcept GET>
2780 </LimitExcept>
2782 Require group editors
2786 </directivesynopsis>
2788 <directivesynopsis type="section">
2789 <name>LimitExcept</name>
2790 <description>Restrict access controls to all HTTP methods
2791 except the named ones</description>
2792 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2793 </LimitExcept></syntax>
2794 <contextlist><context>directory</context><context>.htaccess</context>
2796 <override>AuthConfig, Limit</override>
2799 <p><directive type="section">LimitExcept</directive> and
2800 <code></LimitExcept></code> are used to enclose
2801 a group of access control directives which will then apply to any
2802 HTTP access method <strong>not</strong> listed in the arguments;
2803 i.e., it is the opposite of a <directive type="section"
2804 module="core">Limit</directive> section and can be used to control
2805 both standard and nonstandard/unrecognized methods. See the
2806 documentation for <directive module="core"
2807 type="section">Limit</directive> for more details.</p>
2811 <highlight language="config">
2812 <LimitExcept POST GET>
2814 </LimitExcept>
2818 </directivesynopsis>
2821 <name>LimitInternalRecursion</name>
2822 <description>Determine maximum number of internal redirects and nested
2823 subrequests</description>
2824 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2825 <default>LimitInternalRecursion 10</default>
2826 <contextlist><context>server config</context><context>virtual host</context>
2830 <p>An internal redirect happens, for example, when using the <directive
2831 module="mod_actions">Action</directive> directive, which internally
2832 redirects the original request to a CGI script. A subrequest is Apache httpd's
2833 mechanism to find out what would happen for some URI if it were requested.
2834 For example, <module>mod_dir</module> uses subrequests to look for the
2835 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2838 <p><directive>LimitInternalRecursion</directive> prevents the server
2839 from crashing when entering an infinite loop of internal redirects or
2840 subrequests. Such loops are usually caused by misconfigurations.</p>
2842 <p>The directive stores two different limits, which are evaluated on
2843 per-request basis. The first <var>number</var> is the maximum number of
2844 internal redirects that may follow each other. The second <var>number</var>
2845 determines how deeply subrequests may be nested. If you specify only one
2846 <var>number</var>, it will be assigned to both limits.</p>
2848 <highlight language="config">
2849 LimitInternalRecursion 5
2852 </directivesynopsis>
2855 <name>LimitRequestBody</name>
2856 <description>Restricts the total size of the HTTP request body sent
2857 from the client</description>
2858 <syntax>LimitRequestBody <var>bytes</var></syntax>
2859 <default>LimitRequestBody 0</default>
2860 <contextlist><context>server config</context><context>virtual host</context>
2861 <context>directory</context><context>.htaccess</context>
2863 <override>All</override>
2866 <p>This directive specifies the number of <var>bytes</var> from 0
2867 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2868 request body. See the note below for the limited applicability
2869 to proxy requests.</p>
2871 <p>The <directive>LimitRequestBody</directive> directive allows
2872 the user to set a limit on the allowed size of an HTTP request
2873 message body within the context in which the directive is given
2874 (server, per-directory, per-file or per-location). If the client
2875 request exceeds that limit, the server will return an error
2876 response instead of servicing the request. The size of a normal
2877 request message body will vary greatly depending on the nature of
2878 the resource and the methods allowed on that resource. CGI scripts
2879 typically use the message body for retrieving form information.
2880 Implementations of the <code>PUT</code> method will require
2881 a value at least as large as any representation that the server
2882 wishes to accept for that resource.</p>
2884 <p>This directive gives the server administrator greater
2885 control over abnormal client request behavior, which may be
2886 useful for avoiding some forms of denial-of-service
2889 <p>If, for example, you are permitting file upload to a particular
2890 location and wish to limit the size of the uploaded file to 100K,
2891 you might use the following directive:</p>
2893 <highlight language="config">
2894 LimitRequestBody 102400
2897 <note><p>For a full description of how this directive is interpreted by
2898 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2902 </directivesynopsis>
2905 <name>LimitRequestFields</name>
2906 <description>Limits the number of HTTP request header fields that
2907 will be accepted from the client</description>
2908 <syntax>LimitRequestFields <var>number</var></syntax>
2909 <default>LimitRequestFields 100</default>
2910 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2913 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2914 32767. The default value is defined by the compile-time
2915 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2918 <p>The <directive>LimitRequestFields</directive> directive allows
2919 the server administrator to modify the limit on the number of
2920 request header fields allowed in an HTTP request. A server needs
2921 this value to be larger than the number of fields that a normal
2922 client request might include. The number of request header fields
2923 used by a client rarely exceeds 20, but this may vary among
2924 different client implementations, often depending upon the extent
2925 to which a user has configured their browser to support detailed
2926 content negotiation. Optional HTTP extensions are often expressed
2927 using request header fields.</p>
2929 <p>This directive gives the server administrator greater
2930 control over abnormal client request behavior, which may be
2931 useful for avoiding some forms of denial-of-service attacks.
2932 The value should be increased if normal clients see an error
2933 response from the server that indicates too many fields were
2934 sent in the request.</p>
2938 <highlight language="config">
2939 LimitRequestFields 50
2942 <note type="warning"><title>Warning</title>
2943 <p> When name-based virtual hosting is used, the value for this
2944 directive is taken from the default (first-listed) virtual host for the
2945 local IP and port combination.</p>
2949 </directivesynopsis>
2952 <name>LimitRequestFieldSize</name>
2953 <description>Limits the size of the HTTP request header allowed from the
2954 client</description>
2955 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2956 <default>LimitRequestFieldSize 8190</default>
2957 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2960 <p>This directive specifies the number of <var>bytes</var>
2961 that will be allowed in an HTTP request header.</p>
2963 <p>The <directive>LimitRequestFieldSize</directive> directive
2964 allows the server administrator to set the limit
2965 on the allowed size of an HTTP request header field. A server
2966 needs this value to be large enough to hold any one header field
2967 from a normal client request. The size of a normal request header
2968 field will vary greatly among different client implementations,
2969 often depending upon the extent to which a user has configured
2970 their browser to support detailed content negotiation. SPNEGO
2971 authentication headers can be up to 12392 bytes.</p>
2973 <p>This directive gives the server administrator greater
2974 control over abnormal client request behavior, which may be
2975 useful for avoiding some forms of denial-of-service attacks.</p>
2979 <highlight language="config">
2980 LimitRequestFieldSize 4094
2983 <note>Under normal conditions, the value should not be changed from
2986 <note type="warning"><title>Warning</title>
2987 <p> When name-based virtual hosting is used, the value for this
2988 directive is taken from the default (first-listed) virtual host best
2989 matching the current IP address and port combination.</p>
2992 </directivesynopsis>
2995 <name>LimitRequestLine</name>
2996 <description>Limit the size of the HTTP request line that will be accepted
2997 from the client</description>
2998 <syntax>LimitRequestLine <var>bytes</var></syntax>
2999 <default>LimitRequestLine 8190</default>
3000 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3003 <p>This directive sets the number of <var>bytes</var> that will be
3004 allowed on the HTTP request-line.</p>
3006 <p>The <directive>LimitRequestLine</directive> directive allows
3007 the server administrator to set the limit on the allowed size
3008 of a client's HTTP request-line. Since the request-line consists of the
3009 HTTP method, URI, and protocol version, the
3010 <directive>LimitRequestLine</directive> directive places a
3011 restriction on the length of a request-URI allowed for a request
3012 on the server. A server needs this value to be large enough to
3013 hold any of its resource names, including any information that
3014 might be passed in the query part of a <code>GET</code> request.</p>
3016 <p>This directive gives the server administrator greater
3017 control over abnormal client request behavior, which may be
3018 useful for avoiding some forms of denial-of-service attacks.</p>
3022 <highlight language="config">
3023 LimitRequestLine 4094
3026 <note>Under normal conditions, the value should not be changed from
3029 <note type="warning"><title>Warning</title>
3030 <p> When name-based virtual hosting is used, the value for this
3031 directive is taken from the default (first-listed) virtual host best
3032 matching the current IP address and port combination.</p>
3036 </directivesynopsis>
3039 <name>LimitXMLRequestBody</name>
3040 <description>Limits the size of an XML-based request body</description>
3041 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
3042 <default>LimitXMLRequestBody 1000000</default>
3043 <contextlist><context>server config</context><context>virtual host</context>
3044 <context>directory</context><context>.htaccess</context></contextlist>
3045 <override>All</override>
3048 <p>Limit (in bytes) on maximum size of an XML-based request
3049 body. A value of <code>0</code> will disable any checking.</p>
3053 <highlight language="config">
3054 LimitXMLRequestBody 0
3058 </directivesynopsis>
3060 <directivesynopsis type="section">
3061 <name>Location</name>
3062 <description>Applies the enclosed directives only to matching
3064 <syntax><Location
3065 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
3066 <contextlist><context>server config</context><context>virtual host</context>
3070 <p>The <directive type="section">Location</directive> directive
3071 limits the scope of the enclosed directives by URL. It is similar to the
3072 <directive type="section" module="core">Directory</directive>
3073 directive, and starts a subsection which is terminated with a
3074 <code></Location></code> directive. <directive
3075 type="section">Location</directive> sections are processed in the
3076 order they appear in the configuration file, after the <directive
3077 type="section" module="core">Directory</directive> sections and
3078 <code>.htaccess</code> files are read, and after the <directive
3079 type="section" module="core">Files</directive> sections.</p>
3081 <p><directive type="section">Location</directive> sections operate
3082 completely outside the filesystem. This has several consequences.
3083 Most importantly, <directive type="section">Location</directive>
3084 directives should not be used to control access to filesystem
3085 locations. Since several different URLs may map to the same
3086 filesystem location, such access controls may by circumvented.</p>
3088 <p>The enclosed directives will be applied to the request if the path component
3089 of the URL meets <em>any</em> of the following criteria:
3092 <li>The specified location matches exactly the path component of the URL.
3094 <li>The specified location, which ends in a forward slash, is a prefix
3095 of the path component of the URL (treated as a context root).
3097 <li>The specified location, with the addition of a trailing slash, is a
3098 prefix of the path component of the URL (also treated as a context root).
3102 In the example below, where no trailing slash is used, requests to
3103 /private1, /private1/ and /private1/file.txt will have the enclosed
3104 directives applied, but /private1other would not.
3106 <highlight language="config">
3107 <Location "/private1">
3112 In the example below, where a trailing slash is used, requests to
3113 /private2/ and /private2/file.txt will have the enclosed
3114 directives applied, but /private2 and /private2other would not.
3116 <highlight language="config">
3117 <Location "/private2<em>/</em>">
3122 <note><title>When to use <directive
3123 type="section">Location</directive></title>
3125 <p>Use <directive type="section">Location</directive> to apply
3126 directives to content that lives outside the filesystem. For
3127 content that lives in the filesystem, use <directive
3128 type="section" module="core">Directory</directive> and <directive
3129 type="section" module="core">Files</directive>. An exception is
3130 <code><Location "/"></code>, which is an easy way to
3131 apply a configuration to the entire server.</p>
3134 <p>For all origin (non-proxy) requests, the URL to be matched is a
3135 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
3136 port, or query string may be included.</em> For proxy requests, the
3137 URL to be matched is of the form
3138 <code>scheme://servername/path</code>, and you must include the
3141 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
3142 any single character, and <code>*</code> matches any sequences of
3143 characters. Neither wildcard character matches a / in the URL-path.</p>
3145 <p><glossary ref="regex">Regular expressions</glossary>
3146 can also be used, with the addition of the <code>~</code>
3147 character. For example:</p>
3149 <highlight language="config">
3150 <Location ~ "/(extra|special)/data">
3155 <p>would match URLs that contained the substring <code>/extra/data</code>
3156 or <code>/special/data</code>. The directive <directive
3157 type="section" module="core">LocationMatch</directive> behaves
3158 identical to the regex version of <directive
3159 type="section">Location</directive>, and is preferred, for the
3160 simple reason that <code>~</code> is hard to distinguish from
3161 <code>-</code> in many fonts.</p>
3163 <p>The <directive type="section">Location</directive>
3164 functionality is especially useful when combined with the
3165 <directive module="core">SetHandler</directive>
3166 directive. For example, to enable status requests but allow them
3167 only from browsers at <code>example.com</code>, you might use:</p>
3169 <highlight language="config">
3170 <Location "/status">
3171 SetHandler server-status
3172 Require host example.com
3176 <note><title>Note about / (slash)</title>
3177 <p>The slash character has special meaning depending on where in a
3178 URL it appears. People may be used to its behavior in the filesystem
3179 where multiple adjacent slashes are frequently collapsed to a single
3180 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
3181 <code>/home/foo</code>). In URL-space this is not necessarily true.
3182 The <directive type="section" module="core">LocationMatch</directive>
3183 directive and the regex version of <directive type="section"
3184 >Location</directive> require you to explicitly specify multiple
3185 slashes if that is your intention.</p>
3187 <p>For example, <code><LocationMatch "^/abc"></code> would match
3188 the request URL <code>/abc</code> but not the request URL <code>
3189 //abc</code>. The (non-regex) <directive type="section"
3190 >Location</directive> directive behaves similarly when used for
3191 proxy requests. But when (non-regex) <directive type="section"
3192 >Location</directive> is used for non-proxy requests it will
3193 implicitly match multiple slashes with a single slash. For example,
3194 if you specify <code><Location "/abc/def"></code> and the
3195 request is to <code>/abc//def</code> then it will match.</p>
3198 <seealso><a href="../sections.html">How <Directory>, <Location>
3199 and <Files> sections work</a> for an explanation of how these
3200 different sections are combined when a request is received.</seealso>
3201 <seealso><directive module="core">LocationMatch</directive></seealso>
3202 </directivesynopsis>
3204 <directivesynopsis type="section">
3205 <name>LocationMatch</name>
3206 <description>Applies the enclosed directives only to regular-expression
3207 matching URLs</description>
3208 <syntax><LocationMatch
3209 <var>regex</var>> ... </LocationMatch></syntax>
3210 <contextlist><context>server config</context><context>virtual host</context>
3214 <p>The <directive type="section">LocationMatch</directive> directive
3215 limits the scope of the enclosed directives by URL, in an identical manner
3216 to <directive module="core" type="section">Location</directive>. However,
3217 it takes a <glossary ref="regex">regular expression</glossary>
3218 as an argument instead of a simple string. For example:</p>
3220 <highlight language="config">
3221 <LocationMatch "/(extra|special)/data">
3223 </LocationMatch>
3226 <p>would match URLs that contained the substring <code>/extra/data</code>
3227 or <code>/special/data</code>.</p>
3229 <note><p>If the intent is that a URL <strong>starts with</strong>
3230 <code>/extra/data</code>, rather than merely
3231 <strong>contains</strong> <code>/extra/data</code>, prefix the
3232 regular expression with a <code>^</code> to require this.</p>
3234 <highlight language="config">
3235 <LocationMatch "^/(extra|special)/data">
3239 <p>From 2.4.8 onwards, named groups and backreferences are captured and
3240 written to the environment with the corresponding name prefixed with
3241 "MATCH_" and in upper case. This allows elements of URLs to be referenced
3242 from within <a href="../expr.html">expressions</a> and modules like
3243 <module>mod_rewrite</module>. In order to prevent confusion, numbered
3244 (unnamed) backreferences are ignored. Use named groups instead.</p>
3246 <highlight language="config">
3247 <LocationMatch "^/combined/(?<sitename>[^/]+)">
3248 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
3249 </LocationMatch>
3252 <note><title>Note about / (slash)</title>
3253 <p>The slash character has special meaning depending on where in a
3254 URL it appears. People may be used to its behavior in the filesystem
3255 where multiple adjacent slashes are frequently collapsed to a single
3256 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
3257 <code>/home/foo</code>). In URL-space this is not necessarily true.
3258 The <directive type="section" module="core">LocationMatch</directive>
3259 directive and the regex version of <directive type="section"
3260 >Location</directive> require you to explicitly specify multiple
3261 slashes if that is your intention.</p>
3263 <p>For example, <code><LocationMatch "^/abc"></code> would match
3264 the request URL <code>/abc</code> but not the request URL <code>
3265 //abc</code>. The (non-regex) <directive type="section"
3266 >Location</directive> directive behaves similarly when used for
3267 proxy requests. But when (non-regex) <directive type="section"
3268 >Location</directive> is used for non-proxy requests it will
3269 implicitly match multiple slashes with a single slash. For example,
3270 if you specify <code><Location "/abc/def"></code> and the
3271 request is to <code>/abc//def</code> then it will match.</p>
3275 <seealso><a href="../sections.html">How <Directory>, <Location>
3276 and <Files> sections work</a> for an explanation of how these
3277 different sections are combined when a request is received</seealso>
3278 </directivesynopsis>
3281 <name>LogLevel</name>
3282 <description>Controls the verbosity of the ErrorLog</description>
3283 <syntax>LogLevel [<var>module</var>:]<var>level</var>
3284 [<var>module</var>:<var>level</var>] ...
3286 <default>LogLevel warn</default>
3287 <contextlist><context>server config</context><context>virtual host</context>
3288 <context>directory</context>
3290 <compatibility>Per-module and per-directory configuration is available in
3291 Apache HTTP Server 2.3.6 and later</compatibility>
3294 <p><directive>LogLevel</directive> adjusts the verbosity of the
3295 messages recorded in the error logs (see <directive
3296 module="core">ErrorLog</directive> directive). The following
3297 <var>level</var>s are available, in order of decreasing
3301 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
3304 <th><strong>Level</strong> </th>
3306 <th><strong>Description</strong> </th>
3308 <th><strong>Example</strong> </th>
3312 <td><code>emerg</code> </td>
3314 <td>Emergencies - system is unusable.</td>
3316 <td>"Child cannot open lock file. Exiting"</td>
3320 <td><code>alert</code> </td>
3322 <td>Action must be taken immediately.</td>
3324 <td>"getpwuid: couldn't determine user name from uid"</td>
3328 <td><code>crit</code> </td>
3330 <td>Critical Conditions.</td>
3332 <td>"socket: Failed to get a socket, exiting child"</td>
3336 <td><code>error</code> </td>
3338 <td>Error conditions.</td>
3340 <td>"Premature end of script headers"</td>
3344 <td><code>warn</code> </td>
3346 <td>Warning conditions.</td>
3348 <td>"child process 1234 did not exit, sending another
3353 <td><code>notice</code> </td>
3355 <td>Normal but significant condition.</td>
3357 <td>"httpd: caught SIGBUS, attempting to dump core in
3362 <td><code>info</code> </td>
3364 <td>Informational.</td>
3366 <td>"Server seems busy, (you may need to increase
3367 StartServers, or Min/MaxSpareServers)..."</td>
3371 <td><code>debug</code> </td>
3373 <td>Debug-level messages</td>
3375 <td>"Opening config file ..."</td>
3378 <td><code>trace1</code> </td>
3380 <td>Trace messages</td>
3382 <td>"proxy: FTP: control connection complete"</td>
3385 <td><code>trace2</code> </td>
3387 <td>Trace messages</td>
3389 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
3392 <td><code>trace3</code> </td>
3394 <td>Trace messages</td>
3396 <td>"openssl: Handshake: start"</td>
3399 <td><code>trace4</code> </td>
3401 <td>Trace messages</td>
3403 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
3406 <td><code>trace5</code> </td>
3408 <td>Trace messages</td>
3410 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
3413 <td><code>trace6</code> </td>
3415 <td>Trace messages</td>
3417 <td>"cache lookup FAILED, forcing new map lookup"</td>
3420 <td><code>trace7</code> </td>
3422 <td>Trace messages, dumping large amounts of data</td>
3424 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
3427 <td><code>trace8</code> </td>
3429 <td>Trace messages, dumping large amounts of data</td>
3431 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
3435 <p>When a particular level is specified, messages from all
3436 other levels of higher significance will be reported as well.
3437 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
3438 then messages with log levels of <code>notice</code> and
3439 <code>warn</code> will also be posted.</p>
3441 <p>Using a level of at least <code>crit</code> is
3446 <highlight language="config">
3450 <note><title>Note</title>
3451 <p>When logging to a regular file, messages of the level
3452 <code>notice</code> cannot be suppressed and thus are always
3453 logged. However, this doesn't apply when logging is done
3454 using <code>syslog</code>.</p>
3457 <p>Specifying a level without a module name will reset the level
3458 for all modules to that level. Specifying a level with a module
3459 name will set the level for that module only. It is possible to
3460 use the module source file name, the module identifier, or the
3461 module identifier with the trailing <code>_module</code> omitted
3462 as module specification. This means the following three specifications
3465 <highlight language="config">
3466 LogLevel info ssl:warn
3467 LogLevel info mod_ssl.c:warn
3468 LogLevel info ssl_module:warn
3471 <p>It is also possible to change the level per directory:</p>
3473 <highlight language="config">
3475 <Directory "/usr/local/apache/htdocs/app">
3481 Per directory loglevel configuration only affects messages that are
3482 logged after the request has been parsed and that are associated with
3483 the request. Log messages which are associated with the server or
3484 the connection are not affected. The latter can be influenced by the
3485 <directive module="core">LogLevelOverride</directive> directive,
3489 <seealso><directive module="core">ErrorLog</directive></seealso>
3490 <seealso><directive module="core">ErrorLogFormat</directive></seealso>
3491 <seealso><directive module="core">LogLevelOverride</directive></seealso>
3492 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
3493 </directivesynopsis>
3496 <name>LogLevelOverride</name>
3497 <description>Override the verbosity of the ErrorLog for certain clients</description>
3498 <syntax>LogLevel <var>ipaddress</var>[/<var>prefixlen</var>]
3499 [<var>module</var>:]<var>level</var> [<var>module</var>:<var>level</var>] ...
3501 <default>unset</default>
3502 <contextlist><context>server config</context><context>virtual host</context>
3504 <compatibility>Available in Apache HTTP Server 2.5.0 and later</compatibility>
3507 <p><directive>LogLevelOverride</directive> adjusts the
3508 <directive module="core">LogLevel</directive> for requests coming from
3509 certain client IP addresses.
3510 This allows to enable verbose logging only for certain test clients.
3511 The IP address is checked at a very early state in the connection
3512 processing. Therefore, <directive>LogLevelOverride</directive> allows to
3513 change the log level for things like the SSL handshake which happen before
3514 a <directive module="core">LogLevel</directive> directive in an
3515 <directive type="section" module="core">If</directive> container would
3518 <p><directive>LogLevelOverride</directive> accepts either a single
3519 IP-address or a CIDR IP-address/len subnet specification.
3520 For the syntax of the loglevel specification, see the
3521 <directive module="core">LogLevel</directive> directive.</p>
3523 <p>For requests that match a <directive>LogLevelOverride</directive>
3524 directive, per-directory specifications of
3525 <directive module="core">LogLevel</directive> are ignored.</p>
3529 <highlight language="config">
3530 LogLevelOverride 192.0.2.0/24 ssl:trace6
3531 LogLevelOverride 192.0.2.7 ssl:trace8
3535 <directive>LogLevelOverride</directive> only affects
3536 log messages that are associated with the request or the connection.
3537 Log messages which are associated with the server are not affected.
3541 <seealso><directive module="core">LogLevel</directive></seealso>
3542 </directivesynopsis>
3545 <name>MaxKeepAliveRequests</name>
3546 <description>Number of requests allowed on a persistent
3547 connection</description>
3548 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
3549 <default>MaxKeepAliveRequests 100</default>
3550 <contextlist><context>server config</context><context>virtual host</context>
3554 <p>The <directive>MaxKeepAliveRequests</directive> directive
3555 limits the number of requests allowed per connection when
3556 <directive module="core" >KeepAlive</directive> is on. If it is
3557 set to <code>0</code>, unlimited requests will be allowed. We
3558 recommend that this setting be kept to a high value for maximum
3559 server performance.</p>
3563 <highlight language="config">
3564 MaxKeepAliveRequests 500
3567 </directivesynopsis>
3570 <name>MaxRanges</name>
3571 <description>Number of ranges allowed before returning the complete
3572 resource </description>
3573 <syntax>MaxRanges default | unlimited | none | <var>number-of-ranges</var></syntax>
3574 <default>MaxRanges 200</default>
3575 <contextlist><context>server config</context><context>virtual host</context>
3576 <context>directory</context>
3578 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3581 <p>The <directive>MaxRanges</directive> directive
3582 limits the number of HTTP ranges the server is willing to
3583 return to the client. If more ranges than permitted are requested,
3584 the complete resource is returned instead.</p>
3587 <dt><strong>default</strong></dt>
3588 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3590 <dt><strong>none</strong></dt>
3591 <dd>Range headers are ignored.</dd>
3593 <dt><strong>unlimited</strong></dt>
3594 <dd>The server does not limit the number of ranges it is
3595 willing to satisfy.</dd>
3597 <dt><var>number-of-ranges</var></dt>
3598 <dd>A positive number representing the maximum number of ranges the
3599 server is willing to satisfy.</dd>
3602 </directivesynopsis>
3605 <name>MaxRangeOverlaps</name>
3606 <description>Number of overlapping ranges (eg: <code>100-200,150-300</code>) allowed before returning the complete
3607 resource </description>
3608 <syntax>MaxRangeOverlaps default | unlimited | none | <var>number-of-ranges</var></syntax>
3609 <default>MaxRangeOverlaps 20</default>
3610 <contextlist><context>server config</context><context>virtual host</context>
3611 <context>directory</context>
3613 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3616 <p>The <directive>MaxRangeOverlaps</directive> directive
3617 limits the number of overlapping HTTP ranges the server is willing to
3618 return to the client. If more overlapping ranges than permitted are requested,
3619 the complete resource is returned instead.</p>
3622 <dt><strong>default</strong></dt>
3623 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3625 <dt><strong>none</strong></dt>
3626 <dd>No overlapping Range headers are allowed.</dd>
3628 <dt><strong>unlimited</strong></dt>
3629 <dd>The server does not limit the number of overlapping ranges it is
3630 willing to satisfy.</dd>
3632 <dt><var>number-of-ranges</var></dt>
3633 <dd>A positive number representing the maximum number of overlapping ranges the
3634 server is willing to satisfy.</dd>
3637 </directivesynopsis>
3640 <name>MaxRangeReversals</name>
3641 <description>Number of range reversals (eg: <code>100-200,50-70</code>) allowed before returning the complete
3642 resource </description>
3643 <syntax>MaxRangeReversals default | unlimited | none | <var>number-of-ranges</var></syntax>
3644 <default>MaxRangeReversals 20</default>
3645 <contextlist><context>server config</context><context>virtual host</context>
3646 <context>directory</context>
3648 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3651 <p>The <directive>MaxRangeReversals</directive> directive
3652 limits the number of HTTP Range reversals the server is willing to
3653 return to the client. If more ranges reversals than permitted are requested,
3654 the complete resource is returned instead.</p>
3657 <dt><strong>default</strong></dt>
3658 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3660 <dt><strong>none</strong></dt>
3661 <dd>No Range reversals headers are allowed.</dd>
3663 <dt><strong>unlimited</strong></dt>
3664 <dd>The server does not limit the number of range reversals it is
3665 willing to satisfy.</dd>
3667 <dt><var>number-of-ranges</var></dt>
3668 <dd>A positive number representing the maximum number of range reversals the
3669 server is willing to satisfy.</dd>
3672 </directivesynopsis>
3676 <description>Configures mutex mechanism and lock file directory for all
3677 or specified mutexes</description>
3678 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
3679 <default>Mutex default</default>
3680 <contextlist><context>server config</context></contextlist>
3681 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
3684 <p>The <directive>Mutex</directive> directive sets the mechanism,
3685 and optionally the lock file location, that httpd and modules use
3686 to serialize access to resources. Specify <code>default</code> as
3687 the second argument to change the settings for all mutexes; specify
3688 a mutex name (see table below) as the second argument to override
3689 defaults only for that mutex.</p>
3691 <p>The <directive>Mutex</directive> directive is typically used in
3692 the following exceptional situations:</p>
3695 <li>change the mutex mechanism when the default mechanism selected
3696 by <glossary>APR</glossary> has a functional or performance
3699 <li>change the directory used by file-based mutexes when the
3700 default directory does not support locking</li>
3703 <note><title>Supported modules</title>
3704 <p>This directive only configures mutexes which have been registered
3705 with the core server using the <code>ap_mutex_register()</code> API.
3706 All modules bundled with httpd support the <directive>Mutex</directive>
3707 directive, but third-party modules may not. Consult the documentation
3708 of the third-party module, which must indicate the mutex name(s) which
3709 can be configured if this directive is supported.</p>
3712 <p>The following mutex <em>mechanisms</em> are available:</p>
3714 <li><code>default | yes</code>
3715 <p>This selects the default locking implementation, as determined by
3716 <glossary>APR</glossary>. The default locking implementation can
3717 be displayed by running <program>httpd</program> with the
3718 <code>-V</code> option.</p></li>
3720 <li><code>none | no</code>
3721 <p>This effectively disables the mutex, and is only allowed for a
3722 mutex if the module indicates that it is a valid choice. Consult the
3723 module documentation for more information.</p></li>
3725 <li><code>posixsem</code>
3726 <p>This is a mutex variant based on a Posix semaphore.</p>
3728 <note type="warning"><title>Warning</title>
3729 <p>The semaphore ownership is not recovered if a thread in the process
3730 holding the mutex segfaults, resulting in a hang of the web server.</p>
3734 <li><code>sysvsem</code>
3735 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3737 <note type="warning"><title>Warning</title>
3738 <p>It is possible to "leak" SysV semaphores if processes crash
3739 before the semaphore is removed.</p>
3742 <note type="warning"><title>Security</title>
3743 <p>The semaphore API allows for a denial of service attack by any
3744 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3745 all CGIs, unless you use something like <program>suexec</program>
3746 or <code>cgiwrapper</code>).</p>
3750 <li><code>sem</code>
3751 <p>This selects the "best" available semaphore implementation, choosing
3752 between Posix and SystemV IPC semaphores, in that order.</p></li>
3754 <li><code>pthread</code>
3755 <p>This is a mutex variant based on cross-process Posix thread
3758 <note type="warning"><title>Warning</title>
3759 <p>On most systems, if a child process terminates abnormally while
3760 holding a mutex that uses this implementation, the server will deadlock
3761 and stop responding to requests. When this occurs, the server will
3762 require a manual restart to recover.</p>
3763 <p>Solaris and Linux are notable exceptions as they provide a mechanism which
3764 usually allows the mutex to be recovered after a child process
3765 terminates abnormally while holding a mutex.</p>
3766 <p>If your system is POSIX compliant or if it implements the
3767 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3768 to use the <code>pthread</code> option safely.</p>
3772 <li><code>fcntl:/path/to/mutex</code>
3773 <p>This is a mutex variant where a physical (lock-)file and the
3774 <code>fcntl()</code> function are used as the mutex.</p>
3776 <note type="warning"><title>Warning</title>
3777 <p>When multiple mutexes based on this mechanism are used within
3778 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3779 can be reported for valid mutex operations if <code>fcntl()</code>
3780 is not thread-aware, such as on Solaris.</p>
3784 <li><code>flock:/path/to/mutex</code>
3785 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3786 with the exception that the <code>flock()</code> function is used to
3787 provide file locking.</p></li>
3789 <li><code>file:/path/to/mutex</code>
3790 <p>This selects the "best" available file locking implementation,
3791 choosing between <code>fcntl</code> and <code>flock</code>, in that
3795 <p>Most mechanisms are only available on selected platforms, where the
3796 underlying platform and <glossary>APR</glossary> support it. Mechanisms
3797 which aren't available on all platforms are <em>posixsem</em>,
3798 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3799 <em>flock</em>, and <em>file</em>.</p>
3801 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3802 the path, if provided, is a directory where the lock file will be created.
3803 The default directory is httpd's run-time file directory,
3804 <directive module="core">DefaultRuntimeDir</directive>. If a relative
3805 path is provided, it is relative to
3806 <directive module="core">DefaultRuntimeDir</directive>. Always use a local
3807 disk filesystem for <code>/path/to/mutex</code> and never a directory residing
3808 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3809 type, an optional instance string provided by the module, and unless the
3810 <code>OmitPID</code> keyword is specified, the process id of the httpd
3811 parent process will be appended to make the file name unique, avoiding
3812 conflicts when multiple httpd instances share a lock file directory. For
3813 example, if the mutex name is <code>mpm-accept</code> and the lock file
3814 directory is <code>/var/httpd/locks</code>, the lock file name for the
3815 httpd instance with parent process id 12345 would be
3816 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3818 <note type="warning"><title>Security</title>
3819 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3820 directory such as <code>/var/tmp</code> because someone could create
3821 a denial of service attack and prevent the server from starting by
3822 creating a lockfile with the same name as the one the server will try
3826 <p>The following table documents the names of mutexes used by httpd
3827 and bundled modules.</p>
3829 <table border="1" style="zebra">
3833 <th>Protected resource</th>
3836 <td><code>mpm-accept</code></td>
3837 <td><module>prefork</module> and <module>worker</module> MPMs</td>
3838 <td>incoming connections, to avoid the thundering herd problem;
3839 for more information, refer to the
3840 <a href="../misc/perf-tuning.html">performance tuning</a>
3844 <td><code>authdigest-client</code></td>
3845 <td><module>mod_auth_digest</module></td>
3846 <td>client list in shared memory</td>
3849 <td><code>authdigest-opaque</code></td>
3850 <td><module>mod_auth_digest</module></td>
3851 <td>counter in shared memory</td>
3854 <td><code>ldap-cache</code></td>
3855 <td><module>mod_ldap</module></td>
3856 <td>LDAP result cache</td>
3859 <td><code>rewrite-map</code></td>
3860 <td><module>mod_rewrite</module></td>
3861 <td>communication with external mapping programs, to avoid
3862 intermixed I/O from multiple requests</td>
3865 <td><code>ssl-cache</code></td>
3866 <td><module>mod_ssl</module></td>
3867 <td>SSL session cache</td>
3870 <td><code>ssl-stapling</code></td>
3871 <td><module>mod_ssl</module></td>
3872 <td>OCSP stapling response cache</td>
3875 <td><code>watchdog-callback</code></td>
3876 <td><module>mod_watchdog</module></td>
3877 <td>callback function of a particular client module</td>
3881 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3882 parent process id from the lock file name.</p>
3884 <p>In the following example, the mutex mechanism for the MPM accept
3885 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3886 with the associated lock file created in directory
3887 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3888 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3890 <highlight language="config">
3891 Mutex sysvsem default
3892 Mutex fcntl:/var/httpd/locks mpm-accept
3895 </directivesynopsis>
3898 <name>NameVirtualHost</name>
3899 <description>DEPRECATED: Designates an IP address for name-virtual
3900 hosting</description>
3901 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
3902 <contextlist><context>server config</context></contextlist>
3906 <p>Prior to 2.3.11, <directive>NameVirtualHost</directive> was required
3907 to instruct the server that a particular IP address and port combination
3908 was usable as a name-based virtual host. In 2.3.11 and later,
3909 any time an IP address and port combination is used in multiple virtual
3910 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3912 <p>This directive currently has no effect.</p>
3915 <seealso><a href="../vhosts/">Virtual Hosts
3916 documentation</a></seealso>
3918 </directivesynopsis>
3921 <name>Options</name>
3922 <description>Configures what features are available in a particular
3923 directory</description>
3925 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
3926 <default>Options FollowSymlinks</default>
3927 <contextlist><context>server config</context><context>virtual host</context>
3928 <context>directory</context><context>.htaccess</context>
3930 <override>Options</override>
3931 <compatibility>The default was changed from All to FollowSymlinks in 2.3.11</compatibility>
3934 <p>The <directive>Options</directive> directive controls which
3935 server features are available in a particular directory.</p>
3937 <p><var>option</var> can be set to <code>None</code>, in which
3938 case none of the extra features are enabled, or one or more of
3942 <dt><code>All</code></dt>
3944 <dd>All options except for <code>MultiViews</code>.</dd>
3946 <dt><code>ExecCGI</code></dt>
3949 Execution of CGI scripts using <module>mod_cgi</module>
3952 <dt><code>FollowSymLinks</code></dt>
3955 The server will follow symbolic links in this directory. This is
3956 the default setting.
3958 <p>Even though the server follows the symlink it does <em>not</em>
3959 change the pathname used to match against <directive type="section"
3960 module="core">Directory</directive> sections.</p>
3962 <p>The <code>FollowSymLinks</code> and
3963 <code>SymLinksIfOwnerMatch</code> <directive
3964 module="core">Options</directive> work only in <directive
3965 type="section" module="core">Directory</directive> sections or
3966 <code>.htaccess</code> files.</p>
3968 <p>Omitting this option should not be considered a security restriction,
3969 since symlink testing is subject to race conditions that make it
3973 <dt><code>Includes</code></dt>
3976 Server-side includes provided by <module>mod_include</module>
3979 <dt><code>IncludesNOEXEC</code></dt>
3983 Server-side includes are permitted, but the <code>#exec
3984 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3985 possible to <code>#include virtual</code> CGI scripts from
3986 <directive module="mod_alias">ScriptAlias</directive>ed
3989 <dt><code>Indexes</code></dt>
3992 If a URL which maps to a directory is requested and there
3993 is no <directive module="mod_dir">DirectoryIndex</directive>
3994 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3995 <module>mod_autoindex</module> will return a formatted listing
3996 of the directory.</dd>
3998 <dt><code>MultiViews</code></dt>
4001 <a href="../content-negotiation.html">Content negotiated</a>
4002 "MultiViews" are allowed using
4003 <module>mod_negotiation</module>.
4004 <note><title>Note</title> <p>This option gets ignored if set
4005 anywhere other than <directive module="core" type="section"
4006 >Directory</directive>, as <module>mod_negotiation</module>
4007 needs real resources to compare against and evaluate from.</p></note>
4010 <dt><code>SymLinksIfOwnerMatch</code></dt>
4012 <dd>The server will only follow symbolic links for which the
4013 target file or directory is owned by the same user id as the
4016 <note><title>Note</title>
4017 <p>The <code>FollowSymLinks</code> and
4018 <code>SymLinksIfOwnerMatch</code> <directive
4019 module="core">Options</directive> work only in <directive
4020 type="section" module="core">Directory</directive> sections or
4021 <code>.htaccess</code> files.</p>
4023 <p>This option should not be considered a security restriction,
4024 since symlink testing is subject to race conditions that make it
4029 <p>Normally, if multiple <directive>Options</directive> could
4030 apply to a directory, then the most specific one is used and
4031 others are ignored; the options are not merged. (See <a
4032 href="../sections.html#merging">how sections are merged</a>.)
4033 However if <em>all</em> the options on the
4034 <directive>Options</directive> directive are preceded by a
4035 <code>+</code> or <code>-</code> symbol, the options are
4036 merged. Any options preceded by a <code>+</code> are added to the
4037 options currently in force, and any options preceded by a
4038 <code>-</code> are removed from the options currently in
4041 <note><title>Note</title>
4042 <p>Mixing <directive>Options</directive> with a <code>+</code> or
4043 <code>-</code> with those without is not valid syntax and will be
4044 rejected during server startup by the syntax check with an abort.</p>
4047 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
4049 <highlight language="config">
4050 <Directory "/web/docs">
4051 Options Indexes FollowSymLinks
4054 <Directory "/web/docs/spec">
4059 <p>then only <code>Includes</code> will be set for the
4060 <code>/web/docs/spec</code> directory. However if the second
4061 <directive>Options</directive> directive uses the <code>+</code> and
4062 <code>-</code> symbols:</p>
4064 <highlight language="config">
4065 <Directory "/web/docs">
4066 Options Indexes FollowSymLinks
4069 <Directory "/web/docs/spec">
4070 Options +Includes -Indexes
4074 <p>then the options <code>FollowSymLinks</code> and
4075 <code>Includes</code> are set for the <code>/web/docs/spec</code>
4078 <note><title>Note</title>
4079 <p>Using <code>-IncludesNOEXEC</code> or
4080 <code>-Includes</code> disables server-side includes completely
4081 regardless of the previous setting.</p>
4084 <p>The default in the absence of any other settings is
4085 <code>FollowSymlinks</code>.</p>
4087 </directivesynopsis>
4090 <name>Protocol</name>
4091 <description>Protocol for a listening socket</description>
4092 <syntax>Protocol <var>protocol</var></syntax>
4093 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4094 <compatibility>On Windows, only available from Apache 2.3.3 and later.</compatibility>
4097 <p>This directive specifies the protocol used for a specific listening socket.
4098 The protocol is used to determine which module should handle a request and
4099 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
4102 <p>You only need to set the protocol if you are running on non-standard ports;
4103 otherwise, <code>http</code> is assumed for port 80 and <code>https</code>
4106 <p>For example, if you are running <code>https</code> on a non-standard port,
4107 specify the protocol explicitly:</p>
4109 <highlight language="config">
4113 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
4115 <seealso><directive module="core">AcceptFilter</directive></seealso>
4116 <seealso><directive module="mpm_common">Listen</directive></seealso>
4117 </directivesynopsis>
4121 <name>Protocols</name>
4122 <description>Protocols available for a server/virtual host</description>
4123 <syntax>Protocols <var>protocol</var> ...</syntax>
4124 <default>Protocols http/1.1</default>
4125 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4126 <compatibility>Only available from Apache 2.4.17 and later.</compatibility>
4129 <p>This directive specifies the list of protocols supported for a
4130 server/virtual host. The list determines the allowed protocols
4131 a client may negotiate for this server/host.</p>
4133 <p>You need to set protocols if you want to extend the available
4134 protocols for a server/host. By default, only the http/1.1 protocol
4135 (which includes the compatibility with 1.0 and 0.9 clients) is
4138 <p>For example, if you want to support HTTP/2 for a server with TLS,
4141 <highlight language="config">
4142 Protocols h2 http/1.1
4145 <p>Valid protocols are <code>http/1.1</code> for http and https connections,
4146 <code>h2</code> on https connections and <code>h2c</code> for http
4147 connections. Modules may enable more protocols.</p>
4149 <p>It is safe to specify protocols that are unavailable/disabled. Such
4150 protocol names will simply be ignored.</p>
4152 <p>Protocols specified in base servers are inherited for virtual hosts
4153 only if the virtual host has no own Protocols directive. Or, the other
4154 way around, Protocols directives in virtual hosts replace any
4155 such directive in the base server.
4159 <seealso><directive module="core">ProtocolsHonorOrder</directive></seealso>
4160 </directivesynopsis>
4164 <name>ProtocolsHonorOrder</name>
4165 <description>Determines if order of Protocols determines precedence during negotiation</description>
4166 <syntax>ProtocolsHonorOrder On|Off</syntax>
4167 <default>ProtocolsHonorOrder On</default>
4168 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4169 <compatibility>Only available from Apache 2.4.17 and later.</compatibility>
4172 <p>This directive specifies if the server should honor the order in which
4173 the <directive>Protocols</directive> directive lists protocols.</p>
4175 <p>If configured Off, the client supplied list order of protocols has
4176 precedence over the order in the server configuration.</p>
4178 <p>With <directive>ProtocolsHonorOrder</directive> set to <code>on</code>
4179 (default), the client ordering does not matter and only the ordering
4180 in the server settings influences the outcome of the protocol
4184 <seealso><directive module="core">Protocols</directive></seealso>
4185 </directivesynopsis>
4189 <name>RegexDefaultOptions</name>
4190 <description>Allow to configure global/default options for regexes</description>
4191 <syntax>RegexDefaultOptions [none] [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
4192 <default>RegexDefaultOptions DOTALL DOLLAR_ENDONLY</default>
4193 <contextlist><context>server config</context></contextlist>
4194 <compatibility>Only available from Apache 2.4.30 and later.</compatibility>
4197 <p>This directive adds some default behavior to ANY regular expression
4198 used afterwards.</p>
4200 <p>Any option preceded by a '+' is added to the already set options.<br />
4201 Any option preceded by a '-' is removed from the already set options.<br />
4202 Any option without a '+' or a '-' will be set, removing any other
4203 already set option.<br />
4204 The <code>none</code> keyword resets any already set options.</p>
4206 <p><var>option</var> can be:</p>
4208 <dt><code>ICASE</code></dt>
4209 <dd>Use a case-insensitive match.</dd>
4211 <dt><code>EXTENDED</code></dt>
4212 <dd>Perl's /x flag, ignore (unescaped-)spaces and comments in the pattern.</dd>
4214 <dt><code>DOTALL</code></dt>
4215 <dd>Perl's /s flag, '.' matches newline characters.</dd>
4217 <dt><code>DOLLAR_ENDONLY</code></dt>
4218 <dd>'$' matches at end of subject string only.</dd>
4220 <highlight language="config">
4221 # Reset all default/defined options
4222 RegexDefaultOptions none
4223 # Add the ICASE option for all regexes by default
4224 RegexDefaultOptions +ICASE
4226 # Add the ICASE option to the already applicable ones
4227 RegexDefaultOptions +ICASE
4228 # Remove the default DOLLAR_ENDONLY option, but keep any other one
4229 RegexDefaultOptions -DOLLAR_ENDONLY
4231 # Set the DOTALL option only, resetting any other one
4232 RegexDefaultOptions DOTALL
4234 # Set the DOTALL and ICASE options only
4235 # Options are applied in order and blindly, so:
4236 # RegexDefaultOptions DOTALL ICASE
4237 # would not work as possibly expected (ICASE clears DOTALL)
4238 RegexDefaultOptions none +DOTALL +ICASE
4240 RegexDefaultOptions DOTALL +ICASE
4244 </directivesynopsis>
4248 <name>RLimitCPU</name>
4249 <description>Limits the CPU consumption of processes launched
4250 by Apache httpd children</description>
4251 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
4252 <default>Unset; uses operating system defaults</default>
4253 <contextlist><context>server config</context><context>virtual host</context>
4254 <context>directory</context><context>.htaccess</context></contextlist>
4255 <override>All</override>
4258 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4259 resource limit for all processes and the second parameter sets
4260 the maximum resource limit. Either parameter can be a number,
4261 or <code>max</code> to indicate to the server that the limit should
4262 be set to the maximum allowed by the operating system
4263 configuration. Raising the maximum resource limit requires that
4264 the server is running as <code>root</code> or in the initial startup
4267 <p>This applies to processes forked from Apache httpd children
4268 servicing requests, not the Apache httpd children themselves. This
4269 includes CGI scripts and SSI exec commands, but not any
4270 processes forked from the Apache httpd parent, such as piped
4273 <p>CPU resource limits are expressed in seconds per
4276 <seealso><directive module="core">RLimitMEM</directive></seealso>
4277 <seealso><directive module="core">RLimitNPROC</directive></seealso>
4278 </directivesynopsis>
4281 <name>RLimitMEM</name>
4282 <description>Limits the memory consumption of processes launched
4283 by Apache httpd children</description>
4284 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
4285 <default>Unset; uses operating system defaults</default>
4286 <contextlist><context>server config</context><context>virtual host</context>
4287 <context>directory</context><context>.htaccess</context></contextlist>
4288 <override>All</override>
4291 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4292 resource limit for all processes and the second parameter sets
4293 the maximum resource limit. Either parameter can be a number,
4294 or <code>max</code> to indicate to the server that the limit should
4295 be set to the maximum allowed by the operating system
4296 configuration. Raising the maximum resource limit requires that
4297 the server is running as <code>root</code> or in the initial startup
4300 <p>This applies to processes forked from Apache httpd children
4301 servicing requests, not the Apache httpd children themselves. This
4302 includes CGI scripts and SSI exec commands, but not any
4303 processes forked from the Apache httpd parent, such as piped
4306 <p>Memory resource limits are expressed in bytes per
4309 <seealso><directive module="core">RLimitCPU</directive></seealso>
4310 <seealso><directive module="core">RLimitNPROC</directive></seealso>
4311 </directivesynopsis>
4314 <name>RLimitNPROC</name>
4315 <description>Limits the number of processes that can be launched by
4316 processes launched by Apache httpd children</description>
4317 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
4318 <default>Unset; uses operating system defaults</default>
4319 <contextlist><context>server config</context><context>virtual host</context>
4320 <context>directory</context><context>.htaccess</context></contextlist>
4321 <override>All</override>
4324 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4325 resource limit for all processes, and the second parameter sets
4326 the maximum resource limit. Either parameter can be a number,
4327 or <code>max</code> to indicate to the server that the limit
4328 should be set to the maximum allowed by the operating system
4329 configuration. Raising the maximum resource limit requires that
4330 the server is running as <code>root</code> or in the initial startup
4333 <p>This applies to processes forked from Apache httpd children
4334 servicing requests, not the Apache httpd children themselves. This
4335 includes CGI scripts and SSI exec commands, but not any
4336 processes forked from the Apache httpd parent, such as piped
4339 <p>Process limits control the number of processes per user.</p>
4341 <note><title>Note</title>
4342 <p>If CGI processes are <strong>not</strong> running
4343 under user ids other than the web server user id, this directive
4344 will limit the number of processes that the server itself can
4345 create. Evidence of this situation will be indicated by
4346 <strong><code>cannot fork</code></strong> messages in the
4347 <code>error_log</code>.</p>
4350 <seealso><directive module="core">RLimitMEM</directive></seealso>
4351 <seealso><directive module="core">RLimitCPU</directive></seealso>
4352 </directivesynopsis>
4355 <name>ScriptInterpreterSource</name>
4356 <description>Technique for locating the interpreter for CGI
4357 scripts</description>
4358 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
4359 <default>ScriptInterpreterSource Script</default>
4360 <contextlist><context>server config</context><context>virtual host</context>
4361 <context>directory</context><context>.htaccess</context></contextlist>
4362 <override>FileInfo</override>
4363 <compatibility>Win32 only.</compatibility>
4366 <p>This directive is used to control how Apache httpd finds the
4367 interpreter used to run CGI scripts. The default setting is
4368 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
4369 by the shebang line (first line, starting with <code>#!</code>) in the
4370 script. On Win32 systems this line usually looks like:</p>
4372 <highlight language="perl">
4373 #!C:/Perl/bin/perl.exe
4376 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
4378 <highlight language="perl">
4382 <p>Setting <code>ScriptInterpreterSource Registry</code> will
4383 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
4384 searched using the script file extension (e.g., <code>.pl</code>) as a
4385 search key. The command defined by the registry subkey
4386 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
4387 <code>Shell\Open\Command</code> is used to open the script file. If the
4388 registry keys cannot be found, Apache httpd falls back to the behavior of the
4389 <code>Script</code> option.</p>
4391 <note type="warning"><title>Security</title>
4392 <p>Be careful when using <code>ScriptInterpreterSource
4393 Registry</code> with <directive
4394 module="mod_alias">ScriptAlias</directive>'ed directories, because
4395 Apache httpd will try to execute <strong>every</strong> file within this
4396 directory. The <code>Registry</code> setting may cause undesired
4397 program calls on files which are typically not executed. For
4398 example, the default open command on <code>.htm</code> files on
4399 most Windows systems will execute Microsoft Internet Explorer, so
4400 any HTTP request for an <code>.htm</code> file existing within the
4401 script directory would start the browser in the background on the
4402 server. This is a good way to crash your system within a minute or
4406 <p>The option <code>Registry-Strict</code>
4407 does the same thing as <code>Registry</code> but uses only the
4408 subkey <code>Shell\ExecCGI\Command</code>. The
4409 <code>ExecCGI</code> key is not a common one. It must be
4410 configured manually in the windows registry and hence prevents
4411 accidental program calls on your system.</p>
4413 </directivesynopsis>
4416 <name>SeeRequestTail</name>
4417 <description>Determine if mod_status displays the first 63 characters
4418 of a request or the last 63, assuming the request itself is greater than
4419 63 chars.</description>
4420 <syntax>SeeRequestTail On|Off</syntax>
4421 <default>SeeRequestTail Off</default>
4422 <contextlist><context>server config</context></contextlist>
4425 <p>mod_status with <code>ExtendedStatus On</code>
4426 displays the actual request being handled.
4427 For historical purposes, only 63 characters of the request
4428 are actually stored for display purposes. This directive
4429 controls whether the 1st 63 characters are stored (the previous
4430 behavior and the default) or if the last 63 characters are. This
4431 is only applicable, of course, if the length of the request is
4432 64 characters or greater.</p>
4434 <p>If Apache httpd is handling <code
4435 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
4436 > mod_status displays as follows:
4441 <th>Off (default)</th>
4442 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
4446 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
4451 </directivesynopsis>
4454 <name>ServerAdmin</name>
4455 <description>Email address that the server includes in error
4456 messages sent to the client</description>
4457 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
4458 <contextlist><context>server config</context><context>virtual host</context>
4462 <p>The <directive>ServerAdmin</directive> sets the contact address
4463 that the server includes in any error messages it returns to the
4464 client. If the <code>httpd</code> doesn't recognize the supplied argument
4466 assumes, that it's an <var>email-address</var> and prepends it with
4467 <code>mailto:</code> in hyperlink targets. However, it's recommended to
4468 actually use an email address, since there are a lot of CGI scripts that
4469 make that assumption. If you want to use an URL, it should point to another
4470 server under your control. Otherwise users may not be able to contact you in
4473 <p>It may be worth setting up a dedicated address for this, e.g.</p>
4475 <highlight language="config">
4476 ServerAdmin www-admin@foo.example.com
4478 <p>as users do not always mention that they are talking about the
4481 </directivesynopsis>
4484 <name>ServerAlias</name>
4485 <description>Alternate names for a host used when matching requests
4486 to name-virtual hosts</description>
4487 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
4488 <contextlist><context>virtual host</context></contextlist>
4491 <p>The <directive>ServerAlias</directive> directive sets the
4492 alternate names for a host, for use with <a
4493 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
4494 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
4496 <highlight language="config">
4497 <VirtualHost *:80>
4498 ServerName server.example.com
4499 ServerAlias server server2.example.com server2
4500 ServerAlias *.example.com
4501 UseCanonicalName Off
4503 </VirtualHost>
4506 <p>Name-based virtual hosts for the best-matching set of <directive
4507 type="section" module="core">virtualhost</directive>s are processed
4508 in the order they appear in the configuration. The first matching <directive
4509 module="core">ServerName</directive> or <directive module="core"
4510 >ServerAlias</directive> is used, with no different precedence for wildcards
4511 (nor for ServerName vs. ServerAlias). </p>
4513 <p>The complete list of names in the <directive type="section" module="core"
4514 >VirtualHost</directive>
4515 directive are treated just like a (non wildcard)
4516 <directive>ServerAlias</directive>.</p>
4519 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4520 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4521 </directivesynopsis>
4524 <name>ServerName</name>
4525 <description>Hostname and port that the server uses to identify
4526 itself</description>
4527 <syntax>ServerName [<var>scheme</var>://]<var>domain-name</var>|<var>ip-address</var>[:<var>port</var>]</syntax>
4528 <contextlist><context>server config</context><context>virtual host</context>
4532 <p>The <directive>ServerName</directive> directive sets the
4533 request scheme, hostname and port that the server uses to identify itself.
4536 <p><directive>ServerName</directive> is used (possibly
4537 in conjunction with <directive module="core">ServerAlias</directive>) to uniquely
4538 identify a virtual host, when using <a
4539 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
4541 <p>Additionally, this is used when
4542 creating self-referential redirection URLs when
4543 <directive module="core">UseCanonicalName</directive> is set to a non-default
4546 <p>For example, if the name of the
4547 machine hosting the web server is <code>simple.example.com</code>,
4548 but the machine also has the DNS alias <code>www.example.com</code>
4549 and you wish the web server to be so identified, the following
4550 directive should be used:</p>
4552 <highlight language="config">
4553 ServerName www.example.com
4556 <p>The <directive>ServerName</directive> directive
4557 may appear anywhere within the definition of a server. However,
4558 each appearance overrides the previous appearance (within that
4561 <p>If no <directive>ServerName</directive> is specified, the
4562 server attempts to deduce the client visible hostname by first asking
4563 the operating system for the system hostname, and if that fails,
4564 performing a reverse lookup on an IP address present on the system.</p>
4566 <p>If no port is specified in the
4567 <directive>ServerName</directive>, then the server will use the
4568 port from the incoming request. For optimal reliability and
4569 predictability, you should specify an explicit hostname and port
4570 using the <directive>ServerName</directive> directive.</p>
4572 <p>If you are using <a
4573 href="../vhosts/name-based.html">name-based virtual hosts</a>,
4574 the <directive>ServerName</directive> inside a
4575 <directive type="section" module="core">VirtualHost</directive>
4576 section specifies what hostname must appear in the request's
4577 <code>Host:</code> header to match this virtual host.</p>
4579 <p>Sometimes, the server runs behind a device that processes SSL,
4580 such as a reverse proxy, load balancer or SSL offload
4581 appliance. When this is the case, specify the
4582 <code>https://</code> scheme and the port number to which the
4583 clients connect in the <directive>ServerName</directive> directive
4584 to make sure that the server generates the correct
4585 self-referential URLs.
4588 <p>See the description of the
4589 <directive module="core">UseCanonicalName</directive> and
4590 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
4591 settings which determine whether self-referential URLs (e.g., by the
4592 <module>mod_dir</module> module) will refer to the
4593 specified port, or to the port number given in the client's request.
4596 <note type="warning">
4597 <p>Failure to set <directive>ServerName</directive> to a name that
4598 your server can resolve to an IP address will result in a startup
4599 warning. <code>httpd</code> will then use whatever hostname it can
4600 determine, using the system's <code>hostname</code> command. This
4601 will almost never be the hostname you actually want.</p>
4603 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
4609 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4610 Apache HTTP Server</a></seealso>
4611 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
4612 documentation</a></seealso>
4613 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4614 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
4615 <seealso><directive module="core">ServerAlias</directive></seealso>
4616 </directivesynopsis>
4619 <name>ServerPath</name>
4620 <description>Legacy URL pathname for a name-based virtual host that
4621 is accessed by an incompatible browser</description>
4622 <syntax>ServerPath <var>URL-path</var></syntax>
4623 <contextlist><context>virtual host</context></contextlist>
4626 <p>The <directive>ServerPath</directive> directive sets the legacy
4627 URL pathname for a host, for use with <a
4628 href="../vhosts/">name-based virtual hosts</a>.</p>
4630 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4631 </directivesynopsis>
4634 <name>ServerRoot</name>
4635 <description>Base directory for the server installation</description>
4636 <syntax>ServerRoot <var>directory-path</var></syntax>
4637 <default>ServerRoot /usr/local/apache</default>
4638 <contextlist><context>server config</context></contextlist>
4641 <p>The <directive>ServerRoot</directive> directive sets the
4642 directory in which the server lives. Typically it will contain the
4643 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
4644 paths in other configuration directives (such as <directive
4645 module="core">Include</directive> or <directive
4646 module="mod_so">LoadModule</directive>, for example) are taken as
4647 relative to this directory.</p>
4649 <highlight language="config">
4650 ServerRoot "/home/httpd"
4653 <p>The default location of <directive>ServerRoot</directive> may be
4654 modified by using the <code>--prefix</code> argument to
4655 <a href="../programs/configure.html"><code>configure</code></a>, and
4656 most third-party distributions of the server have a different
4657 default location from the one listed above.</p>
4660 <seealso><a href="../invoking.html">the <code>-d</code>
4661 option to <code>httpd</code></a></seealso>
4662 <seealso><a href="../misc/security_tips.html#serverroot">the
4663 security tips</a> for information on how to properly set
4664 permissions on the <directive>ServerRoot</directive></seealso>
4665 </directivesynopsis>
4668 <name>ServerSignature</name>
4669 <description>Configures the footer on server-generated documents</description>
4670 <syntax>ServerSignature On|Off|EMail</syntax>
4671 <default>ServerSignature Off</default>
4672 <contextlist><context>server config</context><context>virtual host</context>
4673 <context>directory</context><context>.htaccess</context>
4675 <override>All</override>
4678 <p>The <directive>ServerSignature</directive> directive allows the
4679 configuration of a trailing footer line under server-generated
4680 documents (error messages, <module>mod_proxy</module> ftp directory
4681 listings, <module>mod_info</module> output, ...). The reason why you
4682 would want to enable such a footer line is that in a chain of proxies,
4683 the user often has no possibility to tell which of the chained servers
4684 actually produced a returned error message.</p>
4686 <p>The <code>Off</code>
4687 setting, which is the default, suppresses the footer line.
4688 The <code>On</code> setting simply adds a line with the
4689 server version number and <directive
4690 module="core">ServerName</directive> of the serving virtual host,
4691 and the <code>EMail</code> setting additionally creates a
4692 "mailto:" reference to the <directive
4693 module="core">ServerAdmin</directive> of the referenced
4696 <p>The details of the server version number
4697 presented are controlled by the <directive
4698 module="core">ServerTokens</directive> directive.</p>
4700 <seealso><directive module="core">ServerTokens</directive></seealso>
4701 </directivesynopsis>
4704 <name>ServerTokens</name>
4705 <description>Configures the <code>Server</code> HTTP response
4706 header</description>
4707 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
4708 <default>ServerTokens Full</default>
4709 <contextlist><context>server config</context></contextlist>
4712 <p>This directive controls whether <code>Server</code> response
4713 header field which is sent back to clients includes a
4714 description of the generic OS-type of the server as well as
4715 information about compiled-in modules.</p>
4718 <dt><code>ServerTokens Full</code> (or not specified)</dt>
4720 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4721 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4723 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4725 <dd>Server sends (<em>e.g.</em>): <code>Server:
4728 <dt><code>ServerTokens Major</code></dt>
4730 <dd>Server sends (<em>e.g.</em>): <code>Server:
4731 Apache/2</code></dd>
4733 <dt><code>ServerTokens Minor</code></dt>
4735 <dd>Server sends (<em>e.g.</em>): <code>Server:
4736 Apache/2.4</code></dd>
4738 <dt><code>ServerTokens Min[imal]</code></dt>
4740 <dd>Server sends (<em>e.g.</em>): <code>Server:
4741 Apache/2.4.2</code></dd>
4743 <dt><code>ServerTokens OS</code></dt>
4745 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4750 <p>This setting applies to the entire server, and cannot be
4751 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4753 <p>This directive also controls the
4754 information presented by the <directive
4755 module="core">ServerSignature</directive> directive.</p>
4757 <note>Setting <directive>ServerTokens</directive> to less than
4758 <code>minimal</code> is not recommended because it makes it more
4759 difficult to debug interoperational problems. Also note that
4760 disabling the Server: header does nothing at all to make your
4761 server more secure. The idea of "security through obscurity"
4762 is a myth and leads to a false sense of safety.</note>
4764 <seealso><directive module="core">ServerSignature</directive></seealso>
4765 </directivesynopsis>
4768 <name>SetHandler</name>
4769 <description>Forces all matching files to be processed by a
4770 handler</description>
4771 <syntax>SetHandler <var>handler-name</var>|none|<var>expression</var></syntax>
4772 <contextlist><context>server config</context><context>virtual host</context>
4773 <context>directory</context><context>.htaccess</context>
4775 <override>FileInfo</override>
4776 <compatibility>2.5 and later</compatibility>
4779 <p>When placed into an <code>.htaccess</code> file or a
4780 <directive type="section" module="core">Directory</directive> or
4781 <directive type="section" module="core">Location</directive>
4782 section, this directive forces all matching files to be parsed
4783 through the <a href="../handler.html">handler</a> given by
4784 <var>handler-name</var>. For example, if you had a directory you
4785 wanted to be parsed entirely as imagemap rule files, regardless
4786 of extension, you might put the following into an
4787 <code>.htaccess</code> file in that directory:</p>
4789 <highlight language="config">
4790 SetHandler imap-file
4793 <p>Another example: if you wanted to have the server display a
4794 status report whenever a URL of
4795 <code>http://servername/status</code> was called, you might put
4796 the following into <code>httpd.conf</code>:</p>
4798 <highlight language="config">
4799 <Location "/status">
4800 SetHandler server-status
4804 <p>You could also use this directive to configure a particular
4805 handler for files with a particular file extension. For example:</p>
4807 <highlight language="config">
4808 <FilesMatch "\.php$">
4809 SetHandler application/x-httpd-php
4813 <p>String-valued expressions can be used to reference per-request
4814 variables, including backreferences to named regular expressions:</p>
4816 <highlight language="config">
4817 <LocationMatch ^/app/(?<sub>[^/]+)/>
4818 SetHandler "proxy:unix:/var/run/app_%{env:MATCH_sub}.sock|fcgi://localhost:8080"
4819 </LocationMatch>
4822 <p>You can override an earlier defined <directive>SetHandler</directive>
4823 directive by using the value <code>None</code>.</p>
4825 <note><title>Note</title>
4826 <p>Because <directive>SetHandler</directive> overrides default handlers,
4827 normal behavior such as handling of URLs ending in a slash (/) as
4828 directories or index files is suppressed.</p></note>
4831 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
4833 </directivesynopsis>
4836 <name>SetInputFilter</name>
4837 <description>Sets the filters that will process client requests and POST
4839 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
4840 <contextlist><context>server config</context><context>virtual host</context>
4841 <context>directory</context><context>.htaccess</context>
4843 <override>FileInfo</override>
4846 <p>The <directive>SetInputFilter</directive> directive sets the
4847 filter or filters which will process client requests and POST
4848 input when they are received by the server. This is in addition to
4849 any filters defined elsewhere, including the
4850 <directive module="mod_mime">AddInputFilter</directive>
4853 <p>If more than one filter is specified, they must be separated
4854 by semicolons in the order in which they should process the
4857 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4858 </directivesynopsis>
4861 <name>SetOutputFilter</name>
4862 <description>Sets the filters that will process responses from the
4863 server</description>
4864 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
4865 <contextlist><context>server config</context><context>virtual host</context>
4866 <context>directory</context><context>.htaccess</context>
4868 <override>FileInfo</override>
4871 <p>The <directive>SetOutputFilter</directive> directive sets the filters
4872 which will process responses from the server before they are
4873 sent to the client. This is in addition to any filters defined
4874 elsewhere, including the
4875 <directive module="mod_mime">AddOutputFilter</directive>
4878 <p>For example, the following configuration will process all files
4879 in the <code>/www/data/</code> directory for server-side
4882 <highlight language="config">
4883 <Directory "/www/data/">
4884 SetOutputFilter INCLUDES
4888 <p>If more than one filter is specified, they must be separated
4889 by semicolons in the order in which they should process the
4892 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4893 </directivesynopsis>
4896 <name>TimeOut</name>
4897 <description>Amount of time the server will wait for
4898 certain events before failing a request</description>
4899 <syntax>TimeOut <var>time-interval</var>[s]</syntax>
4900 <default>TimeOut 60</default>
4901 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4904 <p>The <directive>TimeOut</directive> directive defines the length
4905 of time Apache httpd will wait for I/O in various circumstances:</p>
4908 <li><p>When reading data from the client, the length of time to
4909 wait for a TCP packet to arrive if the read buffer is
4911 <p> For initial data on a new connection, this directive doesn't
4912 take effect until after any configured <directive module="core">
4913 AcceptFilter</directive> has passed the new connection to the server.</p>
4916 <li>When writing data to the client, the length of time to wait
4917 for an acknowledgement of a packet if the send buffer is
4920 <li>In <module>mod_cgi</module> and <module>mod_cgid</module>,
4921 the length of time to wait for any individual block of output
4922 from a CGI script.</li>
4924 <li>In <module>mod_ext_filter</module>, the length of time to
4925 wait for output from a filtering process.</li>
4927 <li>In <module>mod_proxy</module>, the default timeout value if
4928 <directive module="mod_proxy">ProxyTimeout</directive> is not
4933 </directivesynopsis>
4936 <name>TraceEnable</name>
4937 <description>Determines the behavior on <code>TRACE</code> requests</description>
4938 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
4939 <default>TraceEnable on</default>
4940 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4943 <p>This directive overrides the behavior of <code>TRACE</code> for both
4944 the core server and <module>mod_proxy</module>. The default
4945 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4946 RFC 2616, which disallows any request body to accompany the request.
4947 <code>TraceEnable off</code> causes the core server and
4948 <module>mod_proxy</module> to return a <code>405</code> (Method not
4949 allowed) error to the client.</p>
4951 <p>Finally, for testing and diagnostic purposes only, request
4952 bodies may be allowed using the non-compliant <code>TraceEnable
4953 extended</code> directive. The core (as an origin server) will
4954 restrict the request body to 64Kb (plus 8Kb for chunk headers if
4955 <code>Transfer-Encoding: chunked</code> is used). The core will
4956 reflect the full headers and all chunk headers with the response
4957 body. As a proxy server, the request body is not restricted to 64Kb.</p>
4959 <note><title>Note</title>
4961 <p>Despite claims to the contrary, enabling the <code>TRACE</code>
4962 method does not expose any security vulnerability in Apache httpd.
4963 The <code>TRACE</code> method is defined by the HTTP/1.1
4964 specification and implementations are expected to support it.</p>
4968 </directivesynopsis>
4971 <name>UnDefine</name>
4972 <description>Undefine the existence of a variable</description>
4973 <syntax>UnDefine <var>parameter-name</var></syntax>
4974 <contextlist><context>server config</context>
4975 <context>virtual host</context></contextlist>
4978 <p>Undoes the effect of a <directive module="core">Define</directive> or
4979 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
4980 <p>This directive can be used to toggle the use of <directive module="core"
4981 type="section">IfDefine</directive> sections without needing to alter
4982 <code>-D</code> arguments in any startup scripts.</p>
4983 <p>While this directive is supported in virtual host context,
4984 the changes it makes are visible to any later configuration
4985 directives, beyond any enclosing virtual host.</p>
4987 <seealso><directive module="core">Define</directive></seealso>
4988 <seealso><directive module="core">IfDefine</directive></seealso>
4989 </directivesynopsis>
4992 <name>UseCanonicalName</name>
4993 <description>Configures how the server determines its own name and
4995 <syntax>UseCanonicalName On|Off|DNS</syntax>
4996 <default>UseCanonicalName Off</default>
4997 <contextlist><context>server config</context><context>virtual host</context>
4998 <context>directory</context></contextlist>
5001 <p>In many situations Apache httpd must construct a <em>self-referential</em>
5002 URL -- that is, a URL that refers back to the same server. With
5003 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
5004 specified in the <directive module="core">ServerName</directive>
5005 directive to construct the canonical name for the server. This name
5006 is used in all self-referential URLs, and for the values of
5007 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
5009 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
5010 self-referential URLs using the hostname and port supplied by
5011 the client if any are supplied (otherwise it will use the
5012 canonical name, as defined above). These values are the same
5013 that are used to implement <a
5014 href="../vhosts/name-based.html">name-based virtual hosts</a>
5015 and are available with the same clients. The CGI variables
5016 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
5017 constructed from the client supplied values as well.</p>
5019 <p>An example where this may be useful is on an intranet server
5020 where you have users connecting to the machine using short
5021 names such as <code>www</code>. You'll notice that if the users
5022 type a shortname and a URL which is a directory, such as
5023 <code>http://www/splat</code>, <em>without the trailing
5024 slash</em>, then Apache httpd will redirect them to
5025 <code>http://www.example.com/splat/</code>. If you have
5026 authentication enabled, this will cause the user to have to
5027 authenticate twice (once for <code>www</code> and once again
5028 for <code>www.example.com</code> -- see <a
5029 href="http://wiki.apache.org/httpd/FAQ#Why_does_Apache_ask_for_my_password_twice_before_serving_a_file.3F">
5030 the FAQ on this subject for more information</a>). But if
5031 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
5032 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
5034 <p>There is a third option, <code>UseCanonicalName DNS</code>,
5035 which is intended for use with mass IP-based virtual hosting to
5036 support ancient clients that do not provide a
5037 <code>Host:</code> header. With this option, Apache httpd does a
5038 reverse DNS lookup on the server IP address that the client
5039 connected to in order to work out self-referential URLs.</p>
5041 <note type="warning"><title>Warning</title>
5042 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>,
5043 they may be broken by this option. The client is essentially free
5044 to give whatever value they want as a hostname. But if the CGI is
5045 only using <code>SERVER_NAME</code> to construct self-referential URLs,
5046 then it should be just fine.</p>
5049 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
5050 <seealso><directive module="core">ServerName</directive></seealso>
5051 <seealso><directive module="mpm_common">Listen</directive></seealso>
5052 </directivesynopsis>
5055 <name>UseCanonicalPhysicalPort</name>
5056 <description>Configures how the server determines its own port</description>
5057 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
5058 <default>UseCanonicalPhysicalPort Off</default>
5059 <contextlist><context>server config</context><context>virtual host</context>
5060 <context>directory</context></contextlist>
5063 <p>In many situations Apache httpd must construct a <em>self-referential</em>
5064 URL -- that is, a URL that refers back to the same server. With
5065 <code>UseCanonicalPhysicalPort On</code>, Apache httpd will, when
5066 constructing the canonical port for the server to honor
5067 the <directive module="core">UseCanonicalName</directive> directive,
5068 provide the actual physical port number being used by this request
5069 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>,
5070 Apache httpd will not ever use the actual physical port number, instead
5071 relying on all configured information to construct a valid port number.</p>
5073 <note><title>Note</title>
5074 <p>The ordering of the lookup when the physical port is used is as
5077 <dt><code>UseCanonicalName Off | DNS</code></dt>
5080 <li>Parsed port from <code>Host:</code> header</li>
5081 <li>Physical port (only with <directive>UseCanonicalPhysicalPort</directive> ON)</li>
5082 <li>Port provided in <directive module="core">Servername</directive></li>
5083 <li>Default port</li>
5086 <dt><code>UseCanonicalName On</code></dt>
5089 <li>Port provided in <directive module="core">Servername</directive></li>
5090 <li>Physical port (only with <directive>UseCanonicalPhysicalPort</directive> ON)</li>
5091 <li>Default port</li>
5096 <p>Only with <code>UseCanonicalPhysicalPort On</code>, the
5097 physical ports are included in the search.</p>
5101 <seealso><directive module="core">UseCanonicalName</directive></seealso>
5102 <seealso><directive module="core">ServerName</directive></seealso>
5103 <seealso><directive module="mpm_common">Listen</directive></seealso>
5104 </directivesynopsis>
5106 <directivesynopsis type="section">
5107 <name>VirtualHost</name>
5108 <description>Contains directives that apply only to a specific
5109 hostname or IP address</description>
5110 <syntax><VirtualHost
5111 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
5112 ...> ... </VirtualHost></syntax>
5113 <contextlist><context>server config</context></contextlist>
5116 <p><directive type="section">VirtualHost</directive> and
5117 <code></VirtualHost></code> are used to enclose a group of
5118 directives that will apply only to a particular virtual host. Any
5119 directive that is allowed in a virtual host context may be
5120 used. When the server receives a request for a document on a
5121 particular virtual host, it uses the configuration directives
5122 enclosed in the <directive type="section">VirtualHost</directive>
5123 section. <var>Addr</var> can be any of the following, optionally followed by
5124 a colon and a port number (or *):</p>
5127 <li>The IP address of the virtual host;</li>
5129 <li>A fully qualified domain name for the IP address of the
5130 virtual host (not recommended);</li>
5132 <li>The character <code>*</code>, which acts as a wildcard and matches
5133 any IP address.</li>
5135 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
5139 <highlight language="config">
5140 <VirtualHost 10.1.2.3:80>
5141 ServerAdmin webmaster@host.example.com
5142 DocumentRoot "/www/docs/host.example.com"
5143 ServerName host.example.com
5144 ErrorLog "logs/host.example.com-error_log"
5145 TransferLog "logs/host.example.com-access_log"
5146 </VirtualHost>
5150 <p>IPv6 addresses must be specified in square brackets because
5151 the optional port number could not be determined otherwise. An
5152 IPv6 example is shown below:</p>
5154 <highlight language="config">
5155 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
5156 ServerAdmin webmaster@host.example.com
5157 DocumentRoot "/www/docs/host.example.com"
5158 ServerName host.example.com
5159 ErrorLog "logs/host.example.com-error_log"
5160 TransferLog "logs/host.example.com-access_log"
5161 </VirtualHost>
5164 <p>Each Virtual Host must correspond to a different IP address,
5165 different port number, or a different host name for the server,
5166 in the former case the server machine must be configured to
5167 accept IP packets for multiple addresses. (If the machine does
5168 not have multiple network interfaces, then this can be
5169 accomplished with the <code>ifconfig alias</code> command -- if
5170 your OS supports it).</p>
5172 <note><title>Note</title>
5173 <p>The use of <directive type="section">VirtualHost</directive> does
5174 <strong>not</strong> affect what addresses Apache httpd listens on. You
5175 may need to ensure that Apache httpd is listening on the correct addresses
5176 using <directive module="mpm_common">Listen</directive>.</p>
5179 <p>A <directive module="core">ServerName</directive> should be
5180 specified inside each <directive
5181 type="section">VirtualHost</directive> block. If it is absent, the
5182 <directive module="core">ServerName</directive> from the "main"
5183 server configuration will be inherited.</p>
5185 <p>When a request is received, the server first maps it to the best matching
5186 <directive type="section">VirtualHost</directive> based on the local
5187 IP address and port combination only. Non-wildcards have a higher
5188 precedence. If no match based on IP and port occurs at all, the
5189 "main" server configuration is used.</p>
5191 <p>If multiple virtual hosts contain the best matching IP address and port,
5192 the server selects from these virtual hosts the best match based on the
5193 requested hostname. If no matching name-based virtual host is found,
5194 then the first listed virtual host that matched the IP address will be
5195 used. As a consequence, the first listed virtual host for a given IP address
5196 and port combination is the default virtual host for that IP and port
5199 <note type="warning"><title>Security</title>
5200 <p>See the <a href="../misc/security_tips.html">security tips</a>
5201 document for details on why your security could be compromised if the
5202 directory where log files are stored is writable by anyone other
5203 than the user that starts the server.</p>
5206 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
5207 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
5208 Apache HTTP Server</a></seealso>
5209 <seealso><a href="../bind.html">Setting
5210 which addresses and ports Apache HTTP Server uses</a></seealso>
5211 <seealso><a href="../sections.html">How <Directory>, <Location>
5212 and <Files> sections work</a> for an explanation of how these
5213 different sections are combined when a request is received</seealso>
5214 </directivesynopsis>
5217 <name>RegisterHttpMethod</name>
5218 <description>Register non-standard HTTP methods</description>
5219 <syntax>RegisterHttpMethod <var>method</var> [<var>method</var> [...]]</syntax>
5220 <contextlist><context>server config</context></contextlist>
5221 <compatibility>Available in Apache HTTP Server 2.4.24 and later</compatibility>
5224 <p>This directive may be used to register additional HTTP methods. This is
5225 necessary if non-standard methods need to be used with directives that accept
5226 method names as parameters, or to allow particular non-standard methods to be
5227 used via proxy or CGI script when the server has been configured to only pass
5228 recognized methods to modules.</p>
5230 <seealso><directive module="core">HTTPProtocolOptions</directive></seealso>
5231 <seealso><directive module="mod_allowmethods">AllowMethods</directive></seealso>
5232 </directivesynopsis>
5235 <name>Warning</name>
5236 <description>Warn from configuration parsing with a custom message</description>
5237 <syntax>Warning <var>message</var></syntax>
5238 <contextlist><context>server config</context><context>virtual host</context>
5239 <context>directory</context><context>.htaccess</context>
5241 <override>All</override>
5242 <compatibility>2.5 and later</compatibility>
5245 <p>If an issue can be detected from within the configuration, this
5246 directive can be used to generate a custom warning message. The
5247 configuration parsing is not halted. The typical use is to check
5248 whether some user define options are set, and warn if not.</p>
5250 <highlight language="config">
5252 # tell when ReverseProxy is not set
5253 <IfDefine !ReverseProxy>
5254 Warning "reverse proxy is not started, hope this is okay!"
5257 <IfDefine ReverseProxy>
5258 # define custom proxy configuration
5263 </directivesynopsis>
5266 <name>MergeTrailers</name>
5267 <description>Determines whether trailers are merged into headers</description>
5268 <syntax>MergeTrailers [on|off]</syntax>
5269 <default>MergeTrailers off</default>
5270 <contextlist><context>server config</context><context>virtual host</context></contextlist>
5271 <compatibility>2.4.11 and later</compatibility>
5274 <p>This directive controls whether HTTP trailers are copied into the
5275 internal representation of HTTP headers. This merging occurs when the
5276 request body has been completely consumed, long after most header
5277 processing would have a chance to examine or modify request headers.</p>
5278 <p>This option is provided for compatibility with releases prior to 2.4.11,
5279 where trailers were always merged.</p>
5281 </directivesynopsis>
5284 <name>QualifyRedirectURL</name>
5285 <description>Controls whether the REDIRECT_URL environment variable is
5286 fully qualified</description>
5287 <syntax>QualifyRedirectURL ON|OFF</syntax>
5288 <default>QualifyRedirectURL OFF</default>
5289 <contextlist><context>server config</context><context>virtual host</context>
5290 <context>directory</context>
5292 <override>FileInfo</override>
5293 <compatibility>Directive supported in 2.4.18 and later. 2.4.17 acted
5294 as if 'QualifyRedirectURL ON' was configured.</compatibility>
5297 <p>This directive controls whether the server will ensure that the
5298 REDIRECT_URL environment variable is fully qualified. By default,
5299 the variable contains the verbatim URL requested by the client,
5300 such as "/index.html". With <directive module="core"
5301 >QualifyRedirectURL ON</directive>, the same request would result in a
5302 value such as "http://www.example.com/index.html".</p>
5303 <p>Even without this directive set, when a request is issued against a
5304 fully qualified URL, REDIRECT_URL will remain fully qualified.
5307 </directivesynopsis>
5310 <name>StrictHostCheck</name>
5311 <description>Controls whether the server requires the requested hostname be
5312 listed enumerated in the virtual host handling the request
5314 <syntax>StrictHostCheck ON|OFF</syntax>
5315 <default>StrictHostCheck OFF</default>
5316 <contextlist><context>server config</context><context>virtual host</context>
5318 <compatibility>Added in 2.5.1</compatibility>
5321 <p>By default, the server will respond to requests for any hostname,
5322 including requests addressed to unexpected or unconfigured hostnames.
5323 While this is convenient, it is sometimes desirable to limit what hostnames
5324 a backend application handles since it will often generate self-referential
5327 <p>By setting <directive>StrictHostCheck</directive> to <em>ON</em>,
5328 the server will return an HTTP 400 error if the requested hostname
5329 hasn't been explicitly listed by either <directive module="core"
5330 >ServerName</directive> or <directive module="core"
5331 >ServerAlias</directive> in the virtual host that best matches the
5332 details of the incoming connection.</p>
5334 <p>This directive also allows matching of the requested hostname to hostnames
5335 specified within the opening <directive module="core">VirtualHost</directive>
5336 tag, which is a relatively obscure configuration mechanism that acts like
5337 additional <directive module="core">ServerAlias</directive> entries.</p>
5339 <p>This directive has no affect in non-default virtual hosts. The value
5340 inherited from the global server configuration, or the default virtualhost
5341 for the ip:port the underlying connection, determine the effective value.</p>
5343 </directivesynopsis>
5346 <name>MergeSlashes</name>
5347 <description>Controls whether the server merges consecutive slashes in URLs.
5349 <syntax>MergeSlashes ON|OFF</syntax>
5350 <default>MergeSlashes ON</default>
5351 <contextlist><context>server config</context><context>virtual host</context>
5353 <compatibility>Added in 2.5.1</compatibility>
5356 <p>By default, the server merges (or collapses) multiple consecutive slash
5357 ('/') characters in the path component of the request URL.</p>
5359 <p>When mapping URL's to the filesystem, these multiple slashes are not
5360 significant. However, URL's handled other ways, such as by CGI or proxy,
5361 might prefer to retain the significance of multiple consecutive slashes.
5362 In these cases <directive>MergeSlashes</directive> can be set to
5363 <em>OFF</em> to retain the multiple consecutive slashes. In these
5364 configurations, regular expressions used in the configuration file that match
5365 the path component of the URL (<directive>LocationMatch</directive>,
5366 <directive>RewriteRule</directive>, ...) need to take into account multiple
5367 consecutive slashes.</p>
5369 </directivesynopsis>