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>
35 <compatibility>Available in Apache httpd 2.1.5 and later.
36 On Windows from Apache httpd 2.3.3 and later.</compatibility>
39 <p>This directive enables operating system specific optimizations for a
40 listening socket by the <directive>Protocol</directive>type.
41 The basic premise is for the kernel to not send a socket to the server
42 process until either data is received or an entire HTTP Request is buffered.
43 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
44 FreeBSD's Accept Filters</a>, Linux's more primitive
45 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
46 are currently supported.</p>
48 <p>Using <code>none</code> for an argument will disable any accept filters
49 for that protocol. This is useful for protocols that require a server
50 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
51 <highlight language="config">
52 AcceptFilter nntp none
55 <p>The default protocol names are <code>https</code> for port 443
56 and <code>http</code> for all other ports. To specify another protocol
57 is being used with a listening port, add the <var>protocol</var>
58 argument to the <directive module="mpm_common">Listen</directive>
61 <p>The default values on FreeBSD are:</p>
62 <highlight language="config">
63 AcceptFilter http httpready
64 AcceptFilter https dataready
67 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
68 the kernel level. Once an entire request is received, the kernel then
69 sends it to the server. See the
70 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
71 accf_http(9)</a> man page for more details. Since HTTPS requests are
72 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
73 accf_data(9)</a> filter is used.</p>
75 <p>The default values on Linux are:</p>
76 <highlight language="config">
77 AcceptFilter http data
78 AcceptFilter https data
81 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
82 requests. Any value besides <code>none</code> will enable
83 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
85 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
86 tcp(7)</a> man page.</p>
88 <p>The default values on Windows are:</p>
89 <highlight language="config">
90 AcceptFilter http data
91 AcceptFilter https data
94 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
95 API, and does not support http protocol buffering. There are two values
96 which utilize the Windows AcceptEx() API and will recycle network
97 sockets between connections. <code>data</code> waits until data has
98 been transmitted as documented above, and the initial data buffer and
99 network endpoint addresses are all retrieved from the single AcceptEx()
100 invocation. <code>connect</code> will use the AcceptEx() API, also
101 retrieve the network endpoint addresses, but like <code>none</code>
102 the <code>connect</code> option does not wait for the initial data
105 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
106 and will not recycle sockets between connections. This is useful for
107 network adapters with broken driver support, as well as some virtual
108 network providers such as vpn drivers, or spam, virus or spyware
112 <seealso><directive module="core">Protocol</directive></seealso>
116 <name>AcceptPathInfo</name>
117 <description>Resources accept trailing pathname information</description>
118 <syntax>AcceptPathInfo On|Off|Default</syntax>
119 <default>AcceptPathInfo Default</default>
120 <contextlist><context>server config</context>
121 <context>virtual host</context><context>directory</context>
122 <context>.htaccess</context></contextlist>
123 <override>FileInfo</override>
124 <compatibility>Available in Apache httpd 2.0.30 and later</compatibility>
128 <p>This directive controls whether requests that contain trailing
129 pathname information that follows an actual filename (or
130 non-existent file in an existing directory) will be accepted or
131 rejected. The trailing pathname information can be made
132 available to scripts in the <code>PATH_INFO</code> environment
135 <p>For example, assume the location <code>/test/</code> points to
136 a directory that contains only the single file
137 <code>here.html</code>. Then requests for
138 <code>/test/here.html/more</code> and
139 <code>/test/nothere.html/more</code> both collect
140 <code>/more</code> as <code>PATH_INFO</code>.</p>
142 <p>The three possible arguments for the
143 <directive>AcceptPathInfo</directive> directive are:</p>
145 <dt><code>Off</code></dt><dd>A request will only be accepted if it
146 maps to a literal path that exists. Therefore a request with
147 trailing pathname information after the true filename such as
148 <code>/test/here.html/more</code> in the above example will return
149 a 404 NOT FOUND error.</dd>
151 <dt><code>On</code></dt><dd>A request will be accepted if a
152 leading path component maps to a file that exists. The above
153 example <code>/test/here.html/more</code> will be accepted if
154 <code>/test/here.html</code> maps to a valid file.</dd>
156 <dt><code>Default</code></dt><dd>The treatment of requests with
157 trailing pathname information is determined by the <a
158 href="../handler.html">handler</a> responsible for the request.
159 The core handler for normal files defaults to rejecting
160 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
161 href="mod_cgi.html">cgi-script</a> and <a
162 href="mod_isapi.html">isapi-handler</a>, generally accept
163 <code>PATH_INFO</code> by default.</dd>
166 <p>The primary purpose of the <code>AcceptPathInfo</code>
167 directive is to allow you to override the handler's choice of
168 accepting or rejecting <code>PATH_INFO</code>. This override is required,
169 for example, when you use a <a href="../filter.html">filter</a>, such
170 as <a href="mod_include.html">INCLUDES</a>, to generate content
171 based on <code>PATH_INFO</code>. The core handler would usually reject
172 the request, so you can use the following configuration to enable
175 <highlight language="config">
176 <Files "mypaths.shtml">
178 SetOutputFilter INCLUDES
187 <name>AccessFileName</name>
188 <description>Name of the distributed configuration file</description>
189 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
190 <default>AccessFileName .htaccess</default>
191 <contextlist><context>server config</context><context>virtual host</context>
195 <p>While processing a request the server looks for
196 the first existing configuration file from this list of names in
197 every directory of the path to the document, if distributed
198 configuration files are <a href="#allowoverride">enabled for that
199 directory</a>. For example:</p>
201 <highlight language="config">AccessFileName .acl</highlight>
203 <p>before returning the document
204 <code>/usr/local/web/index.html</code>, the server will read
205 <code>/.acl</code>, <code>/usr/.acl</code>,
206 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
207 for directives, unless they have been disabled with</p>
209 <highlight language="config">
215 <seealso><directive module="core">AllowOverride</directive></seealso>
216 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
217 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
221 <name>AddDefaultCharset</name>
222 <description>Default charset parameter to be added when a response
223 content-type is <code>text/plain</code> or <code>text/html</code></description>
224 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
225 <default>AddDefaultCharset Off</default>
226 <contextlist><context>server config</context>
227 <context>virtual host</context><context>directory</context>
228 <context>.htaccess</context></contextlist>
229 <override>FileInfo</override>
232 <p>This directive specifies a default value for the media type
233 charset parameter (the name of a character encoding) to be added
234 to a response if and only if the response's content-type is either
235 <code>text/plain</code> or <code>text/html</code>. This should override
236 any charset specified in the body of the response via a <code>META</code>
237 element, though the exact behavior is often dependent on the user's client
238 configuration. A setting of <code>AddDefaultCharset Off</code>
239 disables this functionality. <code>AddDefaultCharset On</code> enables
240 a default charset of <code>iso-8859-1</code>. Any other value is assumed
241 to be the <var>charset</var> to be used, which should be one of the
242 <a href="http://www.iana.org/assignments/character-sets">IANA registered
243 charset values</a> for use in Internet media types (MIME types).
246 <highlight language="config">AddDefaultCharset utf-8</highlight>
248 <p><directive>AddDefaultCharset</directive> should only be used when all
249 of the text resources to which it applies are known to be in that
250 character encoding and it is too inconvenient to label their charset
251 individually. One such example is to add the charset parameter
252 to resources containing generated content, such as legacy CGI
253 scripts, that might be vulnerable to cross-site scripting attacks
254 due to user-provided data being included in the output. Note, however,
255 that a better solution is to just fix (or delete) those scripts, since
256 setting a default charset does not protect users that have enabled
257 the "auto-detect character encoding" feature on their browser.</p>
259 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
263 <name>AllowEncodedSlashes</name>
264 <description>Determines whether encoded path separators in URLs are allowed to
265 be passed through</description>
266 <syntax>AllowEncodedSlashes On|Off|NoDecode</syntax>
267 <default>AllowEncodedSlashes Off</default>
268 <contextlist><context>server config</context><context>virtual host</context>
270 <compatibility>Available in Apache httpd 2.0.46 and later.
271 NoDecode option available in 2.3.12 and later.</compatibility>
274 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
275 which contain encoded path separators (<code>%2F</code> for <code>/</code>
276 and additionally <code>%5C</code> for <code>\</code> on according systems)
277 to be used in the path info.</p>
279 <p>With the default value, <code>Off</code>, such URLs are refused
280 with a 404 (Not found) error.</p>
282 <p>With the value <code>On</code>, such URLs are accepted, and encoded
283 slashes are decoded like all other encoded characters.</p>
285 <p>With the value <code>NoDecode</code>, such URLs are accepted, but
286 encoded slashes are not decoded but left in their encoded state.</p>
288 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
289 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
291 <note><title>Note</title>
292 <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
293 strongly recommended as a security measure. Allowing slashes
294 to be decoded could potentially allow unsafe paths.</p>
297 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
301 <name>AllowOverride</name>
302 <description>Types of directives that are allowed in
303 <code>.htaccess</code> files</description>
304 <syntax>AllowOverride All|None|<var>directive-type</var>
305 [<var>directive-type</var>] ...</syntax>
306 <default>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</default>
307 <contextlist><context>directory</context></contextlist>
310 <p>When the server finds an <code>.htaccess</code> file (as
311 specified by <directive module="core">AccessFileName</directive>)
312 it needs to know which directives declared in that file can override
313 earlier configuration directives.</p>
315 <note><title>Only available in <Directory> sections</title>
316 <directive>AllowOverride</directive> is valid only in
317 <directive type="section" module="core">Directory</directive>
318 sections specified without regular expressions, not in <directive
319 type="section" module="core">Location</directive>, <directive
320 module="core" type="section">DirectoryMatch</directive> or
321 <directive type="section" module="core">Files</directive> sections.
324 <p>When this directive is set to <code>None</code> and <directive
325 module="core">AllowOverrideList</directive> is set to
326 <code>None</code> <a href="#accessfilename">.htaccess</a> files are
327 completely ignored. In this case, the server will not even attempt
328 to read <code>.htaccess</code> files in the filesystem.</p>
330 <p>When this directive is set to <code>All</code>, then any
331 directive which has the .htaccess <a
332 href="directive-dict.html#Context">Context</a> is allowed in
333 <code>.htaccess</code> files.</p>
335 <p>The <var>directive-type</var> can be one of the following
336 groupings of directives.</p>
343 Allow use of the authorization directives (<directive
344 module="mod_authz_dbm">AuthDBMGroupFile</directive>,
345 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
346 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
347 <directive module="mod_authn_core">AuthName</directive>,
348 <directive module="mod_authn_core">AuthType</directive>, <directive
349 module="mod_authn_file">AuthUserFile</directive>, <directive
350 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
355 Allow use of the directives controlling document types
356 (<directive module="core">ErrorDocument</directive>,
357 <directive module="core">ForceType</directive>,
358 <directive module="mod_negotiation">LanguagePriority</directive>,
359 <directive module="core">SetHandler</directive>,
360 <directive module="core">SetInputFilter</directive>,
361 <directive module="core">SetOutputFilter</directive>, and
362 <module>mod_mime</module> Add* and Remove* directives),
363 document meta data (<directive
364 module="mod_headers">Header</directive>, <directive
365 module="mod_headers">RequestHeader</directive>, <directive
366 module="mod_setenvif">SetEnvIf</directive>, <directive
367 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
368 module="mod_setenvif">BrowserMatch</directive>, <directive
369 module="mod_usertrack">CookieExpires</directive>, <directive
370 module="mod_usertrack">CookieDomain</directive>, <directive
371 module="mod_usertrack">CookieStyle</directive>, <directive
372 module="mod_usertrack">CookieTracking</directive>, <directive
373 module="mod_usertrack">CookieName</directive>),
374 <module>mod_rewrite</module> directives <directive
375 module="mod_rewrite">RewriteEngine</directive>, <directive
376 module="mod_rewrite">RewriteOptions</directive>, <directive
377 module="mod_rewrite">RewriteBase</directive>, <directive
378 module="mod_rewrite">RewriteCond</directive>, <directive
379 module="mod_rewrite">RewriteRule</directive>) and
380 <directive module="mod_actions">Action</directive> from
381 <module>mod_actions</module>.
387 Allow use of the directives controlling directory indexing
389 module="mod_autoindex">AddDescription</directive>,
390 <directive module="mod_autoindex">AddIcon</directive>, <directive
391 module="mod_autoindex">AddIconByEncoding</directive>,
392 <directive module="mod_autoindex">AddIconByType</directive>,
393 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
394 module="mod_dir">DirectoryIndex</directive>, <a href="mod_autoindex.html#indexoptions.fancyindexing"
395 ><code>FancyIndexing</code></a>, <directive
396 module="mod_autoindex">HeaderName</directive>, <directive
397 module="mod_autoindex">IndexIgnore</directive>, <directive
398 module="mod_autoindex">IndexOptions</directive>, <directive
399 module="mod_autoindex">ReadmeName</directive>,
405 Allow use of the directives controlling host access (<directive
406 module="mod_access_compat">Allow</directive>, <directive
407 module="mod_access_compat">Deny</directive> and <directive
408 module="mod_access_compat">Order</directive>).</dd>
410 <dt>Nonfatal=[Override|Unknown|All]</dt>
413 Allow use of AllowOverride option to treat syntax errors in
414 .htaccess as non-fatal: instead of causing an Internal Server
415 Error, disallowed or unrecognised directives will be ignored
416 and a warning logged:
418 <li><strong>Nonfatal=Override</strong> treats directives
419 forbidden by AllowOverride as non-fatal.</li>
420 <li><strong>Nonfatal=Unknown</strong> treats unknown directives
421 as non-fatal. This covers typos and directives implemented
422 by a module that's not present.</li>
423 <li><strong>Nonfatal=All</strong> treats both the above as non-fatal.</li>
425 <p>Note that a syntax error in a valid directive will still cause
426 an internal server error.</p>
427 <note type="warning"><title>Security</title>
428 Nonfatal errors may have security implications for .htaccess users.
429 For example, if AllowOverride disallows AuthConfig, users'
430 configuration designed to restrict access to a site will be disabled.
434 <dt>Options[=<var>Option</var>,...]</dt>
437 Allow use of the directives controlling specific directory
438 features (<directive module="core">Options</directive> and
439 <directive module="mod_include">XBitHack</directive>).
440 An equal sign may be given followed by a comma (but no spaces)
441 separated lists of options that may be set using the <directive
442 module="core">Options</directive> command.
444 <note><title>Implicit disabling of Options</title>
445 <p>Even though the list of options that may be used in .htaccess files
446 can be limited with this directive, as long as any <directive
447 module="core">Options</directive> directive is allowed any
448 other inherited option can be disabled by using the non-relative
449 syntax. In other words, this mechanism cannot force a specific option
450 to remain <em>set</em> while allowing any others to be set.
457 <highlight language="config">AllowOverride AuthConfig Indexes</highlight>
459 <p>In the example above all directives that are neither in the group
460 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
463 <note><p>For security and performance reasons, do not set
464 <code>AllowOverride</code> to anything other than <code>None</code>
465 in your <code><Directory /></code> block. Instead, find (or
466 create) the <code><Directory></code> block that refers to the
467 directory where you're actually planning to place a
468 <code>.htaccess</code> file.</p>
471 <seealso><directive module="core">AccessFileName</directive></seealso>
472 <seealso><directive module="core">AllowOverrideList</directive></seealso>
473 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
474 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
478 <name>AllowOverrideList</name>
479 <description>Individual directives that are allowed in
480 <code>.htaccess</code> files</description>
481 <syntax>AllowOverrideList None|<var>directive</var>
482 [<var>directive-type</var>] ...</syntax>
483 <default>AllowOverrideList None</default>
484 <contextlist><context>directory</context></contextlist>
487 <p>When the server finds an <code>.htaccess</code> file (as
488 specified by <directive module="core">AccessFileName</directive>)
489 it needs to know which directives declared in that file can override
490 earlier configuration directives.</p>
492 <note><title>Only available in <Directory> sections</title>
493 <directive>AllowOverrideList</directive> is valid only in
494 <directive type="section" module="core">Directory</directive>
495 sections specified without regular expressions, not in <directive
496 type="section" module="core">Location</directive>, <directive
497 module="core" type="section">DirectoryMatch</directive> or
498 <directive type="section" module="core">Files</directive> sections.
501 <p>When this directive is set to <code>None</code> and <directive
502 module="core">AllowOverride</directive> is set to <code>None</code>,
503 then <a href="#accessfilename">.htaccess</a> files are completely
504 ignored. In this case, the server will not even attempt to read
505 <code>.htaccess</code> files in the filesystem.</p>
509 <highlight language="config">
511 AllowOverrideList Redirect RedirectMatch
514 <p>In the example above only the <code>Redirect</code> and
515 <code>RedirectMatch</code> directives are allowed. All others will
516 cause an internal server error.</p>
520 <highlight language="config">
521 AllowOverride AuthConfig
522 AllowOverrideList CookieTracking CookieName
525 <p>In the example above <directive module="core">AllowOverride
526 </directive> grants permission to the <code>AuthConfig</code>
527 directive grouping and <directive>AllowOverrideList</directive> grants
528 permission to only two directves from the <code>FileInfo</code> directive
529 grouping. All others will cause an internal server error.</p>
532 <seealso><directive module="core">AccessFileName</directive></seealso>
533 <seealso><directive module="core">AllowOverride</directive></seealso>
534 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
535 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
539 <name>CGIMapExtension</name>
540 <description>Technique for locating the interpreter for CGI
541 scripts</description>
542 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
543 <contextlist><context>directory</context><context>.htaccess</context>
545 <override>FileInfo</override>
546 <compatibility>NetWare only</compatibility>
549 <p>This directive is used to control how Apache httpd finds the
550 interpreter used to run CGI scripts. For example, setting
551 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
552 cause all CGI script files with a <code>.foo</code> extension to
553 be passed to the FOO interpreter.</p>
558 <name>ContentDigest</name>
559 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
560 headers</description>
561 <syntax>ContentDigest On|Off</syntax>
562 <default>ContentDigest Off</default>
563 <contextlist><context>server config</context><context>virtual host</context>
564 <context>directory</context><context>.htaccess</context>
566 <override>Options</override>
567 <status>Experimental</status>
570 <p>This directive enables the generation of
571 <code>Content-MD5</code> headers as defined in RFC1864
572 respectively RFC2616.</p>
574 <p>MD5 is an algorithm for computing a "message digest"
575 (sometimes called "fingerprint") of arbitrary-length data, with
576 a high degree of confidence that any alterations in the data
577 will be reflected in alterations in the message digest.</p>
579 <p>The <code>Content-MD5</code> header provides an end-to-end
580 message integrity check (MIC) of the entity-body. A proxy or
581 client may check this header for detecting accidental
582 modification of the entity-body in transit. Example header:</p>
585 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
588 <p>Note that this can cause performance problems on your server
589 since the message digest is computed on every request (the
590 values are not cached).</p>
592 <p><code>Content-MD5</code> is only sent for documents served
593 by the <module>core</module>, and not by any module. For example,
594 SSI documents, output from CGI scripts, and byte range responses
595 do not have this header.</p>
600 <name>DefaultRuntimeDir</name>
601 <description>Base directory for the server run-time files</description>
602 <syntax>DefaultRuntimeDir <var>directory-path</var></syntax>
603 <default>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</default>
604 <contextlist><context>server config</context></contextlist>
607 <p>The <directive>DefaultRuntimeDir</directive> directive sets the
608 directory in which the server will create various run-time files
609 (shared memory, locks, etc.). If set as a relative path, the full path
610 will be relative to <directive>ServerRoot</directive></p>
612 <highlight language="config">
614 DefaultRuntimeDir scratch/
617 <p>The default location of <directive>DefaultRuntimeDir</directive> may be
618 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
621 <p>Note: <directive>ServerRoot</directive> should be specified before this
622 directive is used, otherwise the default value of <directive>ServerRoot</directive>
623 would be used to set the base directory.</p>
626 <seealso><a href="../misc/security_tips.html#serverroot">the
627 security tips</a> for information on how to properly set
628 permissions on the <directive>ServerRoot</directive></seealso>
632 <name>DefaultType</name>
633 <description>This directive has no effect other than to emit warnings
634 if the value is not <code>none</code>. In prior versions, DefaultType
635 would specify a default media type to assign to response content for
636 which no other media type configuration could be found.
638 <syntax>DefaultType <var>media-type|none</var></syntax>
639 <default>DefaultType none</default>
640 <contextlist><context>server config</context><context>virtual host</context>
641 <context>directory</context><context>.htaccess</context>
643 <override>FileInfo</override>
644 <compatibility>The argument <code>none</code> is available in Apache httpd 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.</compatibility>
647 <p>This directive has been disabled. For backwards compatibility
648 of configuration files, it may be specified with the value
649 <code>none</code>, meaning no default media type. For example:</p>
651 <highlight language="config">DefaultType None</highlight>
653 <p><code>DefaultType None</code> is only available in
654 httpd-2.2.7 and later.</p>
656 <p>Use the mime.types configuration file and the
657 <directive module="mod_mime">AddType</directive> to configure media
658 type assignments via file extensions, or the
659 <directive module="core">ForceType</directive> directive to configure
660 the media type for specific resources. Otherwise, the server will
661 send the response without a Content-Type header field and the
662 recipient may attempt to guess the media type.</p>
668 <description>Define a variable</description>
669 <syntax>Define <var>parameter-name</var> [<var>parameter-value</var>]</syntax>
670 <contextlist><context>server config</context><context>virtual host</context>
671 <context>directory</context></contextlist>
674 <p>In its one parameter form, <directive>Define</directive> is equivalent
675 to passing the <code>-D</code> argument to <program>httpd</program>. It
676 can be used to toggle the use of
677 <directive module="core" type="section">IfDefine</directive> sections
678 without needing to alter <code>-D</code> arguments in any startup
681 <p>In addition to that, if the second parameter is given, a config variable
682 is set to this value. The variable can be used in the configuration using
683 the <code>${VAR}</code> syntax. The variable is always globally defined
684 and not limited to the scope of the surrounding config section.</p>
686 <highlight language="config">
687 <IfDefine TEST>
688 Define servername test.example.com
690 <IfDefine !TEST>
691 Define servername www.example.com
696 <p>Variable names may not contain colon ":" characters, to avoid clashes
697 with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
701 <directivesynopsis type="section">
702 <name>Directory</name>
703 <description>Enclose a group of directives that apply only to the
704 named file-system directory, sub-directories, and their contents.</description>
705 <syntax><Directory <var>directory-path</var>>
706 ... </Directory></syntax>
707 <contextlist><context>server config</context><context>virtual host</context>
711 <p><directive type="section">Directory</directive> and
712 <code></Directory></code> are used to enclose a group of
713 directives that will apply only to the named directory,
714 sub-directories of that directory, and the files within the respective
715 directories. Any directive that is allowed
716 in a directory context may be used. <var>Directory-path</var> is
717 either the full path to a directory, or a wild-card string using
718 Unix shell-style matching. In a wild-card string, <code>?</code> matches
719 any single character, and <code>*</code> matches any sequences of
720 characters. You may also use <code>[]</code> character ranges. None
721 of the wildcards match a `/' character, so <code><Directory
722 /*/public_html></code> will not match
723 <code>/home/user/public_html</code>, but <code><Directory
724 /home/*/public_html></code> will match. Example:</p>
726 <highlight language="config">
727 <Directory "/usr/local/httpd/htdocs">
728 Options Indexes FollowSymLinks
733 <p>Be careful with the <var>directory-path</var> arguments:
734 They have to literally match the filesystem path which Apache httpd uses
735 to access the files. Directives applied to a particular
736 <code><Directory></code> will not apply to files accessed from
737 that same directory via a different path, such as via different symbolic
741 <p><glossary ref="regex">Regular
742 expressions</glossary> can also be used, with the addition of the
743 <code>~</code> character. For example:</p>
745 <highlight language="config">
746 <Directory ~ "^/www/.*/[0-9]{3}">
751 <p>would match directories in <code>/www/</code> that consisted of
754 <p>If multiple (non-regular expression) <directive
755 type="section">Directory</directive> sections
756 match the directory (or one of its parents) containing a document,
757 then the directives are applied in the order of shortest match
758 first, interspersed with the directives from the <a
759 href="#accessfilename">.htaccess</a> files. For example,
762 <highlight language="config">
767 <Directory "/home">
768 AllowOverride FileInfo
772 <p>for access to the document <code>/home/web/dir/doc.html</code>
776 <li>Apply directive <code>AllowOverride None</code>
777 (disabling <code>.htaccess</code> files).</li>
779 <li>Apply directive <code>AllowOverride FileInfo</code> (for
780 directory <code>/home</code>).</li>
782 <li>Apply any <code>FileInfo</code> directives in
783 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
784 <code>/home/web/dir/.htaccess</code> in that order.</li>
787 <p>Regular expressions are not considered until after all of the
788 normal sections have been applied. Then all of the regular
789 expressions are tested in the order they appeared in the
790 configuration file. For example, with</p>
792 <highlight language="config">
793 <Directory ~ "abc$">
794 # ... directives here ...
798 <p>the regular expression section won't be considered until after
799 all normal <directive type="section">Directory</directive>s and
800 <code>.htaccess</code> files have been applied. Then the regular
801 expression will match on <code>/home/abc/public_html/abc</code> and
802 the corresponding <directive type="section">Directory</directive> will
805 <p><strong>Note that the default access for
806 <code><Directory /></code> is to permit all access.
807 This means that Apache httpd will serve any file mapped from an URL. It is
808 recommended that you change this with a block such
811 <highlight language="config">
817 <p><strong>and then override this for directories you
818 <em>want</em> accessible. See the <a
819 href="../misc/security_tips.html">Security Tips</a> page for more
820 details.</strong></p>
822 <p>The directory sections occur in the <code>httpd.conf</code> file.
823 <directive type="section">Directory</directive> directives
824 cannot nest, and cannot appear in a <directive module="core"
825 type="section">Limit</directive> or <directive module="core"
826 type="section">LimitExcept</directive> section.</p>
828 <seealso><a href="../sections.html">How <Directory>,
829 <Location> and <Files> sections work</a> for an
830 explanation of how these different sections are combined when a
831 request is received</seealso>
834 <directivesynopsis type="section">
835 <name>DirectoryMatch</name>
836 <description>Enclose directives that apply to
837 the contents of file-system directories matching a regular expression.</description>
838 <syntax><DirectoryMatch <var>regex</var>>
839 ... </DirectoryMatch></syntax>
840 <contextlist><context>server config</context><context>virtual host</context>
844 <p><directive type="section">DirectoryMatch</directive> and
845 <code></DirectoryMatch></code> are used to enclose a group
846 of directives which will apply only to the named directory (and the files within),
847 the same as <directive module="core" type="section">Directory</directive>.
848 However, it takes as an argument a
849 <glossary ref="regex">regular expression</glossary>. For example:</p>
851 <highlight language="config">
852 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
854 </DirectoryMatch>
857 <p>would match directories in <code>/www/</code> that consisted of three
860 <note><title>Compatability</title>
861 Prior to 2.3.9, this directive implicitly applied to sub-directories
862 (like <directive module="core" type="section">Directory</directive>) and
863 could not match the end of line symbol ($). In 2.3.9 and later,
864 only directories that match the expression are affected by the enclosed
868 <note><title>Trailing Slash</title>
869 This directive applies to requests for directories that may or may
870 not end in a trailing slash, so expressions that are anchored to the
871 end of line ($) must be written with care.
874 <seealso><directive type="section" module="core">Directory</directive> for
875 a description of how regular expressions are mixed in with normal
876 <directive type="section">Directory</directive>s</seealso>
878 href="../sections.html">How <Directory>, <Location> and
879 <Files> sections work</a> for an explanation of how these different
880 sections are combined when a request is received</seealso>
884 <name>DocumentRoot</name>
885 <description>Directory that forms the main document tree visible
886 from the web</description>
887 <syntax>DocumentRoot <var>directory-path</var></syntax>
888 <default>DocumentRoot /usr/local/apache/htdocs</default>
889 <contextlist><context>server config</context><context>virtual host</context>
893 <p>This directive sets the directory from which <program>httpd</program>
894 will serve files. Unless matched by a directive like <directive
895 module="mod_alias">Alias</directive>, the server appends the
896 path from the requested URL to the document root to make the
897 path to the document. Example:</p>
899 <highlight language="config">DocumentRoot "/usr/web"</highlight>
902 <code>http://my.example.com/index.html</code> refers to
903 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
904 not absolute then it is assumed to be relative to the <directive
905 module="core">ServerRoot</directive>.</p>
907 <p>The <directive>DocumentRoot</directive> should be specified without
908 a trailing slash.</p>
910 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
911 Locations</a></seealso>
914 <directivesynopsis type="section">
916 <description>Contains directives that apply only if the condition of a
917 previous <directive type="section" module="core">If</directive> or
918 <directive type="section" module="core">ElseIf</directive> section is not
919 satisfied by a request at runtime</description>
920 <syntax><Else> ... </Else></syntax>
921 <contextlist><context>server config</context><context>virtual host</context>
922 <context>directory</context><context>.htaccess</context>
924 <override>All</override>
927 <p>The <directive type="section">Else</directive> applies the enclosed
928 directives if and only if the most recent
929 <directive type="section">If</directive> or
930 <directive type="section">ElseIf</directive> section
931 in the same scope has not been applied.
934 <highlight language="config">
935 <If "-z req('Host')">
943 <p> The <directive type="section">If</directive> would match HTTP/1.0
944 requests without a <var>Host:</var> header and the
945 <directive type="section">Else</directive> would match requests
946 with a <var>Host:</var> header.</p>
949 <seealso><directive type="section" module="core">If</directive></seealso>
950 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
951 <seealso><a href="../sections.html">How <Directory>, <Location>,
952 <Files> sections work</a> for an explanation of how these
953 different sections are combined when a request is received.
954 <directive type="section">If</directive>,
955 <directive type="section">ElseIf</directive>, and
956 <directive type="section">Else</directive> are applied last.</seealso>
959 <directivesynopsis type="section">
961 <description>Contains directives that apply only if a condition is satisfied
962 by a request at runtime while the condition of a previous
963 <directive type="section" module="core">If</directive> or
964 <directive type="section">ElseIf</directive> section is not
965 satisfied</description>
966 <syntax><ElseIf <var>expression</var>> ... </ElseIf></syntax>
967 <contextlist><context>server config</context><context>virtual host</context>
968 <context>directory</context><context>.htaccess</context>
970 <override>All</override>
973 <p>The <directive type="section">ElseIf</directive> applies the enclosed
974 directives if and only if both the given condition evaluates to true and
975 the most recent <directive type="section">If</directive> or
976 <directive type="section">ElseIf</directive> section in the same scope has
977 not been applied. For example: In </p>
979 <highlight language="config">
980 <If "-R '10.1.0.0/16'">
983 <ElseIf "-R '10.0.0.0/8'">
991 <p>The <directive type="section">ElseIf</directive> would match if
992 the remote address of a request belongs to the subnet 10.0.0.0/8 but
993 not to the subnet 10.1.0.0/16.</p>
996 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
997 for a complete reference and more examples.</seealso>
998 <seealso><directive type="section" module="core">If</directive></seealso>
999 <seealso><directive type="section" module="core">Else</directive></seealso>
1000 <seealso><a href="../sections.html">How <Directory>, <Location>,
1001 <Files> sections work</a> for an explanation of how these
1002 different sections are combined when a request is received.
1003 <directive type="section">If</directive>,
1004 <directive type="section">ElseIf</directive>, and
1005 <directive type="section">Else</directive> are applied last.</seealso>
1006 </directivesynopsis>
1011 <name>EnableMMAP</name>
1012 <description>Use memory-mapping to read files during delivery</description>
1013 <syntax>EnableMMAP On|Off</syntax>
1014 <default>EnableMMAP On</default>
1015 <contextlist><context>server config</context><context>virtual host</context>
1016 <context>directory</context><context>.htaccess</context>
1018 <override>FileInfo</override>
1021 <p>This directive controls whether the <program>httpd</program> may use
1022 memory-mapping if it needs to read the contents of a file during
1023 delivery. By default, when the handling of a request requires
1024 access to the data within a file -- for example, when delivering a
1025 server-parsed file using <module>mod_include</module> -- Apache httpd
1026 memory-maps the file if the OS supports it.</p>
1028 <p>This memory-mapping sometimes yields a performance improvement.
1029 But in some environments, it is better to disable the memory-mapping
1030 to prevent operational problems:</p>
1033 <li>On some multiprocessor systems, memory-mapping can reduce the
1034 performance of the <program>httpd</program>.</li>
1035 <li>Deleting or truncating a file while <program>httpd</program>
1036 has it memory-mapped can cause <program>httpd</program> to
1037 crash with a segmentation fault.
1041 <p>For server configurations that are vulnerable to these problems,
1042 you should disable memory-mapping of delivered files by specifying:</p>
1044 <highlight language="config">EnableMMAP Off</highlight>
1046 <p>For NFS mounted files, this feature may be disabled explicitly for
1047 the offending files by specifying:</p>
1049 <highlight language="config">
1050 <Directory "/path-to-nfs-files">
1055 </directivesynopsis>
1058 <name>EnableSendfile</name>
1059 <description>Use the kernel sendfile support to deliver files to the client</description>
1060 <syntax>EnableSendfile On|Off</syntax>
1061 <default>EnableSendfile Off</default>
1062 <contextlist><context>server config</context><context>virtual host</context>
1063 <context>directory</context><context>.htaccess</context>
1065 <override>FileInfo</override>
1066 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
1067 version 2.3.9.</compatibility>
1070 <p>This directive controls whether <program>httpd</program> may use the
1071 sendfile support from the kernel to transmit file contents to the client.
1072 By default, when the handling of a request requires no access
1073 to the data within a file -- for example, when delivering a
1074 static file -- Apache httpd uses sendfile to deliver the file contents
1075 without ever reading the file if the OS supports it.</p>
1077 <p>This sendfile mechanism avoids separate read and send operations,
1078 and buffer allocations. But on some platforms or within some
1079 filesystems, it is better to disable this feature to avoid
1080 operational problems:</p>
1083 <li>Some platforms may have broken sendfile support that the build
1084 system did not detect, especially if the binaries were built on
1085 another box and moved to such a machine with broken sendfile
1087 <li>On Linux the use of sendfile triggers TCP-checksum
1088 offloading bugs on certain networking cards when using IPv6.</li>
1089 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1090 files over 2GB in size.</li>
1091 <li>With a network-mounted <directive
1092 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
1093 the kernel may be unable to serve the network file through
1097 <p>For server configurations that are not vulnerable to these problems,
1098 you may enable this feature by specifying:</p>
1100 <highlight language="config">EnableSendfile On</highlight>
1102 <p>For network mounted files, this feature may be disabled explicitly
1103 for the offending files by specifying:</p>
1105 <highlight language="config">
1106 <Directory "/path-to-nfs-files">
1110 <p>Please note that the per-directory and .htaccess configuration
1111 of <directive>EnableSendfile</directive> is not supported by
1112 <module>mod_cache_disk</module>.
1113 Only global definition of <directive>EnableSendfile</directive>
1114 is taken into account by the module.
1117 </directivesynopsis>
1121 <description>Abort configuration parsing with a custom error message</description>
1122 <syntax>Error <var>message</var></syntax>
1123 <contextlist><context>server config</context><context>virtual host</context>
1124 <context>directory</context><context>.htaccess</context>
1126 <compatibility>2.3.9 and later</compatibility>
1129 <p>If an error can be detected within the configuration, this
1130 directive can be used to generate a custom error message, and halt
1131 configuration parsing. The typical use is for reporting required
1132 modules which are missing from the configuration.</p>
1134 <highlight language="config">
1136 # ensure that mod_include is loaded
1137 <IfModule !include_module>
1138 Error mod_include is required by mod_foo. Load it with LoadModule.
1141 # ensure that exactly one of SSL,NOSSL is defined
1142 <IfDefine SSL>
1143 <IfDefine NOSSL>
1144 Error Both SSL and NOSSL are defined. Define only one of them.
1147 <IfDefine !SSL>
1148 <IfDefine !NOSSL>
1149 Error Either SSL or NOSSL must be defined.
1155 </directivesynopsis>
1158 <name>ErrorDocument</name>
1159 <description>What the server will return to the client
1160 in case of an error</description>
1161 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
1162 <contextlist><context>server config</context><context>virtual host</context>
1163 <context>directory</context><context>.htaccess</context>
1165 <override>FileInfo</override>
1168 <p>In the event of a problem or error, Apache httpd can be configured
1169 to do one of four things,</p>
1172 <li>output a simple hardcoded error message</li>
1174 <li>output a customized message</li>
1176 <li>redirect to a local <var>URL-path</var> to handle the
1179 <li>redirect to an external <var>URL</var> to handle the
1183 <p>The first option is the default, while options 2-4 are
1184 configured using the <directive>ErrorDocument</directive>
1185 directive, which is followed by the HTTP response code and a URL
1186 or a message. Apache httpd will sometimes offer additional information
1187 regarding the problem/error.</p>
1189 <p>URLs can begin with a slash (/) for local web-paths (relative
1190 to the <directive module="core">DocumentRoot</directive>), or be a
1191 full URL which the client can resolve. Alternatively, a message
1192 can be provided to be displayed by the browser. Examples:</p>
1194 <highlight language="config">
1195 ErrorDocument 500 http://foo.example.com/cgi-bin/tester
1196 ErrorDocument 404 /cgi-bin/bad_urls.pl
1197 ErrorDocument 401 /subscription_info.html
1198 ErrorDocument 403 "Sorry can't allow you access today"
1199 ErrorDocument 403 Forbidden!
1202 <p>Additionally, the special value <code>default</code> can be used
1203 to specify Apache httpd's simple hardcoded message. While not required
1204 under normal circumstances, <code>default</code> will restore
1205 Apache httpd's simple hardcoded message for configurations that would
1206 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
1208 <highlight language="config">
1209 ErrorDocument 404 /cgi-bin/bad_urls.pl
1211 <Directory /web/docs>
1212 ErrorDocument 404 default
1216 <p>Note that when you specify an <directive>ErrorDocument</directive>
1217 that points to a remote URL (ie. anything with a method such as
1218 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1219 client to tell it where to find the document, even if the
1220 document ends up being on the same server. This has several
1221 implications, the most important being that the client will not
1222 receive the original error status code, but instead will
1223 receive a redirect status code. This in turn can confuse web
1224 robots and other clients which try to determine if a URL is
1225 valid using the status code. In addition, if you use a remote
1226 URL in an <code>ErrorDocument 401</code>, the client will not
1227 know to prompt the user for a password since it will not
1228 receive the 401 status code. Therefore, <strong>if you use an
1229 <code>ErrorDocument 401</code> directive then it must refer to a local
1230 document.</strong></p>
1232 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1233 server-generated error messages when they are "too small" and substitute
1234 its own "friendly" error messages. The size threshold varies depending on
1235 the type of error, but in general, if you make your error document
1236 greater than 512 bytes, then MSIE will show the server-generated
1237 error rather than masking it. More information is available in
1238 Microsoft Knowledge Base article <a
1239 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1242 <p>Although most error messages can be overriden, there are certain
1243 circumstances where the internal messages are used regardless of the
1244 setting of <directive module="core">ErrorDocument</directive>. In
1245 particular, if a malformed request is detected, normal request processing
1246 will be immediately halted and the internal error message returned.
1247 This is necessary to guard against security problems caused by
1250 <p>If you are using mod_proxy, you may wish to enable
1251 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1252 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1253 Apache httpd will not generate custom error documents for proxied content.</p>
1256 <seealso><a href="../custom-error.html">documentation of
1257 customizable responses</a></seealso>
1258 </directivesynopsis>
1261 <name>ErrorLog</name>
1262 <description>Location where the server will log errors</description>
1263 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1264 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1265 <contextlist><context>server config</context><context>virtual host</context>
1269 <p>The <directive>ErrorLog</directive> directive sets the name of
1270 the file to which the server will log any errors it encounters. If
1271 the <var>file-path</var> is not absolute then it is assumed to be
1272 relative to the <directive module="core">ServerRoot</directive>.</p>
1274 <highlight language="config">ErrorLog "/var/log/httpd/error_log"</highlight>
1276 <p>If the <var>file-path</var>
1277 begins with a pipe character "<code>|</code>" then it is assumed to be a
1278 command to spawn to handle the error log.</p>
1280 <highlight language="config">ErrorLog "|/usr/local/bin/httpd_errors"</highlight>
1282 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1283 more information.</p>
1285 <p>Using <code>syslog</code> instead of a filename enables logging
1286 via syslogd(8) if the system supports it. The default is to use
1287 syslog facility <code>local7</code>, but you can override this by
1288 using the <code>syslog:<var>facility</var></code> syntax where
1289 <var>facility</var> can be one of the names usually documented in
1290 syslog(1). The facility is effectively global, and if it is changed
1291 in individual virtual hosts, the final facility specified affects the
1294 <highlight language="config">ErrorLog syslog:user</highlight>
1296 <p>SECURITY: See the <a
1297 href="../misc/security_tips.html#serverroot">security tips</a>
1298 document for details on why your security could be compromised
1299 if the directory where log files are stored is writable by
1300 anyone other than the user that starts the server.</p>
1301 <note type="warning"><title>Note</title>
1302 <p>When entering a file path on non-Unix platforms, care should be taken
1303 to make sure that only forward slashes are used even though the platform
1304 may allow the use of back slashes. In general it is a good idea to always
1305 use forward slashes throughout the configuration files.</p>
1308 <seealso><directive module="core">LogLevel</directive></seealso>
1309 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1310 </directivesynopsis>
1313 <name>ErrorLogFormat</name>
1314 <description>Format specification for error log entries</description>
1315 <syntax> ErrorLogFormat [connection|request] <var>format</var></syntax>
1316 <contextlist><context>server config</context><context>virtual host</context>
1318 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1321 <p><directive>ErrorLogFormat</directive> allows to specify what
1322 supplementary information is logged in the error log in addition to the
1323 actual log message.</p>
1325 <highlight language="config">
1327 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1330 <p>Specifying <code>connection</code> or <code>request</code> as first
1331 parameter allows to specify additional formats, causing additional
1332 information to be logged when the first message is logged for a specific
1333 connection or request, respectively. This additional information is only
1334 logged once per connection/request. If a connection or request is processed
1335 without causing any log message, the additional information is not logged
1338 <p>It can happen that some format string items do not produce output. For
1339 example, the Referer header is only present if the log message is
1340 associated to a request and the log message happens at a time when the
1341 Referer header has already been read from the client. If no output is
1342 produced, the default behavior is to delete everything from the preceeding
1343 space character to the next space character. This means the log line is
1344 implicitly divided into fields on non-whitespace to whitespace transitions.
1345 If a format string item does not produce output, the whole field is
1346 ommitted. For example, if the remote address <code>%a</code> in the log
1347 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1348 brackets are not logged either. Space characters can be escaped with a
1349 backslash to prevent them from delimiting a field. The combination '% '
1350 (percent space) is a zero-witdh field delimiter that does not produce any
1353 <p>The above behavior can be changed by adding modifiers to the format
1354 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1355 respective item does not produce any output. In once-per-connection/request
1356 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1357 item with the plus modifier does not produce any output, the whole line is
1360 <p>A number as modifier can be used to assign a log severity level to a
1361 format item. The item will only be logged if the severity of the log
1362 message is not higher than the specified log severity level. The number can
1363 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1365 <p>For example, here's what would happen if you added modifiers to
1366 the <code>%{Referer}i</code> token, which logs the
1367 <code>Referer</code> request header.</p>
1369 <table border="1" style="zebra">
1370 <columnspec><column width=".3"/><column width=".7"/></columnspec>
1372 <tr><th>Modified Token</th><th>Meaning</th></tr>
1375 <td><code>%-{Referer}i</code></td>
1376 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1380 <td><code>%+{Referer}i</code></td>
1381 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1385 <td><code>%4{Referer}i</code></td>
1386 <td>Logs the <code>Referer</code> only if the log message severity
1387 is higher than 4.</td>
1392 <p>Some format string items accept additional parameters in braces.</p>
1394 <table border="1" style="zebra">
1395 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1397 <tr><th>Format String</th> <th>Description</th></tr>
1399 <tr><td><code>%%</code></td>
1400 <td>The percent sign</td></tr>
1402 <tr><td><code>%a</code></td>
1403 <td>Client IP address and port of the request</td></tr>
1405 <tr><td><code>%{c}a</code></td>
1406 <td>Underlying peer IP address and port of the connection (see the
1407 <module>mod_remoteip</module> module)</td></tr>
1409 <tr><td><code>%A</code></td>
1410 <td>Local IP-address and port</td></tr>
1412 <tr><td><code>%{<em>name</em>}e</code></td>
1413 <td>Request environment variable <em>name</em></td></tr>
1415 <tr><td><code>%E</code></td>
1416 <td>APR/OS error status code and string</td></tr>
1418 <tr><td><code>%F</code></td>
1419 <td>Source file name and line number of the log call</td></tr>
1421 <tr><td><code>%{<em>name</em>}i</code></td>
1422 <td>Request header <em>name</em></td></tr>
1424 <tr><td><code>%k</code></td>
1425 <td>Number of keep-alive requests on this connection</td></tr>
1427 <tr><td><code>%l</code></td>
1428 <td>Loglevel of the message</td></tr>
1430 <tr><td><code>%L</code></td>
1431 <td>Log ID of the request</td></tr>
1433 <tr><td><code>%{c}L</code></td>
1434 <td>Log ID of the connection</td></tr>
1436 <tr><td><code>%{C}L</code></td>
1437 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1439 <tr><td><code>%m</code></td>
1440 <td>Name of the module logging the message</td></tr>
1442 <tr><td><code>%M</code></td>
1443 <td>The actual log message</td></tr>
1445 <tr><td><code>%{<em>name</em>}n</code></td>
1446 <td>Request note <em>name</em></td></tr>
1448 <tr><td><code>%P</code></td>
1449 <td>Process ID of current process</td></tr>
1451 <tr><td><code>%T</code></td>
1452 <td>Thread ID of current thread</td></tr>
1454 <tr><td><code>%{g}T</code></td>
1455 <td>System unique thread ID of current thread (the same ID as
1456 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1458 <tr><td><code>%t</code></td>
1459 <td>The current time</td></tr>
1461 <tr><td><code>%{u}t</code></td>
1462 <td>The current time including micro-seconds</td></tr>
1464 <tr><td><code>%{cu}t</code></td>
1465 <td>The current time in compact ISO 8601 format, including
1466 micro-seconds</td></tr>
1468 <tr><td><code>%v</code></td>
1469 <td>The canonical <directive module="core">ServerName</directive>
1470 of the current server.</td></tr>
1472 <tr><td><code>%V</code></td>
1473 <td>The server name of the server serving the request according to the
1474 <directive module="core" >UseCanonicalName</directive>
1477 <tr><td><code>\ </code> (backslash space)</td>
1478 <td>Non-field delimiting space</td></tr>
1480 <tr><td><code>% </code> (percent space)</td>
1481 <td>Field delimiter (no output)</td></tr>
1484 <p>The log ID format <code>%L</code> produces a unique id for a connection
1485 or request. This can be used to correlate which log lines belong to the
1486 same connection or request, which request happens on which connection.
1487 A <code>%L</code> format string is also available in
1488 <module>mod_log_config</module>, to allow to correlate access log entries
1489 with error log lines. If <module>mod_unique_id</module> is loaded, its
1490 unique id will be used as log ID for requests.</p>
1492 <highlight language="config">
1493 #Example (default format)
1494 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1497 <p>This would result in error messages such as:</p>
1500 [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
1503 <p>Notice that, as discussed above, some fields are ommitted
1504 entirely because they are not defined.</p>
1506 <highlight language="config">
1507 #Example (similar to the 2.2.x format)
1508 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1511 <highlight language="config">
1512 #Advanced example with request/connection log IDs
1513 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1514 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1515 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1516 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1517 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"
1521 <seealso><directive module="core">ErrorLog</directive></seealso>
1522 <seealso><directive module="core">LogLevel</directive></seealso>
1523 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1524 </directivesynopsis>
1527 <name>ExtendedStatus</name>
1528 <description>Keep track of extended status information for each
1529 request</description>
1530 <syntax>ExtendedStatus On|Off</syntax>
1531 <default>ExtendedStatus Off[*]</default>
1532 <contextlist><context>server config</context></contextlist>
1535 <p>This option tracks additional data per worker about the
1536 currently executing request, and a utilization summary; you
1537 can see these variables during runtime by configuring
1538 <module>mod_status</module>. Note that other modules may
1539 rely on this scoreboard.</p>
1541 <p>This setting applies to the entire server, and cannot be
1542 enabled or disabled on a virtualhost-by-virtualhost basis.
1543 The collection of extended status information can slow down
1544 the server. Also note that this setting cannot be changed
1545 during a graceful restart.</p>
1548 <p>Note that loading <module>mod_status</module> will change
1549 the default behavior to ExtendedStatus On, while other
1550 third party modules may do the same. Such modules rely on
1551 collecting detailed information about the state of all workers.
1552 The default is changed by <module>mod_status</module> beginning
1553 with version 2.3.6; the previous default was always Off.</p>
1558 </directivesynopsis>
1561 <name>FileETag</name>
1562 <description>File attributes used to create the ETag
1563 HTTP response header for static files</description>
1564 <syntax>FileETag <var>component</var> ...</syntax>
1565 <default>FileETag MTime Size</default>
1566 <contextlist><context>server config</context><context>virtual host</context>
1567 <context>directory</context><context>.htaccess</context>
1569 <override>FileInfo</override>
1570 <compatibility>The default used to be "INode MTime Size" in 2.3.14 and
1571 earlier.</compatibility>
1575 The <directive>FileETag</directive> directive configures the file
1576 attributes that are used to create the <code>ETag</code> (entity
1577 tag) response header field when the document is based on a static file.
1578 (The <code>ETag</code> value is used in cache management to save
1579 network bandwidth.) The
1580 <directive>FileETag</directive> directive allows you to choose
1581 which of these -- if any -- should be used. The recognized keywords are:
1585 <dt><strong>INode</strong></dt>
1586 <dd>The file's i-node number will be included in the calculation</dd>
1587 <dt><strong>MTime</strong></dt>
1588 <dd>The date and time the file was last modified will be included</dd>
1589 <dt><strong>Size</strong></dt>
1590 <dd>The number of bytes in the file will be included</dd>
1591 <dt><strong>All</strong></dt>
1592 <dd>All available fields will be used. This is equivalent to:
1593 <highlight language="config">FileETag INode MTime Size</highlight></dd>
1594 <dt><strong>None</strong></dt>
1595 <dd>If a document is file-based, no <code>ETag</code> field will be
1596 included in the response</dd>
1599 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1600 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1601 which allow changes to be made to the default setting inherited
1602 from a broader scope. Any keyword appearing without such a prefix
1603 immediately and completely cancels the inherited setting.</p>
1605 <p>If a directory's configuration includes
1606 <code>FileETag INode MTime Size</code>, and a
1607 subdirectory's includes <code>FileETag -INode</code>,
1608 the setting for that subdirectory (which will be inherited by
1609 any sub-subdirectories that don't override it) will be equivalent to
1610 <code>FileETag MTime Size</code>.</p>
1611 <note type="warning"><title>Warning</title>
1612 Do not change the default for directories or locations that have WebDAV
1613 enabled and use <module>mod_dav_fs</module> as a storage provider.
1614 <module>mod_dav_fs</module> uses <code>MTime Size</code>
1615 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1616 These conditional requests will break if the <code>ETag</code> format is
1617 changed via <directive>FileETag</directive>.
1619 <note><title>Server Side Includes</title>
1620 An ETag is not generated for responses parsed by <module>mod_include</module>,
1621 since the response entity can change without a change of the INode, MTime, or Size
1622 of the static file with embedded SSI directives.
1626 </directivesynopsis>
1628 <directivesynopsis type="section">
1630 <description>Contains directives that apply to matched
1631 filenames</description>
1632 <syntax><Files <var>filename</var>> ... </Files></syntax>
1633 <contextlist><context>server config</context><context>virtual host</context>
1634 <context>directory</context><context>.htaccess</context>
1636 <override>All</override>
1639 <p>The <directive type="section">Files</directive> directive
1640 limits the scope of the enclosed directives by filename. It is comparable
1641 to the <directive module="core" type="section">Directory</directive>
1642 and <directive module="core" type="section">Location</directive>
1643 directives. It should be matched with a <code></Files></code>
1644 directive. The directives given within this section will be applied to
1645 any object with a basename (last component of filename) matching the
1646 specified filename. <directive type="section">Files</directive>
1647 sections are processed in the order they appear in the
1648 configuration file, after the <directive module="core"
1649 type="section">Directory</directive> sections and
1650 <code>.htaccess</code> files are read, but before <directive
1651 type="section" module="core">Location</directive> sections. Note
1652 that <directive type="section">Files</directive> can be nested
1653 inside <directive type="section"
1654 module="core">Directory</directive> sections to restrict the
1655 portion of the filesystem they apply to.</p>
1657 <p>The <var>filename</var> argument should include a filename, or
1658 a wild-card string, where <code>?</code> matches any single character,
1659 and <code>*</code> matches any sequences of characters.
1660 <glossary ref="regex">Regular expressions</glossary>
1661 can also be used, with the addition of the
1662 <code>~</code> character. For example:</p>
1664 <highlight language="config">
1665 <Files ~ "\.(gif|jpe?g|png)$">
1670 <p>would match most common Internet graphics formats. <directive
1671 module="core" type="section">FilesMatch</directive> is preferred,
1674 <p>Note that unlike <directive type="section"
1675 module="core">Directory</directive> and <directive type="section"
1676 module="core">Location</directive> sections, <directive
1677 type="section">Files</directive> sections can be used inside
1678 <code>.htaccess</code> files. This allows users to control access to
1679 their own files, at a file-by-file level.</p>
1682 <seealso><a href="../sections.html">How <Directory>, <Location>
1683 and <Files> sections work</a> for an explanation of how these
1684 different sections are combined when a request is received</seealso>
1685 </directivesynopsis>
1687 <directivesynopsis type="section">
1688 <name>FilesMatch</name>
1689 <description>Contains directives that apply to regular-expression matched
1690 filenames</description>
1691 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1692 <contextlist><context>server config</context><context>virtual host</context>
1693 <context>directory</context><context>.htaccess</context>
1695 <override>All</override>
1698 <p>The <directive type="section">FilesMatch</directive> directive
1699 limits the scope of the enclosed directives by filename, just as the
1700 <directive module="core" type="section">Files</directive> directive
1701 does. However, it accepts a <glossary ref="regex">regular
1702 expression</glossary>. For example:</p>
1704 <highlight language="config">
1705 <FilesMatch "\.(gif|jpe?g|png)$">
1710 <p>would match most common Internet graphics formats.</p>
1713 <seealso><a href="../sections.html">How <Directory>, <Location>
1714 and <Files> sections work</a> for an explanation of how these
1715 different sections are combined when a request is received</seealso>
1716 </directivesynopsis>
1719 <name>ForceType</name>
1720 <description>Forces all matching files to be served with the specified
1721 media type in the HTTP Content-Type header field</description>
1722 <syntax>ForceType <var>media-type</var>|None</syntax>
1723 <contextlist><context>directory</context><context>.htaccess</context>
1725 <override>FileInfo</override>
1726 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1729 <p>When placed into an <code>.htaccess</code> file or a
1730 <directive type="section" module="core">Directory</directive>, or
1731 <directive type="section" module="core">Location</directive> or
1732 <directive type="section" module="core">Files</directive>
1733 section, this directive forces all matching files to be served
1734 with the content type identification given by
1735 <var>media-type</var>. For example, if you had a directory full of
1736 GIF files, but did not want to label them all with <code>.gif</code>,
1737 you might want to use:</p>
1739 <highlight language="config">ForceType image/gif</highlight>
1741 <p>Note that this directive overrides other indirect media type
1742 associations defined in mime.types or via the
1743 <directive module="mod_mime">AddType</directive>.</p>
1745 <p>You can also override more general
1746 <directive>ForceType</directive> settings
1747 by using the value of <code>None</code>:</p>
1749 <highlight language="config">
1750 # force all files to be image/gif:
1751 <Location /images>
1755 # but normal mime-type associations here:
1756 <Location /images/mixed>
1761 <p>This directive primarily overrides the content types generated for
1762 static files served out of the filesystem. For resources other than
1763 static files, where the generator of the response typically specifies
1764 a Content-Type, this directive has no effect.</p>
1767 </directivesynopsis>
1769 <name>GprofDir</name>
1770 <description>Directory to write gmon.out profiling data to. </description>
1771 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1772 <contextlist><context>server config</context><context>virtual host</context>
1776 <p>When the server has been compiled with gprof profiling suppport,
1777 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1778 be written to the specified directory when the process exits. If the
1779 argument ends with a percent symbol ('%'), subdirectories are created
1780 for each process id.</p>
1782 <p>This directive currently only works with the <module>prefork</module>
1785 </directivesynopsis>
1788 <name>HostnameLookups</name>
1789 <description>Enables DNS lookups on client IP addresses</description>
1790 <syntax>HostnameLookups On|Off|Double</syntax>
1791 <default>HostnameLookups Off</default>
1792 <contextlist><context>server config</context><context>virtual host</context>
1793 <context>directory</context></contextlist>
1796 <p>This directive enables DNS lookups so that host names can be
1797 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1798 The value <code>Double</code> refers to doing double-reverse
1799 DNS lookup. That is, after a reverse lookup is performed, a forward
1800 lookup is then performed on that result. At least one of the IP
1801 addresses in the forward lookup must match the original
1802 address. (In "tcpwrappers" terminology this is called
1803 <code>PARANOID</code>.)</p>
1805 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1806 used for controlling access by hostname, a double reverse lookup
1807 will be performed. This is necessary for security. Note that the
1808 result of this double-reverse isn't generally available unless you
1809 set <code>HostnameLookups Double</code>. For example, if only
1810 <code>HostnameLookups On</code> and a request is made to an object
1811 that is protected by hostname restrictions, regardless of whether
1812 the double-reverse fails or not, CGIs will still be passed the
1813 single-reverse result in <code>REMOTE_HOST</code>.</p>
1815 <p>The default is <code>Off</code> in order to save the network
1816 traffic for those sites that don't truly need the reverse
1817 lookups done. It is also better for the end users because they
1818 don't have to suffer the extra latency that a lookup entails.
1819 Heavily loaded sites should leave this directive
1820 <code>Off</code>, since DNS lookups can take considerable
1821 amounts of time. The utility <program>logresolve</program>, compiled by
1822 default to the <code>bin</code> subdirectory of your installation
1823 directory, can be used to look up host names from logged IP addresses
1826 <p>Finally, if you have <a
1827 href="mod_authz_host.html#reqhost">hostname-based Require
1828 directives</a>, a hostname lookup will be performed regardless of
1829 the setting of <code>HostnameLookups</code>.</p>
1831 </directivesynopsis>
1833 <directivesynopsis type="section">
1835 <description>Contains directives that apply only if a condition is
1836 satisfied by a request at runtime</description>
1837 <syntax><If <var>expression</var>> ... </If></syntax>
1838 <contextlist><context>server config</context><context>virtual host</context>
1839 <context>directory</context><context>.htaccess</context>
1841 <override>All</override>
1844 <p>The <directive type="section">If</directive> directive
1845 evaluates an expression at runtime, and applies the enclosed
1846 directives if and only if the expression evaluates to true.
1849 <highlight language="config"><If "-z req('Host')"></highlight>
1851 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1852 Expressions may contain various shell-like operators for string
1853 comparison (<code>=</code>, <code>!=</code>, <code><</code>, ...),
1854 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1855 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1856 It is also possible to use regular expressions, </p>
1858 <highlight language="config"><If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"></highlight>
1860 <p>shell-like pattern matches and many other operations. These operations
1861 can be done on request headers (<code>req</code>), environment variables
1862 (<code>env</code>), and a large number of other properties. The full
1863 documentation is available in <a href="../expr.html">Expressions in
1864 Apache HTTP Server</a>.</p>
1868 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1869 for a complete reference and more examples.</seealso>
1870 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
1871 <seealso><directive type="section" module="core">Else</directive></seealso>
1872 <seealso><a href="../sections.html">How <Directory>, <Location>,
1873 <Files> sections work</a> for an explanation of how these
1874 different sections are combined when a request is received.
1875 <directive type="section">If</directive>,
1876 <directive type="section">ElseIf</directive>, and
1877 <directive type="section">Else</directive> are applied last.</seealso>
1878 </directivesynopsis>
1880 <directivesynopsis type="section">
1881 <name>IfDefine</name>
1882 <description>Encloses directives that will be processed only
1883 if a test is true at startup</description>
1884 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1885 </IfDefine></syntax>
1886 <contextlist><context>server config</context><context>virtual host</context>
1887 <context>directory</context><context>.htaccess</context>
1889 <override>All</override>
1892 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1893 </code> section is used to mark directives that are conditional. The
1894 directives within an <directive type="section">IfDefine</directive>
1895 section are only processed if the <var>test</var> is true. If <var>
1896 test</var> is false, everything between the start and end markers is
1899 <p>The <var>test</var> in the <directive type="section"
1900 >IfDefine</directive> section directive can be one of two forms:</p>
1903 <li><var>parameter-name</var></li>
1905 <li><code>!</code><var>parameter-name</var></li>
1908 <p>In the former case, the directives between the start and end
1909 markers are only processed if the parameter named
1910 <var>parameter-name</var> is defined. The second format reverses
1911 the test, and only processes the directives if
1912 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1914 <p>The <var>parameter-name</var> argument is a define as given on the
1915 <program>httpd</program> command line via <code>-D<var>parameter</var>
1916 </code> at the time the server was started or by the <directive
1917 module="core">Define</directive> directive.</p>
1919 <p><directive type="section">IfDefine</directive> sections are
1920 nest-able, which can be used to implement simple
1921 multiple-parameter tests. Example:</p>
1923 <example>httpd -DReverseProxy -DUseCache -DMemCache ...</example>
1924 <highlight language="config">
1925 <IfDefine ReverseProxy>
1926 LoadModule proxy_module modules/mod_proxy.so
1927 LoadModule proxy_http_module modules/mod_proxy_http.so
1928 <IfDefine UseCache>
1929 LoadModule cache_module modules/mod_cache.so
1930 <IfDefine MemCache>
1931 LoadModule mem_cache_module modules/mod_mem_cache.so
1933 <IfDefine !MemCache>
1934 LoadModule cache_disk_module modules/mod_cache_disk.so
1940 </directivesynopsis>
1942 <directivesynopsis type="section">
1943 <name>IfModule</name>
1944 <description>Encloses directives that are processed conditional on the
1945 presence or absence of a specific module</description>
1946 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1947 </IfModule></syntax>
1948 <contextlist><context>server config</context><context>virtual host</context>
1949 <context>directory</context><context>.htaccess</context>
1951 <override>All</override>
1952 <compatibility>Module identifiers are available in version 2.1 and
1953 later.</compatibility>
1956 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1957 section is used to mark directives that are conditional on the presence of
1958 a specific module. The directives within an <directive type="section"
1959 >IfModule</directive> section are only processed if the <var>test</var>
1960 is true. If <var>test</var> is false, everything between the start and
1961 end markers is ignored.</p>
1963 <p>The <var>test</var> in the <directive type="section"
1964 >IfModule</directive> section directive can be one of two forms:</p>
1967 <li><var>module</var></li>
1969 <li>!<var>module</var></li>
1972 <p>In the former case, the directives between the start and end
1973 markers are only processed if the module named <var>module</var>
1974 is included in Apache httpd -- either compiled in or
1975 dynamically loaded using <directive module="mod_so"
1976 >LoadModule</directive>. The second format reverses the test,
1977 and only processes the directives if <var>module</var> is
1978 <strong>not</strong> included.</p>
1980 <p>The <var>module</var> argument can be either the module identifier or
1981 the file name of the module, at the time it was compiled. For example,
1982 <code>rewrite_module</code> is the identifier and
1983 <code>mod_rewrite.c</code> is the file name. If a module consists of
1984 several source files, use the name of the file containing the string
1985 <code>STANDARD20_MODULE_STUFF</code>.</p>
1987 <p><directive type="section">IfModule</directive> sections are
1988 nest-able, which can be used to implement simple multiple-module
1991 <note>This section should only be used if you need to have one
1992 configuration file that works whether or not a specific module
1993 is available. In normal operation, directives need not be
1994 placed in <directive type="section">IfModule</directive>
1997 </directivesynopsis>
2000 <name>Include</name>
2001 <description>Includes other configuration files from within
2002 the server configuration files</description>
2003 <syntax>Include <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2004 <contextlist><context>server config</context><context>virtual host</context>
2005 <context>directory</context>
2007 <compatibility>Wildcard matching available in 2.0.41 and later, directory
2008 wildcard matching available in 2.3.6 and later</compatibility>
2011 <p>This directive allows inclusion of other configuration files
2012 from within the server configuration files.</p>
2014 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2015 in the filename or directory parts of the path to include several files
2016 at once, in alphabetical order. In addition, if
2017 <directive>Include</directive> points to a directory, rather than a file,
2018 Apache httpd will read all files in that directory and any subdirectory.
2019 However, including entire directories is not recommended, because it is
2020 easy to accidentally leave temporary files in a directory that can cause
2021 <program>httpd</program> to fail. Instead, we encourage you to use the
2022 wildcard syntax shown below, to include files that match a particular
2023 pattern, such as *.conf, for example.</p>
2025 <p>The <directive module="core">Include</directive> directive will
2026 <strong>fail with an error</strong> if a wildcard expression does not
2027 match any file. The <directive module="core">IncludeOptional</directive>
2028 directive can be used if non-matching wildcards should be ignored.</p>
2030 <p>The file path specified may be an absolute path, or may be relative
2031 to the <directive module="core">ServerRoot</directive> directory.</p>
2035 <highlight language="config">
2036 Include /usr/local/apache2/conf/ssl.conf
2037 Include /usr/local/apache2/conf/vhosts/*.conf
2040 <p>Or, providing paths relative to your <directive
2041 module="core">ServerRoot</directive> directory:</p>
2043 <highlight language="config">
2044 Include conf/ssl.conf
2045 Include conf/vhosts/*.conf
2048 <p>Wildcards may be included in the directory or file portion of the
2049 path. This example will fail if there is no subdirectory in conf/vhosts
2050 that contains at least one *.conf file:</p>
2052 <highlight language="config">Include conf/vhosts/*/*.conf</highlight>
2054 <p>Alternatively, the following command will just be ignored in case of
2055 missing files or directories:</p>
2057 <highlight language="config">IncludeOptional conf/vhosts/*/*.conf</highlight>
2061 <seealso><directive module="core">IncludeOptional</directive></seealso>
2062 <seealso><program>apachectl</program></seealso>
2063 </directivesynopsis>
2066 <name>IncludeOptional</name>
2067 <description>Includes other configuration files from within
2068 the server configuration files</description>
2069 <syntax>IncludeOptional <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2070 <contextlist><context>server config</context><context>virtual host</context>
2071 <context>directory</context>
2073 <compatibility>Available in 2.3.6 and later</compatibility>
2076 <p>This directive allows inclusion of other configuration files
2077 from within the server configuration files. It works identically to the
2078 <directive module="core">Include</directive> directive, with the
2079 exception that if wildcards do not match any file or directory, the
2080 <directive module="core">IncludeOptional</directive> directive will be
2081 silently ignored instead of causing an error.</p>
2084 <seealso><directive module="core">Include</directive></seealso>
2085 <seealso><program>apachectl</program></seealso>
2086 </directivesynopsis>
2089 <name>KeepAlive</name>
2090 <description>Enables HTTP persistent connections</description>
2091 <syntax>KeepAlive On|Off</syntax>
2092 <default>KeepAlive On</default>
2093 <contextlist><context>server config</context><context>virtual host</context>
2097 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2098 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2099 which allow multiple requests to be sent over the same TCP
2100 connection. In some cases this has been shown to result in an
2101 almost 50% speedup in latency times for HTML documents with
2102 many images. To enable Keep-Alive connections, set
2103 <code>KeepAlive On</code>.</p>
2105 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2106 used if they are specifically requested by a client. In
2107 addition, a Keep-Alive connection with an HTTP/1.0 client can
2108 only be used when the length of the content is known in
2109 advance. This implies that dynamic content such as CGI output,
2110 SSI pages, and server-generated directory listings will
2111 generally not use Keep-Alive connections to HTTP/1.0 clients.
2112 For HTTP/1.1 clients, persistent connections are the default
2113 unless otherwise specified. If the client requests it, chunked
2114 encoding will be used in order to send content of unknown
2115 length over persistent connections.</p>
2117 <p>When a client uses a Keep-Alive connection it will be counted
2118 as a single "request" for the <directive module="mpm_common"
2119 >MaxConnectionsPerChild</directive> directive, regardless
2120 of how many requests are sent using the connection.</p>
2123 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
2124 </directivesynopsis>
2127 <name>KeepAliveTimeout</name>
2128 <description>Amount of time the server will wait for subsequent
2129 requests on a persistent connection</description>
2130 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
2131 <default>KeepAliveTimeout 5</default>
2132 <contextlist><context>server config</context><context>virtual host</context>
2134 <compatibility>Specifying a value in milliseconds is available in
2135 Apache httpd 2.3.2 and later</compatibility>
2138 <p>The number of seconds Apache httpd will wait for a subsequent
2139 request before closing the connection. By adding a postfix of ms the
2140 timeout can be also set in milliseconds. Once a request has been
2141 received, the timeout value specified by the
2142 <directive module="core">Timeout</directive> directive applies.</p>
2144 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
2145 may cause performance problems in heavily loaded servers. The
2146 higher the timeout, the more server processes will be kept
2147 occupied waiting on connections with idle clients.</p>
2149 <p>In a name-based virtual host context, the value of the first
2150 defined virtual host best matching the local IP and port will be used.</p>
2152 </directivesynopsis>
2154 <directivesynopsis type="section">
2156 <description>Restrict enclosed access controls to only certain HTTP
2157 methods</description>
2158 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
2159 </Limit></syntax>
2160 <contextlist><context>directory</context><context>.htaccess</context>
2162 <override>AuthConfig, Limit</override>
2165 <p>Access controls are normally effective for
2166 <strong>all</strong> access methods, and this is the usual
2167 desired behavior. <strong>In the general case, access control
2168 directives should not be placed within a
2169 <directive type="section">Limit</directive> section.</strong></p>
2171 <p>The purpose of the <directive type="section">Limit</directive>
2172 directive is to restrict the effect of the access controls to the
2173 nominated HTTP methods. For all other methods, the access
2174 restrictions that are enclosed in the <directive
2175 type="section">Limit</directive> bracket <strong>will have no
2176 effect</strong>. The following example applies the access control
2177 only to the methods <code>POST</code>, <code>PUT</code>, and
2178 <code>DELETE</code>, leaving all other methods unprotected:</p>
2180 <highlight language="config">
2181 <Limit POST PUT DELETE>
2186 <p>The method names listed can be one or more of: <code>GET</code>,
2187 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2188 <code>CONNECT</code>, <code>OPTIONS</code>,
2189 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2190 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2191 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2192 case-sensitive.</strong> If <code>GET</code> is used it will also
2193 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2194 cannot be limited (see <directive module="core"
2195 >TraceEnable</directive>).</p>
2197 <note type="warning">A <directive type="section"
2198 module="core">LimitExcept</directive> section should always be
2199 used in preference to a <directive type="section">Limit</directive>
2200 section when restricting access, since a <directive type="section"
2201 module="core">LimitExcept</directive> section provides protection
2202 against arbitrary methods.</note>
2204 <p>The <directive type="section">Limit</directive> and
2205 <directive type="section" module="core">LimitExcept</directive>
2206 directives may be nested. In this case, each successive level of
2207 <directive type="section">Limit</directive> or <directive
2208 type="section" module="core">LimitExcept</directive> directives must
2209 further restrict the set of methods to which access controls apply.</p>
2211 <note type="warning">When using
2212 <directive type="section">Limit</directive> or
2213 <directive type="section">LimitExcept</directive> directives with
2214 the <directive module="mod_authz_core">Require</directive> directive,
2215 note that the first <directive module="mod_authz_core">Require</directive>
2216 to succeed authorizes the request, regardless of the presence of other
2217 <directive module="mod_authz_core">Require</directive> directives.</note>
2219 <p>For example, given the following configuration, all users will
2220 be authorized for <code>POST</code> requests, and the
2221 <code>Require group editors</code> directive will be ignored
2224 <highlight language="config">
2225 <LimitExcept GET>
2227 </LimitExcept>
2229 Require group editors
2233 </directivesynopsis>
2235 <directivesynopsis type="section">
2236 <name>LimitExcept</name>
2237 <description>Restrict access controls to all HTTP methods
2238 except the named ones</description>
2239 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2240 </LimitExcept></syntax>
2241 <contextlist><context>directory</context><context>.htaccess</context>
2243 <override>AuthConfig, Limit</override>
2246 <p><directive type="section">LimitExcept</directive> and
2247 <code></LimitExcept></code> are used to enclose
2248 a group of access control directives which will then apply to any
2249 HTTP access method <strong>not</strong> listed in the arguments;
2250 i.e., it is the opposite of a <directive type="section"
2251 module="core">Limit</directive> section and can be used to control
2252 both standard and nonstandard/unrecognized methods. See the
2253 documentation for <directive module="core"
2254 type="section">Limit</directive> for more details.</p>
2258 <highlight language="config">
2259 <LimitExcept POST GET>
2261 </LimitExcept>
2265 </directivesynopsis>
2268 <name>LimitInternalRecursion</name>
2269 <description>Determine maximum number of internal redirects and nested
2270 subrequests</description>
2271 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2272 <default>LimitInternalRecursion 10</default>
2273 <contextlist><context>server config</context><context>virtual host</context>
2275 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
2278 <p>An internal redirect happens, for example, when using the <directive
2279 module="mod_actions">Action</directive> directive, which internally
2280 redirects the original request to a CGI script. A subrequest is Apache httpd's
2281 mechanism to find out what would happen for some URI if it were requested.
2282 For example, <module>mod_dir</module> uses subrequests to look for the
2283 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2286 <p><directive>LimitInternalRecursion</directive> prevents the server
2287 from crashing when entering an infinite loop of internal redirects or
2288 subrequests. Such loops are usually caused by misconfigurations.</p>
2290 <p>The directive stores two different limits, which are evaluated on
2291 per-request basis. The first <var>number</var> is the maximum number of
2292 internal redirects, that may follow each other. The second <var>number</var>
2293 determines, how deep subrequests may be nested. If you specify only one
2294 <var>number</var>, it will be assigned to both limits.</p>
2296 <highlight language="config">LimitInternalRecursion 5</highlight>
2298 </directivesynopsis>
2301 <name>LimitRequestBody</name>
2302 <description>Restricts the total size of the HTTP request body sent
2303 from the client</description>
2304 <syntax>LimitRequestBody <var>bytes</var></syntax>
2305 <default>LimitRequestBody 0</default>
2306 <contextlist><context>server config</context><context>virtual host</context>
2307 <context>directory</context><context>.htaccess</context>
2309 <override>All</override>
2312 <p>This directive specifies the number of <var>bytes</var> from 0
2313 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2314 request body. See the note below for the limited applicability
2315 to proxy requests.</p>
2317 <p>The <directive>LimitRequestBody</directive> directive allows
2318 the user to set a limit on the allowed size of an HTTP request
2319 message body within the context in which the directive is given
2320 (server, per-directory, per-file or per-location). If the client
2321 request exceeds that limit, the server will return an error
2322 response instead of servicing the request. The size of a normal
2323 request message body will vary greatly depending on the nature of
2324 the resource and the methods allowed on that resource. CGI scripts
2325 typically use the message body for retrieving form information.
2326 Implementations of the <code>PUT</code> method will require
2327 a value at least as large as any representation that the server
2328 wishes to accept for that resource.</p>
2330 <p>This directive gives the server administrator greater
2331 control over abnormal client request behavior, which may be
2332 useful for avoiding some forms of denial-of-service
2335 <p>If, for example, you are permitting file upload to a particular
2336 location, and wish to limit the size of the uploaded file to 100K,
2337 you might use the following directive:</p>
2339 <highlight language="config">LimitRequestBody 102400</highlight>
2341 <note><p>For a full description of how this directive is interpreted by
2342 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2346 </directivesynopsis>
2349 <name>LimitRequestFields</name>
2350 <description>Limits the number of HTTP request header fields that
2351 will be accepted from the client</description>
2352 <syntax>LimitRequestFields <var>number</var></syntax>
2353 <default>LimitRequestFields 100</default>
2354 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2357 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2358 32767. The default value is defined by the compile-time
2359 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2362 <p>The <directive>LimitRequestFields</directive> directive allows
2363 the server administrator to modify the limit on the number of
2364 request header fields allowed in an HTTP request. A server needs
2365 this value to be larger than the number of fields that a normal
2366 client request might include. The number of request header fields
2367 used by a client rarely exceeds 20, but this may vary among
2368 different client implementations, often depending upon the extent
2369 to which a user has configured their browser to support detailed
2370 content negotiation. Optional HTTP extensions are often expressed
2371 using request header fields.</p>
2373 <p>This directive gives the server administrator greater
2374 control over abnormal client request behavior, which may be
2375 useful for avoiding some forms of denial-of-service attacks.
2376 The value should be increased if normal clients see an error
2377 response from the server that indicates too many fields were
2378 sent in the request.</p>
2382 <highlight language="config">LimitRequestFields 50</highlight>
2384 <note type="warning"><title>Warning</title>
2385 <p> When name-based virtual hosting is used, the value for this
2386 directive is taken from the default (first-listed) virtual host for the
2387 local IP and port combination</p>.
2391 </directivesynopsis>
2394 <name>LimitRequestFieldSize</name>
2395 <description>Limits the size of the HTTP request header allowed from the
2396 client</description>
2397 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2398 <default>LimitRequestFieldSize 8190</default>
2399 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2402 <p>This directive specifies the number of <var>bytes</var>
2403 that will be allowed in an HTTP request header.</p>
2405 <p>The <directive>LimitRequestFieldSize</directive> directive
2406 allows the server administrator to set the limit
2407 on the allowed size of an HTTP request header field. A server
2408 needs this value to be large enough to hold any one header field
2409 from a normal client request. The size of a normal request header
2410 field will vary greatly among different client implementations,
2411 often depending upon the extent to which a user has configured
2412 their browser to support detailed content negotiation. SPNEGO
2413 authentication headers can be up to 12392 bytes.</p>
2415 <p>This directive gives the server administrator greater
2416 control over abnormal client request behavior, which may be
2417 useful for avoiding some forms of denial-of-service attacks.</p>
2421 <highlight language="config">LimitRequestFieldSize 4094</highlight>
2423 <note>Under normal conditions, the value should not be changed from
2424 the default. Also, you can't set this higher than 8190 without
2425 modifying the source code and rebuilding.</note>
2427 <note type="warning"><title>Warning</title>
2428 <p> When name-based virtual hosting is used, the value for this
2429 directive is taken from the default (first-listed) virtual host best
2430 matching the current IP address and port combination.</p>
2433 </directivesynopsis>
2436 <name>LimitRequestLine</name>
2437 <description>Limit the size of the HTTP request line that will be accepted
2438 from the client</description>
2439 <syntax>LimitRequestLine <var>bytes</var></syntax>
2440 <default>LimitRequestLine 8190</default>
2441 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2444 <p>This directive sets the number of <var>bytes</var> that will be
2445 allowed on the HTTP request-line.</p>
2447 <p>The <directive>LimitRequestLine</directive> directive allows
2448 the server administrator to set the limit on the allowed size
2449 of a client's HTTP request-line. Since the request-line consists of the
2450 HTTP method, URI, and protocol version, the
2451 <directive>LimitRequestLine</directive> directive places a
2452 restriction on the length of a request-URI allowed for a request
2453 on the server. A server needs this value to be large enough to
2454 hold any of its resource names, including any information that
2455 might be passed in the query part of a <code>GET</code> request.</p>
2457 <p>This directive gives the server administrator greater
2458 control over abnormal client request behavior, which may be
2459 useful for avoiding some forms of denial-of-service attacks.</p>
2463 <highlight language="config">LimitRequestLine 4094</highlight>
2465 <note>Under normal conditions, the value should not be changed from
2466 the default. Also, you can't set this higher than 8190 without
2467 modifying the source and rebuilding.</note>
2469 <note type="warning"><title>Warning</title>
2470 <p> When name-based virtual hosting is used, the value for this
2471 directive is taken from the default (first-listed) virtual host best
2472 matching the current IP address and port combination.</p>
2476 </directivesynopsis>
2479 <name>LimitXMLRequestBody</name>
2480 <description>Limits the size of an XML-based request body</description>
2481 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2482 <default>LimitXMLRequestBody 1000000</default>
2483 <contextlist><context>server config</context><context>virtual host</context>
2484 <context>directory</context><context>.htaccess</context></contextlist>
2485 <override>All</override>
2488 <p>Limit (in bytes) on maximum size of an XML-based request
2489 body. A value of <code>0</code> will disable any checking.</p>
2493 <highlight language="config">LimitXMLRequestBody 0</highlight>
2496 </directivesynopsis>
2498 <directivesynopsis type="section">
2499 <name>Location</name>
2500 <description>Applies the enclosed directives only to matching
2502 <syntax><Location
2503 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2504 <contextlist><context>server config</context><context>virtual host</context>
2508 <p>The <directive type="section">Location</directive> directive
2509 limits the scope of the enclosed directives by URL. It is similar to the
2510 <directive type="section" module="core">Directory</directive>
2511 directive, and starts a subsection which is terminated with a
2512 <code></Location></code> directive. <directive
2513 type="section">Location</directive> sections are processed in the
2514 order they appear in the configuration file, after the <directive
2515 type="section" module="core">Directory</directive> sections and
2516 <code>.htaccess</code> files are read, and after the <directive
2517 type="section" module="core">Files</directive> sections.</p>
2519 <p><directive type="section">Location</directive> sections operate
2520 completely outside the filesystem. This has several consequences.
2521 Most importantly, <directive type="section">Location</directive>
2522 directives should not be used to control access to filesystem
2523 locations. Since several different URLs may map to the same
2524 filesystem location, such access controls may by circumvented.</p>
2526 <p>The enclosed directives will be applied to the request if the path component
2527 of the URL meets <em>any</em> of the following criteria:
2530 <li>The specified location matches exactly the path component of the URL.
2532 <li>The specified location, which ends in a forward slash, is a prefix
2533 of the path component of the URL (treated as a context root).
2535 <li>The specified location, with the addition of a trailing slash, is a
2536 prefix of the path component of the URL (also treated as a context root).
2540 In the example below, where no trailing slash is used, requests to
2541 /private1, /private1/ and /private1/file.txt will have the enclosed
2542 directives applied, but /private1other would not.
2544 <highlight language="config">
2545 <Location /private1>
2550 In the example below, where a trailing slash is used, requests to
2551 /private2/ and /private2/file.txt will have the enclosed
2552 directives applied, but /private2 and /private2other would not.
2554 <highlight language="config">
2555 <Location /private2<em>/</em>>
2560 <note><title>When to use <directive
2561 type="section">Location</directive></title>
2563 <p>Use <directive type="section">Location</directive> to apply
2564 directives to content that lives outside the filesystem. For
2565 content that lives in the filesystem, use <directive
2566 type="section" module="core">Directory</directive> and <directive
2567 type="section" module="core">Files</directive>. An exception is
2568 <code><Location /></code>, which is an easy way to
2569 apply a configuration to the entire server.</p>
2572 <p>For all origin (non-proxy) requests, the URL to be matched is a
2573 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2574 port, or query string may be included.</em> For proxy requests, the
2575 URL to be matched is of the form
2576 <code>scheme://servername/path</code>, and you must include the
2579 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2580 any single character, and <code>*</code> matches any sequences of
2581 characters. Neither wildcard character matches a / in the URL-path.</p>
2583 <p><glossary ref="regex">Regular expressions</glossary>
2584 can also be used, with the addition of the <code>~</code>
2585 character. For example:</p>
2587 <highlight language="config">
2588 <Location ~ "/(extra|special)/data">
2593 <p>would match URLs that contained the substring <code>/extra/data</code>
2594 or <code>/special/data</code>. The directive <directive
2595 type="section" module="core">LocationMatch</directive> behaves
2596 identical to the regex version of <directive
2597 type="section">Location</directive>, and is preferred, for the
2598 simple reason that <code>~</code> is hard to distinguish from
2599 <code>-</code> in many fonts.</p>
2601 <p>The <directive type="section">Location</directive>
2602 functionality is especially useful when combined with the
2603 <directive module="core">SetHandler</directive>
2604 directive. For example, to enable status requests, but allow them
2605 only from browsers at <code>example.com</code>, you might use:</p>
2607 <highlight language="config">
2608 <Location /status>
2609 SetHandler server-status
2610 Require host example.com
2614 <note><title>Note about / (slash)</title>
2615 <p>The slash character has special meaning depending on where in a
2616 URL it appears. People may be used to its behavior in the filesystem
2617 where multiple adjacent slashes are frequently collapsed to a single
2618 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2619 <code>/home/foo</code>). In URL-space this is not necessarily true.
2620 The <directive type="section" module="core">LocationMatch</directive>
2621 directive and the regex version of <directive type="section"
2622 >Location</directive> require you to explicitly specify multiple
2623 slashes if that is your intention.</p>
2625 <p>For example, <code><LocationMatch ^/abc></code> would match
2626 the request URL <code>/abc</code> but not the request URL <code>
2627 //abc</code>. The (non-regex) <directive type="section"
2628 >Location</directive> directive behaves similarly when used for
2629 proxy requests. But when (non-regex) <directive type="section"
2630 >Location</directive> is used for non-proxy requests it will
2631 implicitly match multiple slashes with a single slash. For example,
2632 if you specify <code><Location /abc/def></code> and the
2633 request is to <code>/abc//def</code> then it will match.</p>
2636 <seealso><a href="../sections.html">How <Directory>, <Location>
2637 and <Files> sections work</a> for an explanation of how these
2638 different sections are combined when a request is received.</seealso>
2639 <seealso><directive module="core">LocationMatch</directive></seealso>
2640 </directivesynopsis>
2642 <directivesynopsis type="section">
2643 <name>LocationMatch</name>
2644 <description>Applies the enclosed directives only to regular-expression
2645 matching URLs</description>
2646 <syntax><LocationMatch
2647 <var>regex</var>> ... </LocationMatch></syntax>
2648 <contextlist><context>server config</context><context>virtual host</context>
2652 <p>The <directive type="section">LocationMatch</directive> directive
2653 limits the scope of the enclosed directives by URL, in an identical manner
2654 to <directive module="core" type="section">Location</directive>. However,
2655 it takes a <glossary ref="regex">regular expression</glossary>
2656 as an argument instead of a simple string. For example:</p>
2658 <highlight language="config">
2659 <LocationMatch "/(extra|special)/data">
2661 </LocationMatch>
2664 <p>would match URLs that contained the substring <code>/extra/data</code>
2665 or <code>/special/data</code>.</p>
2668 <seealso><a href="../sections.html">How <Directory>, <Location>
2669 and <Files> sections work</a> for an explanation of how these
2670 different sections are combined when a request is received</seealso>
2671 </directivesynopsis>
2674 <name>LogLevel</name>
2675 <description>Controls the verbosity of the ErrorLog</description>
2676 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2677 [<var>module</var>:<var>level</var>] ...
2679 <default>LogLevel warn</default>
2680 <contextlist><context>server config</context><context>virtual host</context>
2681 <context>directory</context>
2683 <compatibility>Per-module and per-directory configuration is available in
2684 Apache HTTP Server 2.3.6 and later</compatibility>
2687 <p><directive>LogLevel</directive> adjusts the verbosity of the
2688 messages recorded in the error logs (see <directive
2689 module="core">ErrorLog</directive> directive). The following
2690 <var>level</var>s are available, in order of decreasing
2694 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2697 <th><strong>Level</strong> </th>
2699 <th><strong>Description</strong> </th>
2701 <th><strong>Example</strong> </th>
2705 <td><code>emerg</code> </td>
2707 <td>Emergencies - system is unusable.</td>
2709 <td>"Child cannot open lock file. Exiting"</td>
2713 <td><code>alert</code> </td>
2715 <td>Action must be taken immediately.</td>
2717 <td>"getpwuid: couldn't determine user name from uid"</td>
2721 <td><code>crit</code> </td>
2723 <td>Critical Conditions.</td>
2725 <td>"socket: Failed to get a socket, exiting child"</td>
2729 <td><code>error</code> </td>
2731 <td>Error conditions.</td>
2733 <td>"Premature end of script headers"</td>
2737 <td><code>warn</code> </td>
2739 <td>Warning conditions.</td>
2741 <td>"child process 1234 did not exit, sending another
2746 <td><code>notice</code> </td>
2748 <td>Normal but significant condition.</td>
2750 <td>"httpd: caught SIGBUS, attempting to dump core in
2755 <td><code>info</code> </td>
2757 <td>Informational.</td>
2759 <td>"Server seems busy, (you may need to increase
2760 StartServers, or Min/MaxSpareServers)..."</td>
2764 <td><code>debug</code> </td>
2766 <td>Debug-level messages</td>
2768 <td>"Opening config file ..."</td>
2771 <td><code>trace1</code> </td>
2773 <td>Trace messages</td>
2775 <td>"proxy: FTP: control connection complete"</td>
2778 <td><code>trace2</code> </td>
2780 <td>Trace messages</td>
2782 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2785 <td><code>trace3</code> </td>
2787 <td>Trace messages</td>
2789 <td>"openssl: Handshake: start"</td>
2792 <td><code>trace4</code> </td>
2794 <td>Trace messages</td>
2796 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2799 <td><code>trace5</code> </td>
2801 <td>Trace messages</td>
2803 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2806 <td><code>trace6</code> </td>
2808 <td>Trace messages</td>
2810 <td>"cache lookup FAILED, forcing new map lookup"</td>
2813 <td><code>trace7</code> </td>
2815 <td>Trace messages, dumping large amounts of data</td>
2817 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2820 <td><code>trace8</code> </td>
2822 <td>Trace messages, dumping large amounts of data</td>
2824 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2828 <p>When a particular level is specified, messages from all
2829 other levels of higher significance will be reported as well.
2830 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2831 then messages with log levels of <code>notice</code> and
2832 <code>warn</code> will also be posted.</p>
2834 <p>Using a level of at least <code>crit</code> is
2839 <highlight language="config">LogLevel notice</highlight>
2841 <note><title>Note</title>
2842 <p>When logging to a regular file messages of the level
2843 <code>notice</code> cannot be suppressed and thus are always
2844 logged. However, this doesn't apply when logging is done
2845 using <code>syslog</code>.</p>
2848 <p>Specifying a level without a module name will reset the level
2849 for all modules to that level. Specifying a level with a module
2850 name will set the level for that module only. It is possible to
2851 use the module source file name, the module identifier, or the
2852 module identifier with the trailing <code>_module</code> omitted
2853 as module specification. This means the following three specifications
2856 <highlight language="config">
2857 LogLevel info ssl:warn
2858 LogLevel info mod_ssl.c:warn
2859 LogLevel info ssl_module:warn
2862 <p>It is also possible to change the level per directory:</p>
2864 <highlight language="config">
2866 <Directory "/usr/local/apache/htdocs/app">
2872 Per directory loglevel configuration only affects messages that are
2873 logged after the request has been parsed and that are associated with
2874 the request. Log messages which are associated with the connection or
2875 the server are not affected.
2878 </directivesynopsis>
2881 <name>MaxKeepAliveRequests</name>
2882 <description>Number of requests allowed on a persistent
2883 connection</description>
2884 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2885 <default>MaxKeepAliveRequests 100</default>
2886 <contextlist><context>server config</context><context>virtual host</context>
2890 <p>The <directive>MaxKeepAliveRequests</directive> directive
2891 limits the number of requests allowed per connection when
2892 <directive module="core" >KeepAlive</directive> is on. If it is
2893 set to <code>0</code>, unlimited requests will be allowed. We
2894 recommend that this setting be kept to a high value for maximum
2895 server performance.</p>
2899 <highlight language="config">MaxKeepAliveRequests 500</highlight>
2901 </directivesynopsis>
2904 <name>MaxRanges</name>
2905 <description>Number of ranges allowed before returning the complete
2906 resource </description>
2907 <syntax>MaxRanges default | unlimited | none | <var>number-of-ranges</var></syntax>
2908 <default>MaxRanges 200</default>
2909 <contextlist><context>server config</context><context>virtual host</context>
2910 <context>directory</context>
2912 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
2915 <p>The <directive>MaxRanges</directive> directive
2916 limits the number of HTTP ranges the server is willing to
2917 return to the client. If more ranges then permitted are requested,
2918 the complete resource is returned instead.</p>
2921 <dt><strong>default</strong></dt>
2922 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
2924 <dt><strong>none</strong></dt>
2925 <dd>Range headers are ignored.</dd>
2927 <dt><strong>unlimited</strong></dt>
2928 <dd>The server does not limit the number of ranges it is
2929 willing to satisfy.</dd>
2931 <dt><var>number-of-ranges</var></dt>
2932 <dd>A positive number representing the maximum number of ranges the
2933 server is willing to satisfy.</dd>
2936 </directivesynopsis>
2939 <name>MaxRangeOverlaps</name>
2940 <description>Number of overlapping ranges (eg: <code>100-200,150-300</code>) allowed before returning the complete
2941 resource </description>
2942 <syntax>MaxRangeOverlaps default | unlimited | none | <var>number-of-ranges</var></syntax>
2943 <default>MaxRangeOverlaps 20</default>
2944 <contextlist><context>server config</context><context>virtual host</context>
2945 <context>directory</context>
2947 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
2950 <p>The <directive>MaxRangeOverlaps</directive> directive
2951 limits the number of overlapping HTTP ranges the server is willing to
2952 return to the client. If more overlapping ranges then permitted are requested,
2953 the complete resource is returned instead.</p>
2956 <dt><strong>default</strong></dt>
2957 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
2959 <dt><strong>none</strong></dt>
2960 <dd>No overlapping Range headers are allowed.</dd>
2962 <dt><strong>unlimited</strong></dt>
2963 <dd>The server does not limit the number of overlapping ranges it is
2964 willing to satisfy.</dd>
2966 <dt><var>number-of-ranges</var></dt>
2967 <dd>A positive number representing the maximum number of overlapping ranges the
2968 server is willing to satisfy.</dd>
2971 </directivesynopsis>
2974 <name>MaxRangeReversals</name>
2975 <description>Number of range reversals (eg: <code>100-200,50-70</code>) allowed before returning the complete
2976 resource </description>
2977 <syntax>MaxRangeReversals default | unlimited | none | <var>number-of-ranges</var></syntax>
2978 <default>MaxRangeReversals 20</default>
2979 <contextlist><context>server config</context><context>virtual host</context>
2980 <context>directory</context>
2982 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
2985 <p>The <directive>MaxRangeReversals</directive> directive
2986 limits the number of HTTP Range reversals the server is willing to
2987 return to the client. If more ranges reversals then permitted are requested,
2988 the complete resource is returned instead.</p>
2991 <dt><strong>default</strong></dt>
2992 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
2994 <dt><strong>none</strong></dt>
2995 <dd>No Range reversals headers are allowed.</dd>
2997 <dt><strong>unlimited</strong></dt>
2998 <dd>The server does not limit the number of range reversals it is
2999 willing to satisfy.</dd>
3001 <dt><var>number-of-ranges</var></dt>
3002 <dd>A positive number representing the maximum number of range reversals the
3003 server is willing to satisfy.</dd>
3006 </directivesynopsis>
3010 <description>Configures mutex mechanism and lock file directory for all
3011 or specified mutexes</description>
3012 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
3013 <default>Mutex default</default>
3014 <contextlist><context>server config</context></contextlist>
3015 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
3018 <p>The <directive>Mutex</directive> directive sets the mechanism,
3019 and optionally the lock file location, that httpd and modules use
3020 to serialize access to resources. Specify <code>default</code> as
3021 the first argument to change the settings for all mutexes; specify
3022 a mutex name (see table below) as the first argument to override
3023 defaults only for that mutex.</p>
3025 <p>The <directive>Mutex</directive> directive is typically used in
3026 the following exceptional situations:</p>
3029 <li>change the mutex mechanism when the default mechanism selected
3030 by <glossary>APR</glossary> has a functional or performance
3033 <li>change the directory used by file-based mutexes when the
3034 default directory does not support locking</li>
3037 <note><title>Supported modules</title>
3038 <p>This directive only configures mutexes which have been registered
3039 with the core server using the <code>ap_mutex_register()</code> API.
3040 All modules bundled with httpd support the <directive>Mutex</directive>
3041 directive, but third-party modules may not. Consult the documentation
3042 of the third-party module, which must indicate the mutex name(s) which
3043 can be configured if this directive is supported.</p>
3046 <p>The following mutex <em>mechanisms</em> are available:</p>
3048 <li><code>default | yes</code>
3049 <p>This selects the default locking implementation, as determined by
3050 <glossary>APR</glossary>. The default locking implementation can
3051 be displayed by running <program>httpd</program> with the
3052 <code>-V</code> option.</p></li>
3054 <li><code>none | no</code>
3055 <p>This effectively disables the mutex, and is only allowed for a
3056 mutex if the module indicates that it is a valid choice. Consult the
3057 module documentation for more information.</p></li>
3059 <li><code>posixsem</code>
3060 <p>This is a mutex variant based on a Posix semaphore.</p>
3062 <note type="warning"><title>Warning</title>
3063 <p>The semaphore ownership is not recovered if a thread in the process
3064 holding the mutex segfaults, resulting in a hang of the web server.</p>
3068 <li><code>sysvsem</code>
3069 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3071 <note type="warning"><title>Warning</title>
3072 <p>It is possible to "leak" SysV semaphores if processes crash
3073 before the semaphore is removed.</p>
3076 <note type="warning"><title>Security</title>
3077 <p>The semaphore API allows for a denial of service attack by any
3078 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3079 all CGIs, unless you use something like <program>suexec</program>
3080 or <code>cgiwrapper</code>).</p>
3084 <li><code>sem</code>
3085 <p>This selects the "best" available semaphore implementation, choosing
3086 between Posix and SystemV IPC semaphores, in that order.</p></li>
3088 <li><code>pthread</code>
3089 <p>This is a mutex variant based on cross-process Posix thread
3092 <note type="warning"><title>Warning</title>
3093 <p>On most systems, if a child process terminates abnormally while
3094 holding a mutex that uses this implementation, the server will deadlock
3095 and stop responding to requests. When this occurs, the server will
3096 require a manual restart to recover.</p>
3097 <p>Solaris is a notable exception as it provides a mechanism which
3098 usually allows the mutex to be recovered after a child process
3099 terminates abnormally while holding a mutex.</p>
3100 <p>If your system implements the
3101 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3102 to use the <code>pthread</code> option safely.</p>
3106 <li><code>fcntl:/path/to/mutex</code>
3107 <p>This is a mutex variant where a physical (lock-)file and the
3108 <code>fcntl()</code> function are used as the mutex.</p>
3110 <note type="warning"><title>Warning</title>
3111 <p>When multiple mutexes based on this mechanism are used within
3112 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3113 can be reported for valid mutex operations if <code>fcntl()</code>
3114 is not thread-aware, such as on Solaris.</p>
3118 <li><code>flock:/path/to/mutex</code>
3119 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3120 with the exception that the <code>flock()</code> function is used to
3121 provide file locking.</p></li>
3123 <li><code>file:/path/to/mutex</code>
3124 <p>This selects the "best" available file locking implementation,
3125 choosing between <code>fcntl</code> and <code>flock</code>, in that
3129 <p>Most mechanisms are only available on selected platforms, where the
3130 underlying platform and <glossary>APR</glossary> support it. Mechanisms
3131 which aren't available on all platforms are <em>posixsem</em>,
3132 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3133 <em>flock</em>, and <em>file</em>.</p>
3135 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3136 the path, if provided, is a directory where the lock file will be created.
3137 The default directory is httpd's run-time file directory relative to
3138 <directive module="core">ServerRoot</directive>. Always use a local disk
3139 filesystem for <code>/path/to/mutex</code> and never a directory residing
3140 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3141 type, an optional instance string provided by the module, and unless the
3142 <code>OmitPID</code> keyword is specified, the process id of the httpd
3143 parent process will be appended to to make the file name unique, avoiding
3144 conflicts when multiple httpd instances share a lock file directory. For
3145 example, if the mutex name is <code>mpm-accept</code> and the lock file
3146 directory is <code>/var/httpd/locks</code>, the lock file name for the
3147 httpd instance with parent process id 12345 would be
3148 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3150 <note type="warning"><title>Security</title>
3151 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3152 directory such as <code>/var/tmp</code> because someone could create
3153 a denial of service attack and prevent the server from starting by
3154 creating a lockfile with the same name as the one the server will try
3158 <p>The following table documents the names of mutexes used by httpd
3159 and bundled modules.</p>
3161 <table border="1" style="zebra">
3165 <th>Protected resource</th>
3168 <td><code>mpm-accept</code></td>
3169 <td><module>prefork</module> and <module>worker</module> MPMs</td>
3170 <td>incoming connections, to avoid the thundering herd problem;
3171 for more information, refer to the
3172 <a href="../misc/perf-tuning.html">performance tuning</a>
3176 <td><code>authdigest-client</code></td>
3177 <td><module>mod_auth_digest</module></td>
3178 <td>client list in shared memory</td>
3181 <td><code>authdigest-opaque</code></td>
3182 <td><module>mod_auth_digest</module></td>
3183 <td>counter in shared memory</td>
3186 <td><code>ldap-cache</code></td>
3187 <td><module>mod_ldap</module></td>
3188 <td>LDAP result cache</td>
3191 <td><code>rewrite-map</code></td>
3192 <td><module>mod_rewrite</module></td>
3193 <td>communication with external mapping programs, to avoid
3194 intermixed I/O from multiple requests</td>
3197 <td><code>ssl-cache</code></td>
3198 <td><module>mod_ssl</module></td>
3199 <td>SSL session cache</td>
3202 <td><code>ssl-stapling</code></td>
3203 <td><module>mod_ssl</module></td>
3204 <td>OCSP stapling response cache</td>
3207 <td><code>watchdog-callback</code></td>
3208 <td><module>mod_watchdog</module></td>
3209 <td>callback function of a particular client module</td>
3213 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3214 parent process id from the lock file name.</p>
3216 <p>In the following example, the mutex mechanism for the MPM accept
3217 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3218 with the associated lock file created in directory
3219 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3220 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3222 <highlight language="config">
3223 Mutex sysvsem default
3224 Mutex fcntl:/var/httpd/locks mpm-accept
3227 </directivesynopsis>
3230 <name>NameVirtualHost</name>
3231 <description>DEPRECATED: Designates an IP address for name-virtual
3232 hosting</description>
3233 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
3234 <contextlist><context>server config</context></contextlist>
3238 <p>Prior to 2.3.11, <directive>NameVirtualHost</directive> was required
3239 to instruct the server that a particular IP address and port combination
3240 was usable as a name-based virtual host. In 2.3.11 and later,
3241 any time an IP address and port combination is used in multiple virtual
3242 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3244 <p>This directive currently has no effect.</p>
3247 <seealso><a href="../vhosts/">Virtual Hosts
3248 documentation</a></seealso>
3250 </directivesynopsis>
3253 <name>Options</name>
3254 <description>Configures what features are available in a particular
3255 directory</description>
3257 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
3258 <default>Options FollowSymlinks</default>
3259 <contextlist><context>server config</context><context>virtual host</context>
3260 <context>directory</context><context>.htaccess</context>
3262 <override>Options</override>
3263 <compatibility>The default was changed from All to FollowSymlinks in 2.3.11</compatibility>
3266 <p>The <directive>Options</directive> directive controls which
3267 server features are available in a particular directory.</p>
3269 <p><var>option</var> can be set to <code>None</code>, in which
3270 case none of the extra features are enabled, or one or more of
3274 <dt><code>All</code></dt>
3276 <dd>All options except for <code>MultiViews</code>.</dd>
3278 <dt><code>ExecCGI</code></dt>
3281 Execution of CGI scripts using <module>mod_cgi</module>
3284 <dt><code>FollowSymLinks</code></dt>
3287 The server will follow symbolic links in this directory. This is
3288 the default setting.
3290 <p>Even though the server follows the symlink it does <em>not</em>
3291 change the pathname used to match against <directive type="section"
3292 module="core">Directory</directive> sections.</p>
3293 <p>Note also, that this option <strong>gets ignored</strong> if set
3294 inside a <directive type="section" module="core">Location</directive>
3296 <p>Omitting this option should not be considered a security restriction,
3297 since symlink testing is subject to race conditions that make it
3301 <dt><code>Includes</code></dt>
3304 Server-side includes provided by <module>mod_include</module>
3307 <dt><code>IncludesNOEXEC</code></dt>
3311 Server-side includes are permitted, but the <code>#exec
3312 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3313 possible to <code>#include virtual</code> CGI scripts from
3314 <directive module="mod_alias">ScriptAlias</directive>ed
3317 <dt><code>Indexes</code></dt>
3320 If a URL which maps to a directory is requested, and there
3321 is no <directive module="mod_dir">DirectoryIndex</directive>
3322 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3323 <module>mod_autoindex</module> will return a formatted listing
3324 of the directory.</dd>
3326 <dt><code>MultiViews</code></dt>
3329 <a href="../content-negotiation.html">Content negotiated</a>
3330 "MultiViews" are allowed using
3331 <module>mod_negotiation</module>.
3332 <note><title>Note</title> <p>This option gets ignored if set
3333 anywhere other than <directive module="core" type="section"
3334 >Directory</directive>, as <module>mod_negotiation</module>
3335 needs real resources to compare against and evaluate from.</p></note>
3338 <dt><code>SymLinksIfOwnerMatch</code></dt>
3340 <dd>The server will only follow symbolic links for which the
3341 target file or directory is owned by the same user id as the
3344 <note><title>Note</title> <p>This option gets ignored if
3345 set inside a <directive module="core"
3346 type="section">Location</directive> section.</p>
3347 <p>This option should not be considered a security restriction,
3348 since symlink testing is subject to race conditions that make it
3349 circumventable.</p></note>
3353 <p>Normally, if multiple <directive>Options</directive> could
3354 apply to a directory, then the most specific one is used and
3355 others are ignored; the options are not merged. (See <a
3356 href="../sections.html#mergin">how sections are merged</a>.)
3357 However if <em>all</em> the options on the
3358 <directive>Options</directive> directive are preceded by a
3359 <code>+</code> or <code>-</code> symbol, the options are
3360 merged. Any options preceded by a <code>+</code> are added to the
3361 options currently in force, and any options preceded by a
3362 <code>-</code> are removed from the options currently in
3365 <note><title>Note</title>
3366 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3367 <code>-</code> with those without is not valid syntax, and will be
3368 rejected during server startup by the syntax check with an abort.</p>
3371 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3373 <highlight language="config">
3374 <Directory "/web/docs">
3375 Options Indexes FollowSymLinks
3378 <Directory "/web/docs/spec">
3383 <p>then only <code>Includes</code> will be set for the
3384 <code>/web/docs/spec</code> directory. However if the second
3385 <directive>Options</directive> directive uses the <code>+</code> and
3386 <code>-</code> symbols:</p>
3388 <highlight language="config">
3389 <Directory "/web/docs">
3390 Options Indexes FollowSymLinks
3393 <Directory "/web/docs/spec">
3394 Options +Includes -Indexes
3398 <p>then the options <code>FollowSymLinks</code> and
3399 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3402 <note><title>Note</title>
3403 <p>Using <code>-IncludesNOEXEC</code> or
3404 <code>-Includes</code> disables server-side includes completely
3405 regardless of the previous setting.</p>
3408 <p>The default in the absence of any other settings is
3409 <code>FollowSymlinks</code>.</p>
3411 </directivesynopsis>
3414 <name>Protocol</name>
3415 <description>Protocol for a listening socket</description>
3416 <syntax>Protocol <var>protocol</var></syntax>
3417 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3418 <compatibility>Available in Apache 2.1.5 and later.
3419 On Windows from Apache 2.3.3 and later.</compatibility>
3422 <p>This directive specifies the protocol used for a specific listening socket.
3423 The protocol is used to determine which module should handle a request, and
3424 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3427 <p>You only need to set the protocol if you are running on non-standard ports, otherwise <code>http</code> is assumed for port 80 and <code>https</code> for port 443.</p>
3429 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3431 <highlight language="config">Protocol https</highlight>
3433 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3435 <seealso><directive module="core">AcceptFilter</directive></seealso>
3436 <seealso><directive module="mpm_common">Listen</directive></seealso>
3437 </directivesynopsis>
3441 <name>RLimitCPU</name>
3442 <description>Limits the CPU consumption of processes launched
3443 by Apache httpd children</description>
3444 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3445 <default>Unset; uses operating system defaults</default>
3446 <contextlist><context>server config</context><context>virtual host</context>
3447 <context>directory</context><context>.htaccess</context></contextlist>
3448 <override>All</override>
3451 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3452 resource limit for all processes and the second parameter sets
3453 the maximum resource limit. Either parameter can be a number,
3454 or <code>max</code> to indicate to the server that the limit should
3455 be set to the maximum allowed by the operating system
3456 configuration. Raising the maximum resource limit requires that
3457 the server is running as <code>root</code>, or in the initial startup
3460 <p>This applies to processes forked off from Apache httpd children
3461 servicing requests, not the Apache httpd children themselves. This
3462 includes CGI scripts and SSI exec commands, but not any
3463 processes forked off from the Apache httpd parent such as piped
3466 <p>CPU resource limits are expressed in seconds per
3469 <seealso><directive module="core">RLimitMEM</directive></seealso>
3470 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3471 </directivesynopsis>
3474 <name>RLimitMEM</name>
3475 <description>Limits the memory consumption of processes launched
3476 by Apache httpd children</description>
3477 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3478 <default>Unset; uses operating system defaults</default>
3479 <contextlist><context>server config</context><context>virtual host</context>
3480 <context>directory</context><context>.htaccess</context></contextlist>
3481 <override>All</override>
3484 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3485 resource limit for all processes and the second parameter sets
3486 the maximum resource limit. Either parameter can be a number,
3487 or <code>max</code> to indicate to the server that the limit should
3488 be set to the maximum allowed by the operating system
3489 configuration. Raising the maximum resource limit requires that
3490 the server is running as <code>root</code>, or in the initial startup
3493 <p>This applies to processes forked off from Apache httpd children
3494 servicing requests, not the Apache httpd children themselves. This
3495 includes CGI scripts and SSI exec commands, but not any
3496 processes forked off from the Apache httpd parent such as piped
3499 <p>Memory resource limits are expressed in bytes per
3502 <seealso><directive module="core">RLimitCPU</directive></seealso>
3503 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3504 </directivesynopsis>
3507 <name>RLimitNPROC</name>
3508 <description>Limits the number of processes that can be launched by
3509 processes launched by Apache httpd children</description>
3510 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3511 <default>Unset; uses operating system defaults</default>
3512 <contextlist><context>server config</context><context>virtual host</context>
3513 <context>directory</context><context>.htaccess</context></contextlist>
3514 <override>All</override>
3517 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3518 resource limit for all processes and the second parameter sets
3519 the maximum resource limit. Either parameter can be a number,
3520 or <code>max</code> to indicate to the server that the limit
3521 should be set to the maximum allowed by the operating system
3522 configuration. Raising the maximum resource limit requires that
3523 the server is running as <code>root</code>, or in the initial startup
3526 <p>This applies to processes forked off from Apache httpd children
3527 servicing requests, not the Apache httpd children themselves. This
3528 includes CGI scripts and SSI exec commands, but not any
3529 processes forked off from the Apache httpd parent such as piped
3532 <p>Process limits control the number of processes per user.</p>
3534 <note><title>Note</title>
3535 <p>If CGI processes are <strong>not</strong> running
3536 under user ids other than the web server user id, this directive
3537 will limit the number of processes that the server itself can
3538 create. Evidence of this situation will be indicated by
3539 <strong><code>cannot fork</code></strong> messages in the
3540 <code>error_log</code>.</p>
3543 <seealso><directive module="core">RLimitMEM</directive></seealso>
3544 <seealso><directive module="core">RLimitCPU</directive></seealso>
3545 </directivesynopsis>
3548 <name>ScriptInterpreterSource</name>
3549 <description>Technique for locating the interpreter for CGI
3550 scripts</description>
3551 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3552 <default>ScriptInterpreterSource Script</default>
3553 <contextlist><context>server config</context><context>virtual host</context>
3554 <context>directory</context><context>.htaccess</context></contextlist>
3555 <override>FileInfo</override>
3556 <compatibility>Win32 only;
3557 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3558 later</compatibility>
3561 <p>This directive is used to control how Apache httpd finds the
3562 interpreter used to run CGI scripts. The default setting is
3563 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3564 by the shebang line (first line, starting with <code>#!</code>) in the
3565 script. On Win32 systems this line usually looks like:</p>
3567 <highlight language="perl">#!C:/Perl/bin/perl.exe</highlight>
3569 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3571 <highlight language="perl">#!perl</highlight>
3573 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3574 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3575 searched using the script file extension (e.g., <code>.pl</code>) as a
3576 search key. The command defined by the registry subkey
3577 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3578 <code>Shell\Open\Command</code> is used to open the script file. If the
3579 registry keys cannot be found, Apache httpd falls back to the behavior of the
3580 <code>Script</code> option.</p>
3582 <note type="warning"><title>Security</title>
3583 <p>Be careful when using <code>ScriptInterpreterSource
3584 Registry</code> with <directive
3585 module="mod_alias">ScriptAlias</directive>'ed directories, because
3586 Apache httpd will try to execute <strong>every</strong> file within this
3587 directory. The <code>Registry</code> setting may cause undesired
3588 program calls on files which are typically not executed. For
3589 example, the default open command on <code>.htm</code> files on
3590 most Windows systems will execute Microsoft Internet Explorer, so
3591 any HTTP request for an <code>.htm</code> file existing within the
3592 script directory would start the browser in the background on the
3593 server. This is a good way to crash your system within a minute or
3597 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3598 2.0 does the same thing as <code>Registry</code> but uses only the
3599 subkey <code>Shell\ExecCGI\Command</code>. The
3600 <code>ExecCGI</code> key is not a common one. It must be
3601 configured manually in the windows registry and hence prevents
3602 accidental program calls on your system.</p>
3604 </directivesynopsis>
3607 <name>SeeRequestTail</name>
3608 <description>Determine if mod_status displays the first 63 characters
3609 of a request or the last 63, assuming the request itself is greater than
3610 63 chars.</description>
3611 <syntax>SeeRequestTail On|Off</syntax>
3612 <default>SeeRequestTail Off</default>
3613 <contextlist><context>server config</context></contextlist>
3614 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3617 <p>mod_status with <code>ExtendedStatus On</code>
3618 displays the actual request being handled.
3619 For historical purposes, only 63 characters of the request
3620 are actually stored for display purposes. This directive
3621 controls whether the 1st 63 characters are stored (the previous
3622 behavior and the default) or if the last 63 characters are. This
3623 is only applicable, of course, if the length of the request is
3624 64 characters or greater.</p>
3626 <p>If Apache httpd is handling <code
3627 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3628 > mod_status displays as follows:
3633 <th>Off (default)</th>
3634 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3638 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3643 </directivesynopsis>
3646 <name>ServerAdmin</name>
3647 <description>Email address that the server includes in error
3648 messages sent to the client</description>
3649 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3650 <contextlist><context>server config</context><context>virtual host</context>
3654 <p>The <directive>ServerAdmin</directive> sets the contact address
3655 that the server includes in any error messages it returns to the
3656 client. If the <code>httpd</code> doesn't recognize the supplied argument
3658 assumes, that it's an <var>email-address</var> and prepends it with
3659 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3660 actually use an email address, since there are a lot of CGI scripts that
3661 make that assumption. If you want to use an URL, it should point to another
3662 server under your control. Otherwise users may not be able to contact you in
3665 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3667 <highlight language="config">ServerAdmin www-admin@foo.example.com</highlight>
3668 <p>as users do not always mention that they are talking about the
3671 </directivesynopsis>
3674 <name>ServerAlias</name>
3675 <description>Alternate names for a host used when matching requests
3676 to name-virtual hosts</description>
3677 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3678 <contextlist><context>virtual host</context></contextlist>
3681 <p>The <directive>ServerAlias</directive> directive sets the
3682 alternate names for a host, for use with <a
3683 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3684 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3686 <highlight language="config">
3687 <VirtualHost *:80>
3688 ServerName server.example.com
3689 ServerAlias server server2.example.com server2
3690 ServerAlias *.example.com
3691 UseCanonicalName Off
3693 </VirtualHost>
3696 <p>Name-based virtual hosts for the best-matching set of <directive
3697 type="section" module="core">virtualhost</directive>s are processsed
3698 in the order they appear in the configuration. The first matching <directive
3699 module="core">ServerName</directive> or <directive module="core"
3700 >ServerAlias</directive> is used, with no different precedence for wildcards
3701 (nor for ServerName vs. ServerAlias). </p>
3703 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3704 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3705 </directivesynopsis>
3708 <name>ServerName</name>
3709 <description>Hostname and port that the server uses to identify
3710 itself</description>
3711 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3712 <contextlist><context>server config</context><context>virtual host</context>
3716 <p>The <directive>ServerName</directive> directive sets the
3717 request scheme, hostname and
3718 port that the server uses to identify itself. This is used when
3719 creating redirection URLs.</p>
3721 <p>Additionally, <directive>ServerName</directive> is used (possibly
3722 in conjunction with <directive>ServerAlias</directive>) to uniquely
3723 identify a virtual host, when using <a
3724 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3726 <p>For example, if the name of the
3727 machine hosting the web server is <code>simple.example.com</code>,
3728 but the machine also has the DNS alias <code>www.example.com</code>
3729 and you wish the web server to be so identified, the following
3730 directive should be used:</p>
3732 <highlight language="config">ServerName www.example.com</highlight>
3734 <p>The <directive>ServerName</directive> directive
3735 may appear anywhere within the definition of a server. However,
3736 each appearance overrides the previous appearance (within that
3739 <p>If no <directive>ServerName</directive> is specified, then the
3740 server attempts to deduce the hostname by performing a reverse
3741 lookup on the IP address. If no port is specified in the
3742 <directive>ServerName</directive>, then the server will use the
3743 port from the incoming request. For optimal reliability and
3744 predictability, you should specify an explicit hostname and port
3745 using the <directive>ServerName</directive> directive.</p>
3747 <p>If you are using <a
3748 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3749 the <directive>ServerName</directive> inside a
3750 <directive type="section" module="core">VirtualHost</directive>
3751 section specifies what hostname must appear in the request's
3752 <code>Host:</code> header to match this virtual host.</p>
3754 <p>Sometimes, the server runs behind a device that processes SSL,
3755 such as a reverse proxy, load balancer or SSL offload
3756 appliance. When this is the case, specify the
3757 <code>https://</code> scheme and the port number to which the
3758 clients connect in the <directive>ServerName</directive> directive
3759 to make sure that the server generates the correct
3760 self-referential URLs.
3763 <p>See the description of the
3764 <directive module="core">UseCanonicalName</directive> and
3765 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3766 settings which determine whether self-referential URLs (e.g., by the
3767 <module>mod_dir</module> module) will refer to the
3768 specified port, or to the port number given in the client's request.
3771 <note type="warning">
3772 <p>Failure to set <directive>ServerName</directive> to a name that
3773 your server can resolve to an IP address will result in a startup
3774 warning. <code>httpd</code> will then use whatever hostname it can
3775 determine, using the system's <code>hostname</code> command. This
3776 will almost never be the hostname you actually want.</p>
3778 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3784 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3785 Apache HTTP Server</a></seealso>
3786 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3787 documentation</a></seealso>
3788 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3789 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3790 <seealso><directive module="core">ServerAlias</directive></seealso>
3791 </directivesynopsis>
3794 <name>ServerPath</name>
3795 <description>Legacy URL pathname for a name-based virtual host that
3796 is accessed by an incompatible browser</description>
3797 <syntax>ServerPath <var>URL-path</var></syntax>
3798 <contextlist><context>virtual host</context></contextlist>
3801 <p>The <directive>ServerPath</directive> directive sets the legacy
3802 URL pathname for a host, for use with <a
3803 href="../vhosts/">name-based virtual hosts</a>.</p>
3805 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3806 </directivesynopsis>
3809 <name>ServerRoot</name>
3810 <description>Base directory for the server installation</description>
3811 <syntax>ServerRoot <var>directory-path</var></syntax>
3812 <default>ServerRoot /usr/local/apache</default>
3813 <contextlist><context>server config</context></contextlist>
3816 <p>The <directive>ServerRoot</directive> directive sets the
3817 directory in which the server lives. Typically it will contain the
3818 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3819 paths in other configuration directives (such as <directive
3820 module="core">Include</directive> or <directive
3821 module="mod_so">LoadModule</directive>, for example) are taken as
3822 relative to this directory.</p>
3824 <highlight language="config">ServerRoot "/home/httpd"</highlight>
3826 <p>The default location of <directive>ServerRoot</directive> may be
3827 modified by using the <code>--prefix</code> argument to
3828 <a href="../programs/configure.html"><code>configure</code></a>, and
3829 most third-party distributions of the server have a different
3830 default location from the one listed above.</p>
3833 <seealso><a href="../invoking.html">the <code>-d</code>
3834 option to <code>httpd</code></a></seealso>
3835 <seealso><a href="../misc/security_tips.html#serverroot">the
3836 security tips</a> for information on how to properly set
3837 permissions on the <directive>ServerRoot</directive></seealso>
3838 </directivesynopsis>
3841 <name>ServerSignature</name>
3842 <description>Configures the footer on server-generated documents</description>
3843 <syntax>ServerSignature On|Off|EMail</syntax>
3844 <default>ServerSignature Off</default>
3845 <contextlist><context>server config</context><context>virtual host</context>
3846 <context>directory</context><context>.htaccess</context>
3848 <override>All</override>
3851 <p>The <directive>ServerSignature</directive> directive allows the
3852 configuration of a trailing footer line under server-generated
3853 documents (error messages, <module>mod_proxy</module> ftp directory
3854 listings, <module>mod_info</module> output, ...). The reason why you
3855 would want to enable such a footer line is that in a chain of proxies,
3856 the user often has no possibility to tell which of the chained servers
3857 actually produced a returned error message.</p>
3859 <p>The <code>Off</code>
3860 setting, which is the default, suppresses the footer line (and is
3861 therefore compatible with the behavior of Apache-1.2 and
3862 below). The <code>On</code> setting simply adds a line with the
3863 server version number and <directive
3864 module="core">ServerName</directive> of the serving virtual host,
3865 and the <code>EMail</code> setting additionally creates a
3866 "mailto:" reference to the <directive
3867 module="core">ServerAdmin</directive> of the referenced
3870 <p>After version 2.0.44, the details of the server version number
3871 presented are controlled by the <directive
3872 module="core">ServerTokens</directive> directive.</p>
3874 <seealso><directive module="core">ServerTokens</directive></seealso>
3875 </directivesynopsis>
3878 <name>ServerTokens</name>
3879 <description>Configures the <code>Server</code> HTTP response
3880 header</description>
3881 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3882 <default>ServerTokens Full</default>
3883 <contextlist><context>server config</context></contextlist>
3886 <p>This directive controls whether <code>Server</code> response
3887 header field which is sent back to clients includes a
3888 description of the generic OS-type of the server as well as
3889 information about compiled-in modules.</p>
3892 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3894 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
3895 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3897 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3899 <dd>Server sends (<em>e.g.</em>): <code>Server:
3902 <dt><code>ServerTokens Major</code></dt>
3904 <dd>Server sends (<em>e.g.</em>): <code>Server:
3905 Apache/2</code></dd>
3907 <dt><code>ServerTokens Minor</code></dt>
3909 <dd>Server sends (<em>e.g.</em>): <code>Server:
3910 Apache/2.4</code></dd>
3912 <dt><code>ServerTokens Min[imal]</code></dt>
3914 <dd>Server sends (<em>e.g.</em>): <code>Server:
3915 Apache/2.4.2</code></dd>
3917 <dt><code>ServerTokens OS</code></dt>
3919 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
3924 <p>This setting applies to the entire server, and cannot be
3925 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3927 <p>After version 2.0.44, this directive also controls the
3928 information presented by the <directive
3929 module="core">ServerSignature</directive> directive.</p>
3931 <note>Setting <directive>ServerTokens</directive> to less than
3932 <code>minimal</code> is not recommended because it makes it more
3933 difficult to debug interoperational problems. Also note that
3934 disabling the Server: header does nothing at all to make your
3935 server more secure; the idea of "security through obscurity"
3936 is a myth and leads to a false sense of safety.</note>
3939 <seealso><directive module="core">ServerSignature</directive></seealso>
3940 </directivesynopsis>
3943 <name>SetHandler</name>
3944 <description>Forces all matching files to be processed by a
3945 handler</description>
3946 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3947 <contextlist><context>server config</context><context>virtual host</context>
3948 <context>directory</context><context>.htaccess</context>
3950 <override>FileInfo</override>
3951 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3954 <p>When placed into an <code>.htaccess</code> file or a
3955 <directive type="section" module="core">Directory</directive> or
3956 <directive type="section" module="core">Location</directive>
3957 section, this directive forces all matching files to be parsed
3958 through the <a href="../handler.html">handler</a> given by
3959 <var>handler-name</var>. For example, if you had a directory you
3960 wanted to be parsed entirely as imagemap rule files, regardless
3961 of extension, you might put the following into an
3962 <code>.htaccess</code> file in that directory:</p>
3964 <highlight language="config">SetHandler imap-file</highlight>
3966 <p>Another example: if you wanted to have the server display a
3967 status report whenever a URL of
3968 <code>http://servername/status</code> was called, you might put
3969 the following into <code>httpd.conf</code>:</p>
3971 <highlight language="config">
3972 <Location "/status">
3973 SetHandler server-status
3977 <p>You can override an earlier defined <directive>SetHandler</directive>
3978 directive by using the value <code>None</code>.</p>
3980 <note><title>Note</title>
3981 <p>Because <directive>SetHandler</directive> overrides default handlers,
3982 normal behavior such as handling of URLs ending in a slash (/) as
3983 directories or index files is suppressed.</p></note>
3986 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3988 </directivesynopsis>
3991 <name>SetInputFilter</name>
3992 <description>Sets the filters that will process client requests and POST
3994 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3995 <contextlist><context>server config</context><context>virtual host</context>
3996 <context>directory</context><context>.htaccess</context>
3998 <override>FileInfo</override>
4001 <p>The <directive>SetInputFilter</directive> directive sets the
4002 filter or filters which will process client requests and POST
4003 input when they are received by the server. This is in addition to
4004 any filters defined elsewhere, including the
4005 <directive module="mod_mime">AddInputFilter</directive>
4008 <p>If more than one filter is specified, they must be separated
4009 by semicolons in the order in which they should process the
4012 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4013 </directivesynopsis>
4016 <name>SetOutputFilter</name>
4017 <description>Sets the filters that will process responses from the
4018 server</description>
4019 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
4020 <contextlist><context>server config</context><context>virtual host</context>
4021 <context>directory</context><context>.htaccess</context>
4023 <override>FileInfo</override>
4026 <p>The <directive>SetOutputFilter</directive> directive sets the filters
4027 which will process responses from the server before they are
4028 sent to the client. This is in addition to any filters defined
4029 elsewhere, including the
4030 <directive module="mod_mime">AddOutputFilter</directive>
4033 <p>For example, the following configuration will process all files
4034 in the <code>/www/data/</code> directory for server-side
4037 <highlight language="config">
4038 <Directory "/www/data/">
4039 SetOutputFilter INCLUDES
4043 <p>If more than one filter is specified, they must be separated
4044 by semicolons in the order in which they should process the
4047 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4048 </directivesynopsis>
4051 <name>TimeOut</name>
4052 <description>Amount of time the server will wait for
4053 certain events before failing a request</description>
4054 <syntax>TimeOut <var>seconds</var></syntax>
4055 <default>TimeOut 60</default>
4056 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4059 <p>The <directive>TimeOut</directive> directive defines the length
4060 of time Apache httpd will wait for I/O in various circumstances:</p>
4063 <li>When reading data from the client, the length of time to
4064 wait for a TCP packet to arrive if the read buffer is
4067 <li>When writing data to the client, the length of time to wait
4068 for an acknowledgement of a packet if the send buffer is
4071 <li>In <module>mod_cgi</module>, the length of time to wait for
4072 output from a CGI script.</li>
4074 <li>In <module>mod_ext_filter</module>, the length of time to
4075 wait for output from a filtering process.</li>
4077 <li>In <module>mod_proxy</module>, the default timeout value if
4078 <directive module="mod_proxy">ProxyTimeout</directive> is not
4083 </directivesynopsis>
4086 <name>TraceEnable</name>
4087 <description>Determines the behavior on <code>TRACE</code> requests</description>
4088 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
4089 <default>TraceEnable on</default>
4090 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4091 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
4094 <p>This directive overrides the behavior of <code>TRACE</code> for both
4095 the core server and <module>mod_proxy</module>. The default
4096 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4097 RFC 2616, which disallows any request body to accompany the request.
4098 <code>TraceEnable off</code> causes the core server and
4099 <module>mod_proxy</module> to return a <code>405</code> (Method not
4100 allowed) error to the client.</p>
4102 <p>Finally, for testing and diagnostic purposes only, request
4103 bodies may be allowed using the non-compliant <code>TraceEnable
4104 extended</code> directive. The core (as an origin server) will
4105 restrict the request body to 64k (plus 8k for chunk headers if
4106 <code>Transfer-Encoding: chunked</code> is used). The core will
4107 reflect the full headers and all chunk headers with the response
4108 body. As a proxy server, the request body is not restricted to 64k.</p>
4110 <note><title>Note</title>
4111 <p>Despite claims to the contrary, <code>TRACE</code> is not
4112 a security vulnerability and there is no viable reason for
4113 it to be disabled. Doing so necessarily makes your server
4117 </directivesynopsis>
4120 <name>UnDefine</name>
4121 <description>Undefine the existence of a variable</description>
4122 <syntax>UnDefine <var>parameter-name</var></syntax>
4123 <contextlist><context>server config</context></contextlist>
4126 <p>Undoes the effect of a <directive module="core">Define</directive> or
4127 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
4128 <p>This directive can be used to toggle the use of <directive module="core"
4129 type="section">IfDefine</directive> sections without needing to alter
4130 <code>-D</code> arguments in any startup scripts.</p>
4132 </directivesynopsis>
4135 <name>UseCanonicalName</name>
4136 <description>Configures how the server determines its own name and
4138 <syntax>UseCanonicalName On|Off|DNS</syntax>
4139 <default>UseCanonicalName Off</default>
4140 <contextlist><context>server config</context><context>virtual host</context>
4141 <context>directory</context></contextlist>
4144 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4145 URL -- that is, a URL that refers back to the same server. With
4146 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4147 specified in the <directive module="core">ServerName</directive>
4148 directive to construct the canonical name for the server. This name
4149 is used in all self-referential URLs, and for the values of
4150 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4152 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4153 self-referential URLs using the hostname and port supplied by
4154 the client if any are supplied (otherwise it will use the
4155 canonical name, as defined above). These values are the same
4156 that are used to implement <a
4157 href="../vhosts/name-based.html">name-based virtual hosts</a>,
4158 and are available with the same clients. The CGI variables
4159 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4160 constructed from the client supplied values as well.</p>
4162 <p>An example where this may be useful is on an intranet server
4163 where you have users connecting to the machine using short
4164 names such as <code>www</code>. You'll notice that if the users
4165 type a shortname, and a URL which is a directory, such as
4166 <code>http://www/splat</code>, <em>without the trailing
4167 slash</em> then Apache httpd will redirect them to
4168 <code>http://www.example.com/splat/</code>. If you have
4169 authentication enabled, this will cause the user to have to
4170 authenticate twice (once for <code>www</code> and once again
4171 for <code>www.example.com</code> -- see <a
4172 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
4173 FAQ on this subject for more information</a>). But if
4174 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
4175 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4177 <p>There is a third option, <code>UseCanonicalName DNS</code>,
4178 which is intended for use with mass IP-based virtual hosting to
4179 support ancient clients that do not provide a
4180 <code>Host:</code> header. With this option Apache httpd does a
4181 reverse DNS lookup on the server IP address that the client
4182 connected to in order to work out self-referential URLs.</p>
4184 <note type="warning"><title>Warning</title>
4185 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
4186 they may be broken by this option. The client is essentially free
4187 to give whatever value they want as a hostname. But if the CGI is
4188 only using <code>SERVER_NAME</code> to construct self-referential URLs
4189 then it should be just fine.</p>
4192 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
4193 <seealso><directive module="core">ServerName</directive></seealso>
4194 <seealso><directive module="mpm_common">Listen</directive></seealso>
4195 </directivesynopsis>
4198 <name>UseCanonicalPhysicalPort</name>
4199 <description>Configures how the server determines its own port</description>
4200 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
4201 <default>UseCanonicalPhysicalPort Off</default>
4202 <contextlist><context>server config</context><context>virtual host</context>
4203 <context>directory</context></contextlist>
4206 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4207 URL -- that is, a URL that refers back to the same server. With
4208 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
4209 constructing the canonical port for the server to honor
4210 the <directive module="core">UseCanonicalName</directive> directive,
4211 provide the actual physical port number being used by this request
4212 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
4213 Apache httpd will not ever use the actual physical port number, instead
4214 relying on all configured information to construct a valid port number.</p>
4216 <note><title>Note</title>
4217 <p>The ordering of the lookup when the physical port is used is as
4220 <dt><code>UseCanonicalName On</code></dt>
4223 <li>Port provided in <directive module="core">Servername</directive></li>
4224 <li>Physical port</li>
4225 <li>Default port</li>
4228 <dt><code>UseCanonicalName Off | DNS</code></dt>
4231 <li>Parsed port from <code>Host:</code> header</li>
4232 <li>Physical port</li>
4233 <li>Port provided in <directive module="core">Servername</directive></li>
4234 <li>Default port</li>
4239 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4240 physical ports are removed from the ordering.</p>
4244 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4245 <seealso><directive module="core">ServerName</directive></seealso>
4246 <seealso><directive module="mpm_common">Listen</directive></seealso>
4247 </directivesynopsis>
4249 <directivesynopsis type="section">
4250 <name>VirtualHost</name>
4251 <description>Contains directives that apply only to a specific
4252 hostname or IP address</description>
4253 <syntax><VirtualHost
4254 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4255 ...> ... </VirtualHost></syntax>
4256 <contextlist><context>server config</context></contextlist>
4259 <p><directive type="section">VirtualHost</directive> and
4260 <code></VirtualHost></code> are used to enclose a group of
4261 directives that will apply only to a particular virtual host. Any
4262 directive that is allowed in a virtual host context may be
4263 used. When the server receives a request for a document on a
4264 particular virtual host, it uses the configuration directives
4265 enclosed in the <directive type="section">VirtualHost</directive>
4266 section. <var>Addr</var> can be any of the following, optionally followed by
4267 a colon and a port number (or *):</p>
4270 <li>The IP address of the virtual host;</li>
4272 <li>A fully qualified domain name for the IP address of the
4273 virtual host (not recommended);</li>
4275 <li>The character <code>*</code>, which acts as a wildcard and matches
4276 any IP address.</li>
4278 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4282 <highlight language="config">
4283 <VirtualHost 10.1.2.3:80>
4284 ServerAdmin webmaster@host.example.com
4285 DocumentRoot /www/docs/host.example.com
4286 ServerName host.example.com
4287 ErrorLog logs/host.example.com-error_log
4288 TransferLog logs/host.example.com-access_log
4289 </VirtualHost>
4293 <p>IPv6 addresses must be specified in square brackets because
4294 the optional port number could not be determined otherwise. An
4295 IPv6 example is shown below:</p>
4297 <highlight language="config">
4298 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
4299 ServerAdmin webmaster@host.example.com
4300 DocumentRoot /www/docs/host.example.com
4301 ServerName host.example.com
4302 ErrorLog logs/host.example.com-error_log
4303 TransferLog logs/host.example.com-access_log
4304 </VirtualHost>
4307 <p>Each Virtual Host must correspond to a different IP address,
4308 different port number or a different host name for the server,
4309 in the former case the server machine must be configured to
4310 accept IP packets for multiple addresses. (If the machine does
4311 not have multiple network interfaces, then this can be
4312 accomplished with the <code>ifconfig alias</code> command -- if
4313 your OS supports it).</p>
4315 <note><title>Note</title>
4316 <p>The use of <directive type="section">VirtualHost</directive> does
4317 <strong>not</strong> affect what addresses Apache httpd listens on. You
4318 may need to ensure that Apache httpd is listening on the correct addresses
4319 using <directive module="mpm_common">Listen</directive>.</p>
4322 <p>A <directive module="core">ServerName</directive> should be
4323 specified inside each <directive
4324 type="section">VirtualHost</directive> block. If it is absent, the
4325 <directive module="core">ServerName</directive> from the "main"
4326 server configuration will be inherited.</p>
4328 <p>When a request is received, the server first maps it to the best matching
4329 <directive type="section">VirtualHost</directive> based on the local
4330 IP address and port combination only. Non-wildcards have a higher
4331 precedence. If no match based on IP and port occurs at all, the
4332 "main" server configuration is used.</p>
4334 <p>If multiple virtual hosts contain the best matching IP address and port,
4335 the server selects from these virtual hosts the best match based on the
4336 requested hostname. If no matching name-based virtual host is found,
4337 then the first listed virtual host that matched the IP address will be
4338 used. As a consequence, the first listed virtual host for a given IP address
4339 and port combination is default virtual host for that IP and port
4342 <note type="warning"><title>Security</title>
4343 <p>See the <a href="../misc/security_tips.html">security tips</a>
4344 document for details on why your security could be compromised if the
4345 directory where log files are stored is writable by anyone other
4346 than the user that starts the server.</p>
4349 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4350 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4351 Apache HTTP Server</a></seealso>
4352 <seealso><a href="../bind.html">Setting
4353 which addresses and ports Apache HTTP Server uses</a></seealso>
4354 <seealso><a href="../sections.html">How <Directory>, <Location>
4355 and <Files> sections work</a> for an explanation of how these
4356 different sections are combined when a request is received</seealso>
4357 </directivesynopsis>