2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Core Apache HTTP Server features that are always
27 available</description>
31 <name>AcceptFilter</name>
32 <description>Configures optimizations for a Protocol's Listener Sockets</description>
33 <syntax>AcceptFilter <var>protocol</var> <var>accept_filter</var></syntax>
34 <contextlist><context>server config</context></contextlist>
37 <p>This directive enables operating system specific optimizations for a
38 listening socket by the <directive>Protocol</directive> type.
39 The basic premise is for the kernel to not send a socket to the server
40 process until either data is received or an entire HTTP Request is buffered.
41 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
42 FreeBSD's Accept Filters</a>, Linux's more primitive
43 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
44 are currently supported.</p>
46 <p>Using <code>none</code> for an argument will disable any accept filters
47 for that protocol. This is useful for protocols that require a server
48 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
49 <highlight language="config">
50 AcceptFilter nntp none
53 <p>The default protocol names are <code>https</code> for port 443
54 and <code>http</code> for all other ports. To specify that another
55 protocol is being used with a listening port, add the <var>protocol</var>
56 argument to the <directive module="mpm_common">Listen</directive>
59 <p>The default values on FreeBSD are:</p>
60 <highlight language="config">
61 AcceptFilter http httpready
62 AcceptFilter https dataready
65 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
66 the kernel level. Once an entire request is received, the kernel then
67 sends it to the server. See the
68 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
69 accf_http(9)</a> man page for more details. Since HTTPS requests are
70 encrypted, only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
71 accf_data(9)</a> filter is used.</p>
73 <p>The default values on Linux are:</p>
74 <highlight language="config">
75 AcceptFilter http data
76 AcceptFilter https data
79 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
80 requests. Any value besides <code>none</code> will enable
81 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
83 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
84 tcp(7)</a> man page.</p>
86 <p>The default values on Windows are:</p>
87 <highlight language="config">
88 AcceptFilter http data
89 AcceptFilter https data
92 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
93 API, and does not support http protocol buffering. There are two values
94 which utilize the Windows AcceptEx() API and will recycle network
95 sockets between connections. <code>data</code> waits until data has
96 been transmitted as documented above, and the initial data buffer and
97 network endpoint addresses are all retrieved from the single AcceptEx()
98 invocation. <code>connect</code> will use the AcceptEx() API, also
99 retrieve the network endpoint addresses, but like <code>none</code>
100 the <code>connect</code> option does not wait for the initial data
103 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
104 and will not recycle sockets between connections. This is useful for
105 network adapters with broken driver support, as well as some virtual
106 network providers such as vpn drivers, or spam, virus or spyware
110 <seealso><directive module="core">Protocol</directive></seealso>
114 <name>AcceptPathInfo</name>
115 <description>Resources accept trailing pathname information</description>
116 <syntax>AcceptPathInfo On|Off|Default</syntax>
117 <default>AcceptPathInfo Default</default>
118 <contextlist><context>server config</context>
119 <context>virtual host</context><context>directory</context>
120 <context>.htaccess</context></contextlist>
121 <override>FileInfo</override>
125 <p>This directive controls whether requests that contain trailing
126 pathname information that follows an actual filename (or
127 non-existent file in an existing directory) will be accepted or
128 rejected. The trailing pathname information can be made
129 available to scripts in the <code>PATH_INFO</code> environment
132 <p>For example, assume the location <code>/test/</code> points to
133 a directory that contains only the single file
134 <code>here.html</code>. Then requests for
135 <code>/test/here.html/more</code> and
136 <code>/test/nothere.html/more</code> both collect
137 <code>/more</code> as <code>PATH_INFO</code>.</p>
139 <p>The three possible arguments for the
140 <directive>AcceptPathInfo</directive> directive are:</p>
142 <dt><code>Off</code></dt><dd>A request will only be accepted if it
143 maps to a literal path that exists. Therefore a request with
144 trailing pathname information after the true filename such as
145 <code>/test/here.html/more</code> in the above example will return
146 a 404 NOT FOUND error.</dd>
148 <dt><code>On</code></dt><dd>A request will be accepted if a
149 leading path component maps to a file that exists. The above
150 example <code>/test/here.html/more</code> will be accepted if
151 <code>/test/here.html</code> maps to a valid file.</dd>
153 <dt><code>Default</code></dt><dd>The treatment of requests with
154 trailing pathname information is determined by the <a
155 href="../handler.html">handler</a> responsible for the request.
156 The core handler for normal files defaults to rejecting
157 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
158 href="mod_cgi.html">cgi-script</a> and <a
159 href="mod_isapi.html">isapi-handler</a>, generally accept
160 <code>PATH_INFO</code> by default.</dd>
163 <p>The primary purpose of the <code>AcceptPathInfo</code>
164 directive is to allow you to override the handler's choice of
165 accepting or rejecting <code>PATH_INFO</code>. This override is required,
166 for example, when you use a <a href="../filter.html">filter</a>, such
167 as <a href="mod_include.html">INCLUDES</a>, to generate content
168 based on <code>PATH_INFO</code>. The core handler would usually reject
169 the request, so you can use the following configuration to enable
172 <highlight language="config">
173 <Files "mypaths.shtml">
175 SetOutputFilter INCLUDES
184 <name>AccessFileName</name>
185 <description>Name of the distributed configuration file</description>
186 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
187 <default>AccessFileName .htaccess</default>
188 <contextlist><context>server config</context><context>virtual host</context>
192 <p>While processing a request, the server looks for
193 the first existing configuration file from this list of names in
194 every directory of the path to the document, if distributed
195 configuration files are <a href="#allowoverride">enabled for that
196 directory</a>. For example:</p>
198 <highlight language="config">AccessFileName .acl</highlight>
200 <p>Before returning the document
201 <code>/usr/local/web/index.html</code>, the server will read
202 <code>/.acl</code>, <code>/usr/.acl</code>,
203 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
204 for directives unless they have been disabled with:</p>
206 <highlight language="config">
207 <Directory "/">
212 <seealso><directive module="core">AllowOverride</directive></seealso>
213 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
214 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
218 <name>AddDefaultCharset</name>
219 <description>Default charset parameter to be added when a response
220 content-type is <code>text/plain</code> or <code>text/html</code></description>
221 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
222 <default>AddDefaultCharset Off</default>
223 <contextlist><context>server config</context>
224 <context>virtual host</context><context>directory</context>
225 <context>.htaccess</context></contextlist>
226 <override>FileInfo</override>
229 <p>This directive specifies a default value for the media type
230 charset parameter (the name of a character encoding) to be added
231 to a response if and only if the response's content-type is either
232 <code>text/plain</code> or <code>text/html</code>. This should override
233 any charset specified in the body of the response via a <code>META</code>
234 element, though the exact behavior is often dependent on the user's client
235 configuration. A setting of <code>AddDefaultCharset Off</code>
236 disables this functionality. <code>AddDefaultCharset On</code> enables
237 a default charset of <code>iso-8859-1</code>. Any other value is assumed
238 to be the <var>charset</var> to be used, which should be one of the
239 <a href="http://www.iana.org/assignments/character-sets">IANA registered
240 charset values</a> for use in Internet media types (MIME types).
243 <highlight language="config">AddDefaultCharset utf-8</highlight>
245 <p><directive>AddDefaultCharset</directive> should only be used when all
246 of the text resources to which it applies are known to be in that
247 character encoding and it is too inconvenient to label their charset
248 individually. One such example is to add the charset parameter
249 to resources containing generated content, such as legacy CGI
250 scripts, that might be vulnerable to cross-site scripting attacks
251 due to user-provided data being included in the output. Note, however,
252 that a better solution is to just fix (or delete) those scripts, since
253 setting a default charset does not protect users that have enabled
254 the "auto-detect character encoding" feature on their browser.</p>
256 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
260 <name>AllowEncodedSlashes</name>
261 <description>Determines whether encoded path separators in URLs are allowed to
262 be passed through</description>
263 <syntax>AllowEncodedSlashes On|Off|NoDecode</syntax>
264 <default>AllowEncodedSlashes Off</default>
265 <contextlist><context>server config</context><context>virtual host</context>
268 NoDecode option available in 2.3.12 and later.</compatibility>
271 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
272 which contain encoded path separators (<code>%2F</code> for <code>/</code>
273 and additionally <code>%5C</code> for <code>\</code> on accordant systems)
274 to be used in the path info.</p>
276 <p>With the default value, <code>Off</code>, such URLs are refused
277 with a 404 (Not found) error.</p>
279 <p>With the value <code>On</code>, such URLs are accepted, and encoded
280 slashes are decoded like all other encoded characters.</p>
282 <p>With the value <code>NoDecode</code>, such URLs are accepted, but
283 encoded slashes are not decoded but left in their encoded state.</p>
285 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
286 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
288 <note><title>Note</title>
289 <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
290 strongly recommended as a security measure. Allowing slashes
291 to be decoded could potentially allow unsafe paths.</p>
294 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
298 <name>AllowOverride</name>
299 <description>Types of directives that are allowed in
300 <code>.htaccess</code> files</description>
301 <syntax>AllowOverride All|None|<var>directive-type</var>
302 [<var>directive-type</var>] ...</syntax>
303 <default>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</default>
304 <contextlist><context>directory</context></contextlist>
307 <p>When the server finds an <code>.htaccess</code> file (as
308 specified by <directive module="core">AccessFileName</directive>),
309 it needs to know which directives declared in that file can override
310 earlier configuration directives.</p>
312 <note><title>Only available in <Directory> sections</title>
313 <directive>AllowOverride</directive> is valid only in
314 <directive type="section" module="core">Directory</directive>
315 sections specified without regular expressions, not in <directive
316 type="section" module="core">Location</directive>, <directive
317 module="core" type="section">DirectoryMatch</directive> or
318 <directive type="section" module="core">Files</directive> sections.
321 <p>When this directive is set to <code>None</code> and <directive
322 module="core">AllowOverrideList</directive> is set to
323 <code>None</code> <a href="#accessfilename">.htaccess</a>, files are
324 completely ignored. In this case, the server will not even attempt
325 to read <code>.htaccess</code> files in the filesystem.</p>
327 <p>When this directive is set to <code>All</code>, then any
328 directive which has the .htaccess <a
329 href="directive-dict.html#Context">Context</a> is allowed in
330 <code>.htaccess</code> files.</p>
332 <p>The <var>directive-type</var> can be one of the following
333 groupings of directives.</p>
340 Allow use of the authorization directives (<directive
341 module="mod_authz_dbm">AuthDBMGroupFile</directive>,
342 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
343 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
344 <directive module="mod_authn_core">AuthName</directive>,
345 <directive module="mod_authn_core">AuthType</directive>, <directive
346 module="mod_authn_file">AuthUserFile</directive>, <directive
347 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
352 Allow use of the directives controlling document types
353 (<directive module="core">ErrorDocument</directive>,
354 <directive module="core">ForceType</directive>,
355 <directive module="mod_negotiation">LanguagePriority</directive>,
356 <directive module="core">SetHandler</directive>,
357 <directive module="core">SetInputFilter</directive>,
358 <directive module="core">SetOutputFilter</directive>, and
359 <module>mod_mime</module> Add* and Remove* directives),
360 document meta data (<directive
361 module="mod_headers">Header</directive>, <directive
362 module="mod_headers">RequestHeader</directive>, <directive
363 module="mod_setenvif">SetEnvIf</directive>, <directive
364 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
365 module="mod_setenvif">BrowserMatch</directive>, <directive
366 module="mod_usertrack">CookieExpires</directive>, <directive
367 module="mod_usertrack">CookieDomain</directive>, <directive
368 module="mod_usertrack">CookieStyle</directive>, <directive
369 module="mod_usertrack">CookieTracking</directive>, <directive
370 module="mod_usertrack">CookieName</directive>),
371 <module>mod_rewrite</module> directives (<directive
372 module="mod_rewrite">RewriteEngine</directive>, <directive
373 module="mod_rewrite">RewriteOptions</directive>, <directive
374 module="mod_rewrite">RewriteBase</directive>, <directive
375 module="mod_rewrite">RewriteCond</directive>, <directive
376 module="mod_rewrite">RewriteRule</directive>),
377 <module>mod_alias</module> directives (<directive
378 module="mod_alias">Redirect</directive>, <directive
379 module="mod_alias">RedirectTemp</directive>, <directive
380 module="mod_alias">RedirectPermanent</directive>, <directive
381 module="mod_alias">RedirectMatch</directive>), and
382 <directive module="mod_actions">Action</directive> from
383 <module>mod_actions</module>.
389 Allow use of the directives controlling directory indexing
391 module="mod_autoindex">AddDescription</directive>,
392 <directive module="mod_autoindex">AddIcon</directive>, <directive
393 module="mod_autoindex">AddIconByEncoding</directive>,
394 <directive module="mod_autoindex">AddIconByType</directive>,
395 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
396 module="mod_dir">DirectoryIndex</directive>, <a href="mod_autoindex.html#indexoptions.fancyindexing"
397 ><code>FancyIndexing</code></a>, <directive
398 module="mod_autoindex">HeaderName</directive>, <directive
399 module="mod_autoindex">IndexIgnore</directive>, <directive
400 module="mod_autoindex">IndexOptions</directive>, <directive
401 module="mod_autoindex">ReadmeName</directive>,
407 Allow use of the directives controlling host access (<directive
408 module="mod_access_compat">Allow</directive>, <directive
409 module="mod_access_compat">Deny</directive> and <directive
410 module="mod_access_compat">Order</directive>).</dd>
412 <dt>Nonfatal=[Override|Unknown|All]</dt>
415 Allow use of AllowOverride option to treat syntax errors in
416 .htaccess as nonfatal. Instead of causing an Internal Server
417 Error, disallowed or unrecognised directives will be ignored
418 and a warning logged:
420 <li><strong>Nonfatal=Override</strong> treats directives
421 forbidden by AllowOverride as nonfatal.</li>
422 <li><strong>Nonfatal=Unknown</strong> treats unknown directives
423 as nonfatal. This covers typos and directives implemented
424 by a module that's not present.</li>
425 <li><strong>Nonfatal=All</strong> treats both the above as nonfatal.</li>
427 <p>Note that a syntax error in a valid directive will still cause
428 an internal server error.</p>
429 <note type="warning"><title>Security</title>
430 Nonfatal errors may have security implications for .htaccess users.
431 For example, if AllowOverride disallows AuthConfig, users'
432 configuration designed to restrict access to a site will be disabled.
436 <dt>Options[=<var>Option</var>,...]</dt>
439 Allow use of the directives controlling specific directory
440 features (<directive module="core">Options</directive> and
441 <directive module="mod_include">XBitHack</directive>).
442 An equal sign may be given followed by a comma-separated list, without spaces,
443 of options that may be set using the <directive
444 module="core">Options</directive> command.
446 <note><title>Implicit disabling of Options</title>
447 <p>Even though the list of options that may be used in .htaccess files
448 can be limited with this directive, as long as any <directive
449 module="core">Options</directive> directive is allowed any
450 other inherited option can be disabled by using the non-relative
451 syntax. In other words, this mechanism cannot force a specific option
452 to remain <em>set</em> while allowing any others to be set.
456 AllowOverride Options=Indexes,MultiViews
463 <highlight language="config">AllowOverride AuthConfig Indexes</highlight>
465 <p>In the example above, all directives that are neither in the group
466 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
469 <note><p>For security and performance reasons, do not set
470 <code>AllowOverride</code> to anything other than <code>None</code>
471 in your <code><Directory "/"></code> block. Instead, find (or
472 create) the <code><Directory></code> block that refers to the
473 directory where you're actually planning to place a
474 <code>.htaccess</code> file.</p>
477 <seealso><directive module="core">AccessFileName</directive></seealso>
478 <seealso><directive module="core">AllowOverrideList</directive></seealso>
479 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
480 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
484 <name>AllowOverrideList</name>
485 <description>Individual directives that are allowed in
486 <code>.htaccess</code> files</description>
487 <syntax>AllowOverrideList None|<var>directive</var>
488 [<var>directive-type</var>] ...</syntax>
489 <default>AllowOverrideList None</default>
490 <contextlist><context>directory</context></contextlist>
493 <p>When the server finds an <code>.htaccess</code> file (as
494 specified by <directive module="core">AccessFileName</directive>),
495 it needs to know which directives declared in that file can override
496 earlier configuration directives.</p>
498 <note><title>Only available in <Directory> sections</title>
499 <directive>AllowOverrideList</directive> is valid only in
500 <directive type="section" module="core">Directory</directive>
501 sections specified without regular expressions, not in <directive
502 type="section" module="core">Location</directive>, <directive
503 module="core" type="section">DirectoryMatch</directive> or
504 <directive type="section" module="core">Files</directive> sections.
507 <p>When this directive is set to <code>None</code> and <directive
508 module="core">AllowOverride</directive> is set to <code>None</code>,
509 then <a href="#accessfilename">.htaccess</a> files are completely
510 ignored. In this case, the server will not even attempt to read
511 <code>.htaccess</code> files in the filesystem.</p>
515 <highlight language="config">
517 AllowOverrideList Redirect RedirectMatch
520 <p>In the example above, only the <code>Redirect</code> and
521 <code>RedirectMatch</code> directives are allowed. All others will
522 cause an internal server error.</p>
526 <highlight language="config">
527 AllowOverride AuthConfig
528 AllowOverrideList CookieTracking CookieName
531 <p>In the example above, <directive module="core">AllowOverride
532 </directive> grants permission to the <code>AuthConfig</code>
533 directive grouping and <directive>AllowOverrideList</directive> grants
534 permission to only two directives from the <code>FileInfo</code> directive
535 grouping. All others will cause an internal server error.</p>
538 <seealso><directive module="core">AccessFileName</directive></seealso>
539 <seealso><directive module="core">AllowOverride</directive></seealso>
540 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
541 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
545 <name>CGIMapExtension</name>
546 <description>Technique for locating the interpreter for CGI
547 scripts</description>
548 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
549 <contextlist><context>directory</context><context>.htaccess</context>
551 <override>FileInfo</override>
552 <compatibility>NetWare only</compatibility>
555 <p>This directive is used to control how Apache httpd finds the
556 interpreter used to run CGI scripts. For example, setting
557 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
558 cause all CGI script files with a <code>.foo</code> extension to
559 be passed to the FOO interpreter.</p>
564 <name>CGIPassAuth</name>
565 <description>Enables passing HTTP authorization headers to scripts as CGI
566 variables</description>
567 <syntax>CGIPassAuth On|Off</syntax>
568 <default>CGIPassAuth Off</default>
569 <contextlist><context>directory</context><context>.htaccess</context>
571 <override>AuthConfig</override>
572 <compatibility>Available in Apache HTTP Server 2.4.13 and later</compatibility>
575 <p><directive>CGIPassAuth</directive> allows scripts access to HTTP
576 authorization headers such as <code>Authorization</code>, which is
577 required for scripts that implement HTTP Basic authentication.
578 Normally these HTTP headers are hidden from scripts. This is to disallow
579 scripts from seeing user ids and passwords used to access the server when
580 HTTP Basic authentication is enabled in the web server. This directive
581 should be used when scripts are allowed to implement HTTP Basic
584 <p>This directive can be used instead of the compile-time setting
585 <code>SECURITY_HOLE_PASS_AUTHORIZATION</code> which has been available
586 in previous versions of Apache HTTP Server.</p>
588 <p>The setting is respected by any modules which use
589 <code>ap_add_common_vars()</code>, such as <module>mod_cgi</module>,
590 <module>mod_cgid</module>, <module>mod_proxy_fcgi</module>,
591 <module>mod_proxy_scgi</module>, and so on. Notably, it affects
592 modules which don't handle the request in the usual sense but
593 still use this API; examples of this are <module>mod_include</module>
594 and <module>mod_ext_filter</module>. Third-party modules that don't
595 use <code>ap_add_common_vars()</code> may choose to respect the setting
601 <name>ContentDigest</name>
602 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
603 headers</description>
604 <syntax>ContentDigest On|Off</syntax>
605 <default>ContentDigest Off</default>
606 <contextlist><context>server config</context><context>virtual host</context>
607 <context>directory</context><context>.htaccess</context>
609 <override>Options</override>
610 <status>Experimental</status>
613 <p>This directive enables the generation of
614 <code>Content-MD5</code> headers as defined in RFC1864
615 respectively RFC2616.</p>
617 <p>MD5 is an algorithm for computing a "message digest"
618 (sometimes called "fingerprint") of arbitrary-length data, with
619 a high degree of confidence that any alterations in the data
620 will be reflected in alterations in the message digest.</p>
622 <p>The <code>Content-MD5</code> header provides an end-to-end
623 message integrity check (MIC) of the entity-body. A proxy or
624 client may check this header for detecting accidental
625 modification of the entity-body in transit. Example header:</p>
628 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
631 <p>Note that this can cause performance problems on your server
632 since the message digest is computed on every request (the
633 values are not cached).</p>
635 <p><code>Content-MD5</code> is only sent for documents served
636 by the <module>core</module>, and not by any module. For example,
637 SSI documents, output from CGI scripts, and byte range responses
638 do not have this header.</p>
643 <name>DefaultRuntimeDir</name>
644 <description>Base directory for the server run-time files</description>
645 <syntax>DefaultRuntimeDir <var>directory-path</var></syntax>
646 <default>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</default>
647 <contextlist><context>server config</context></contextlist>
648 <compatibility>Available in Apache 2.4.2 and later</compatibility>
651 <p>The <directive>DefaultRuntimeDir</directive> directive sets the
652 directory in which the server will create various run-time files
653 (shared memory, locks, etc.). If set as a relative path, the full path
654 will be relative to <directive>ServerRoot</directive>.</p>
656 <p><strong>Example</strong></p>
657 <highlight language="config">
658 DefaultRuntimeDir scratch/
661 <p>The default location of <directive>DefaultRuntimeDir</directive> may be
662 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
665 <p>Note: <directive>ServerRoot</directive> should be specified before this
666 directive is used. Otherwise, the default value of <directive>ServerRoot</directive>
667 would be used to set the base directory.</p>
670 <seealso><a href="../misc/security_tips.html#serverroot">the
671 security tips</a> for information on how to properly set
672 permissions on the <directive>ServerRoot</directive></seealso>
676 <name>DefaultType</name>
677 <description>This directive has no effect other than to emit warnings
678 if the value is not <code>none</code>. In prior versions, DefaultType
679 would specify a default media type to assign to response content for
680 which no other media type configuration could be found.
682 <syntax>DefaultType <var>media-type|none</var></syntax>
683 <default>DefaultType none</default>
684 <contextlist><context>server config</context><context>virtual host</context>
685 <context>directory</context><context>.htaccess</context>
687 <override>FileInfo</override>
688 <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>
691 <p>This directive has been disabled. For backwards compatibility
692 of configuration files, it may be specified with the value
693 <code>none</code>, meaning no default media type. For example:</p>
695 <highlight language="config">DefaultType None</highlight>
697 <p><code>DefaultType None</code> is only available in
698 httpd-2.2.7 and later.</p>
700 <p>Use the mime.types configuration file and the
701 <directive module="mod_mime">AddType</directive> to configure media
702 type assignments via file extensions, or the
703 <directive module="core">ForceType</directive> directive to configure
704 the media type for specific resources. Otherwise, the server will
705 send the response without a Content-Type header field and the
706 recipient may attempt to guess the media type.</p>
712 <description>Define a variable</description>
713 <syntax>Define <var>parameter-name</var> [<var>parameter-value</var>]</syntax>
714 <contextlist><context>server config</context><context>virtual host</context>
715 <context>directory</context></contextlist>
718 <p>In its one parameter form, <directive>Define</directive> is equivalent
719 to passing the <code>-D</code> argument to <program>httpd</program>. It
720 can be used to toggle the use of
721 <directive module="core" type="section">IfDefine</directive> sections
722 without needing to alter <code>-D</code> arguments in any startup
725 <p>In addition to that, if the second parameter is given, a config variable
726 is set to this value. The variable can be used in the configuration using
727 the <code>${VAR}</code> syntax. The variable is always globally defined
728 and not limited to the scope of the surrounding config section.</p>
730 <highlight language="config">
731 <IfDefine TEST>
732 Define servername test.example.com
734 <IfDefine !TEST>
735 Define servername www.example.com
739 DocumentRoot "/var/www/${servername}/htdocs"
742 <p>Variable names may not contain colon ":" characters, to avoid clashes
743 with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
747 <directivesynopsis type="section">
748 <name>Directory</name>
749 <description>Enclose a group of directives that apply only to the
750 named file-system directory, sub-directories, and their contents.</description>
751 <syntax><Directory "<var>directory-path</var>">
752 ... </Directory></syntax>
753 <contextlist><context>server config</context><context>virtual host</context>
757 <p><directive type="section">Directory</directive> and
758 <code></Directory></code> are used to enclose a group of
759 directives that will apply only to the named directory,
760 sub-directories of that directory, and the files within the respective
761 directories. Any directive that is allowed
762 in a directory context may be used. <var>Directory-path</var> is
763 either the full path to a directory, or a wild-card string using
764 Unix shell-style matching. In a wild-card string, <code>?</code> matches
765 any single character, and <code>*</code> matches any sequences of
766 characters. You may also use <code>[]</code> character ranges. None
767 of the wildcards match a `/' character, so <code><Directory
768 "/*/public_html"></code> will not match
769 <code>/home/user/public_html</code>, but <code><Directory
770 "/home/*/public_html"></code> will match. Example:</p>
772 <highlight language="config">
773 <Directory "/usr/local/httpd/htdocs">
774 Options Indexes FollowSymLinks
778 <p>Directory paths <em>may</em> be quoted, if you like, however, it
779 <em>must</em> be quoted if the path contains spaces. This is because a
780 space would otherwise indicate the end of an argument.</p>
783 <p>Be careful with the <var>directory-path</var> arguments:
784 They have to literally match the filesystem path which Apache httpd uses
785 to access the files. Directives applied to a particular
786 <code><Directory></code> will not apply to files accessed from
787 that same directory via a different path, such as via different symbolic
791 <p><glossary ref="regex">Regular
792 expressions</glossary> can also be used, with the addition of the
793 <code>~</code> character. For example:</p>
795 <highlight language="config">
796 <Directory ~ "^/www/[0-9]{3}">
801 <p>would match directories in <code>/www/</code> that consisted of
804 <p>If multiple (non-regular expression) <directive
805 type="section">Directory</directive> sections
806 match the directory (or one of its parents) containing a document,
807 then the directives are applied in the order of shortest match
808 first, interspersed with the directives from the <a
809 href="#accessfilename">.htaccess</a> files. For example,
812 <highlight language="config">
813 <Directory "/">
817 <Directory "/home">
818 AllowOverride FileInfo
822 <p>for access to the document <code>/home/web/dir/doc.html</code>
826 <li>Apply directive <code>AllowOverride None</code>
827 (disabling <code>.htaccess</code> files).</li>
829 <li>Apply directive <code>AllowOverride FileInfo</code> (for
830 directory <code>/home</code>).</li>
832 <li>Apply any <code>FileInfo</code> directives in
833 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
834 <code>/home/web/dir/.htaccess</code> in that order.</li>
837 <p>Regular expressions are not considered until after all of the
838 normal sections have been applied. Then all of the regular
839 expressions are tested in the order they appeared in the
840 configuration file. For example, with</p>
842 <highlight language="config">
843 <Directory ~ "abc$">
844 # ... directives here ...
848 <p>the regular expression section won't be considered until after
849 all normal <directive type="section">Directory</directive>s and
850 <code>.htaccess</code> files have been applied. Then the regular
851 expression will match on <code>/home/abc/public_html/abc</code> and
852 the corresponding <directive type="section">Directory</directive> will
855 <p><strong>Note that the default access for
856 <code><Directory "/"></code> is to permit all access.
857 This means that Apache httpd will serve any file mapped from an URL. It is
858 recommended that you change this with a block such
861 <highlight language="config">
862 <Directory "/">
867 <p><strong>and then override this for directories you
868 <em>want</em> accessible. See the <a
869 href="../misc/security_tips.html">Security Tips</a> page for more
870 details.</strong></p>
872 <p>The directory sections occur in the <code>httpd.conf</code> file.
873 <directive type="section">Directory</directive> directives
874 cannot nest, and cannot appear in a <directive module="core"
875 type="section">Limit</directive> or <directive module="core"
876 type="section">LimitExcept</directive> section.</p>
878 <seealso><a href="../sections.html">How <Directory>,
879 <Location> and <Files> sections work</a> for an
880 explanation of how these different sections are combined when a
881 request is received</seealso>
884 <directivesynopsis type="section">
885 <name>DirectoryMatch</name>
886 <description>Enclose directives that apply to
887 the contents of file-system directories matching a regular expression.</description>
888 <syntax><DirectoryMatch <var>regex</var>>
889 ... </DirectoryMatch></syntax>
890 <contextlist><context>server config</context><context>virtual host</context>
894 <p><directive type="section">DirectoryMatch</directive> and
895 <code></DirectoryMatch></code> are used to enclose a group
896 of directives which will apply only to the named directory (and the files within),
897 the same as <directive module="core" type="section">Directory</directive>.
898 However, it takes as an argument a
899 <glossary ref="regex">regular expression</glossary>. For example:</p>
901 <highlight language="config">
902 <DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
904 </DirectoryMatch>
907 <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
908 that consist of three numbers.</p>
910 <note><title>Compatability</title>
911 Prior to 2.3.9, this directive implicitly applied to sub-directories
912 (like <directive module="core" type="section">Directory</directive>) and
913 could not match the end of line symbol ($). In 2.3.9 and later,
914 only directories that match the expression are affected by the enclosed
918 <note><title>Trailing Slash</title>
919 This directive applies to requests for directories that may or may
920 not end in a trailing slash, so expressions that are anchored to the
921 end of line ($) must be written with care.
924 <p>From 2.4.8 onwards, named groups and backreferences are captured and
925 written to the environment with the corresponding name prefixed with
926 "MATCH_" and in upper case. This allows elements of paths to be referenced
927 from within <a href="../expr.html">expressions</a> and modules like
928 <module>mod_rewrite</module>. In order to prevent confusion, numbered
929 (unnamed) backreferences are ignored. Use named groups instead.</p>
931 <highlight language="config">
932 <DirectoryMatch "^/var/www/combined/(?<sitename>[^/]+)">
933 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
934 </DirectoryMatch>
937 <seealso><directive type="section" module="core">Directory</directive> for
938 a description of how regular expressions are mixed in with normal
939 <directive type="section">Directory</directive>s</seealso>
941 href="../sections.html">How <Directory>, <Location> and
942 <Files> sections work</a> for an explanation of how these different
943 sections are combined when a request is received</seealso>
947 <name>DocumentRoot</name>
948 <description>Directory that forms the main document tree visible
949 from the web</description>
950 <syntax>DocumentRoot <var>directory-path</var></syntax>
951 <default>DocumentRoot "/usr/local/apache/htdocs"</default>
952 <contextlist><context>server config</context><context>virtual host</context>
956 <p>This directive sets the directory from which <program>httpd</program>
957 will serve files. Unless matched by a directive like <directive
958 module="mod_alias">Alias</directive>, the server appends the
959 path from the requested URL to the document root to make the
960 path to the document. Example:</p>
962 <highlight language="config">DocumentRoot "/usr/web"</highlight>
965 <code>http://my.example.com/index.html</code> refers to
966 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
967 not absolute then it is assumed to be relative to the <directive
968 module="core">ServerRoot</directive>.</p>
970 <p>The <directive>DocumentRoot</directive> should be specified without
971 a trailing slash.</p>
973 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
974 Locations</a></seealso>
977 <directivesynopsis type="section">
979 <description>Contains directives that apply only if the condition of a
980 previous <directive type="section" module="core">If</directive> or
981 <directive type="section" module="core">ElseIf</directive> section is not
982 satisfied by a request at runtime</description>
983 <syntax><Else> ... </Else></syntax>
984 <contextlist><context>server config</context><context>virtual host</context>
985 <context>directory</context><context>.htaccess</context>
987 <override>All</override>
990 <p>The <directive type="section">Else</directive> applies the enclosed
991 directives if and only if the most recent
992 <directive type="section">If</directive> or
993 <directive type="section">ElseIf</directive> section
994 in the same scope has not been applied.
997 <highlight language="config">
998 <If "-z req('Host')">
1006 <p> The <directive type="section">If</directive> would match HTTP/1.0
1007 requests without a <var>Host:</var> header and the
1008 <directive type="section">Else</directive> would match requests
1009 with a <var>Host:</var> header.</p>
1012 <seealso><directive type="section" module="core">If</directive></seealso>
1013 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
1014 <seealso><a href="../sections.html">How <Directory>, <Location>,
1015 <Files> sections work</a> for an explanation of how these
1016 different sections are combined when a request is received.
1017 <directive type="section">If</directive>,
1018 <directive type="section">ElseIf</directive>, and
1019 <directive type="section">Else</directive> are applied last.</seealso>
1020 </directivesynopsis>
1022 <directivesynopsis type="section">
1024 <description>Contains directives that apply only if a condition is satisfied
1025 by a request at runtime while the condition of a previous
1026 <directive type="section" module="core">If</directive> or
1027 <directive type="section">ElseIf</directive> section is not
1028 satisfied</description>
1029 <syntax><ElseIf <var>expression</var>> ... </ElseIf></syntax>
1030 <contextlist><context>server config</context><context>virtual host</context>
1031 <context>directory</context><context>.htaccess</context>
1033 <override>All</override>
1036 <p>The <directive type="section">ElseIf</directive> applies the enclosed
1037 directives if and only if both the given condition evaluates to true and
1038 the most recent <directive type="section">If</directive> or
1039 <directive type="section">ElseIf</directive> section in the same scope has
1040 not been applied. For example: In </p>
1042 <highlight language="config">
1043 <If "-R '10.1.0.0/16'">
1046 <ElseIf "-R '10.0.0.0/8'">
1054 <p>The <directive type="section">ElseIf</directive> would match if
1055 the remote address of a request belongs to the subnet 10.0.0.0/8 but
1056 not to the subnet 10.1.0.0/16.</p>
1059 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1060 for a complete reference and more examples.</seealso>
1061 <seealso><directive type="section" module="core">If</directive></seealso>
1062 <seealso><directive type="section" module="core">Else</directive></seealso>
1063 <seealso><a href="../sections.html">How <Directory>, <Location>,
1064 <Files> sections work</a> for an explanation of how these
1065 different sections are combined when a request is received.
1066 <directive type="section">If</directive>,
1067 <directive type="section">ElseIf</directive>, and
1068 <directive type="section">Else</directive> are applied last.</seealso>
1069 </directivesynopsis>
1074 <name>EnableMMAP</name>
1075 <description>Use memory-mapping to read files during delivery</description>
1076 <syntax>EnableMMAP On|Off</syntax>
1077 <default>EnableMMAP On</default>
1078 <contextlist><context>server config</context><context>virtual host</context>
1079 <context>directory</context><context>.htaccess</context>
1081 <override>FileInfo</override>
1084 <p>This directive controls whether the <program>httpd</program> may use
1085 memory-mapping if it needs to read the contents of a file during
1086 delivery. By default, when the handling of a request requires
1087 access to the data within a file -- for example, when delivering a
1088 server-parsed file using <module>mod_include</module> -- Apache httpd
1089 memory-maps the file if the OS supports it.</p>
1091 <p>This memory-mapping sometimes yields a performance improvement.
1092 But in some environments, it is better to disable the memory-mapping
1093 to prevent operational problems:</p>
1096 <li>On some multiprocessor systems, memory-mapping can reduce the
1097 performance of the <program>httpd</program>.</li>
1098 <li>Deleting or truncating a file while <program>httpd</program>
1099 has it memory-mapped can cause <program>httpd</program> to
1100 crash with a segmentation fault.
1104 <p>For server configurations that are vulnerable to these problems,
1105 you should disable memory-mapping of delivered files by specifying:</p>
1107 <highlight language="config">EnableMMAP Off</highlight>
1109 <p>For NFS mounted files, this feature may be disabled explicitly for
1110 the offending files by specifying:</p>
1112 <highlight language="config">
1113 <Directory "/path-to-nfs-files">
1118 </directivesynopsis>
1121 <name>EnableSendfile</name>
1122 <description>Use the kernel sendfile support to deliver files to the client</description>
1123 <syntax>EnableSendfile On|Off</syntax>
1124 <default>EnableSendfile Off</default>
1125 <contextlist><context>server config</context><context>virtual host</context>
1126 <context>directory</context><context>.htaccess</context>
1128 <override>FileInfo</override>
1129 <compatibility>Default changed to Off in
1130 version 2.3.9.</compatibility>
1133 <p>This directive controls whether <program>httpd</program> may use the
1134 sendfile support from the kernel to transmit file contents to the client.
1135 By default, when the handling of a request requires no access
1136 to the data within a file -- for example, when delivering a
1137 static file -- Apache httpd uses sendfile to deliver the file contents
1138 without ever reading the file if the OS supports it.</p>
1140 <p>This sendfile mechanism avoids separate read and send operations,
1141 and buffer allocations. But on some platforms or within some
1142 filesystems, it is better to disable this feature to avoid
1143 operational problems:</p>
1146 <li>Some platforms may have broken sendfile support that the build
1147 system did not detect, especially if the binaries were built on
1148 another box and moved to such a machine with broken sendfile
1150 <li>On Linux the use of sendfile triggers TCP-checksum
1151 offloading bugs on certain networking cards when using IPv6.</li>
1152 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1153 files over 2GB in size.</li>
1154 <li>With a network-mounted <directive
1155 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
1156 the kernel may be unable to serve the network file through
1160 <p>For server configurations that are not vulnerable to these problems,
1161 you may enable this feature by specifying:</p>
1163 <highlight language="config">EnableSendfile On</highlight>
1165 <p>For network mounted files, this feature may be disabled explicitly
1166 for the offending files by specifying:</p>
1168 <highlight language="config">
1169 <Directory "/path-to-nfs-files">
1173 <p>Please note that the per-directory and .htaccess configuration
1174 of <directive>EnableSendfile</directive> is not supported by
1175 <module>mod_cache_disk</module>.
1176 Only global definition of <directive>EnableSendfile</directive>
1177 is taken into account by the module.
1180 </directivesynopsis>
1184 <description>Abort configuration parsing with a custom error message</description>
1185 <syntax>Error <var>message</var></syntax>
1186 <contextlist><context>server config</context><context>virtual host</context>
1187 <context>directory</context><context>.htaccess</context>
1189 <compatibility>2.3.9 and later</compatibility>
1192 <p>If an error can be detected within the configuration, this
1193 directive can be used to generate a custom error message, and halt
1194 configuration parsing. The typical use is for reporting required
1195 modules which are missing from the configuration.</p>
1197 <highlight language="config">
1199 # ensure that mod_include is loaded
1200 <IfModule !include_module>
1201 Error "mod_include is required by mod_foo. Load it with LoadModule."
1204 # ensure that exactly one of SSL,NOSSL is defined
1205 <IfDefine SSL>
1206 <IfDefine NOSSL>
1207 Error "Both SSL and NOSSL are defined. Define only one of them."
1210 <IfDefine !SSL>
1211 <IfDefine !NOSSL>
1212 Error "Either SSL or NOSSL must be defined."
1218 </directivesynopsis>
1221 <name>ErrorDocument</name>
1222 <description>What the server will return to the client
1223 in case of an error</description>
1224 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
1225 <contextlist><context>server config</context><context>virtual host</context>
1226 <context>directory</context><context>.htaccess</context>
1228 <override>FileInfo</override>
1231 <p>In the event of a problem or error, Apache httpd can be configured
1232 to do one of four things,</p>
1235 <li>output a simple hardcoded error message</li>
1237 <li>output a customized message</li>
1239 <li>internally redirect to a local <var>URL-path</var> to handle the
1242 <li>redirect to an external <var>URL</var> to handle the
1246 <p>The first option is the default, while options 2-4 are
1247 configured using the <directive>ErrorDocument</directive>
1248 directive, which is followed by the HTTP response code and a URL
1249 or a message. Apache httpd will sometimes offer additional information
1250 regarding the problem/error.</p>
1252 <p>From 2.4.13, <a href="../expr.html">expression syntax</a> can be
1253 used inside the directive to produce dynamic strings and URLs.</p>
1255 <p>URLs can begin with a slash (/) for local web-paths (relative
1256 to the <directive module="core">DocumentRoot</directive>), or be a
1257 full URL which the client can resolve. Alternatively, a message
1258 can be provided to be displayed by the browser. Note that deciding
1259 whether the parameter is an URL, a path or a message is performed
1260 before any expression is parsed. Examples:</p>
1262 <highlight language="config">
1263 ErrorDocument 500 http://foo.example.com/cgi-bin/tester
1264 ErrorDocument 404 /cgi-bin/bad_urls.pl
1265 ErrorDocument 401 /subscription_info.html
1266 ErrorDocument 403 "Sorry can't allow you access today"
1267 ErrorDocument 403 Forbidden!
1268 ErrorDocument 403 /cgi-bin/forbidden.pl?referrer=%{escape:%{HTTP_REFERER}}
1271 <p>Additionally, the special value <code>default</code> can be used
1272 to specify Apache httpd's simple hardcoded message. While not required
1273 under normal circumstances, <code>default</code> will restore
1274 Apache httpd's simple hardcoded message for configurations that would
1275 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
1277 <highlight language="config">
1278 ErrorDocument 404 /cgi-bin/bad_urls.pl
1280 <Directory "/web/docs">
1281 ErrorDocument 404 default
1285 <p>Note that when you specify an <directive>ErrorDocument</directive>
1286 that points to a remote URL (ie. anything with a method such as
1287 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1288 client to tell it where to find the document, even if the
1289 document ends up being on the same server. This has several
1290 implications, the most important being that the client will not
1291 receive the original error status code, but instead will
1292 receive a redirect status code. This in turn can confuse web
1293 robots and other clients which try to determine if a URL is
1294 valid using the status code. In addition, if you use a remote
1295 URL in an <code>ErrorDocument 401</code>, the client will not
1296 know to prompt the user for a password since it will not
1297 receive the 401 status code. Therefore, <strong>if you use an
1298 <code>ErrorDocument 401</code> directive, then it must refer to a local
1299 document.</strong></p>
1301 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1302 server-generated error messages when they are "too small" and substitute
1303 its own "friendly" error messages. The size threshold varies depending on
1304 the type of error, but in general, if you make your error document
1305 greater than 512 bytes, then MSIE will show the server-generated
1306 error rather than masking it. More information is available in
1307 Microsoft Knowledge Base article <a
1308 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1311 <p>Although most error messages can be overridden, there are certain
1312 circumstances where the internal messages are used regardless of the
1313 setting of <directive module="core">ErrorDocument</directive>. In
1314 particular, if a malformed request is detected, normal request processing
1315 will be immediately halted and the internal error message returned.
1316 This is necessary to guard against security problems caused by
1319 <p>If you are using mod_proxy, you may wish to enable
1320 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1321 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1322 Apache httpd will not generate custom error documents for proxied content.</p>
1325 <seealso><a href="../custom-error.html">documentation of
1326 customizable responses</a></seealso>
1327 </directivesynopsis>
1330 <name>ErrorLog</name>
1331 <description>Location where the server will log errors</description>
1332 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1333 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1334 <contextlist><context>server config</context><context>virtual host</context>
1338 <p>The <directive>ErrorLog</directive> directive sets the name of
1339 the file to which the server will log any errors it encounters. If
1340 the <var>file-path</var> is not absolute then it is assumed to be
1341 relative to the <directive module="core">ServerRoot</directive>.</p>
1343 <highlight language="config">ErrorLog "/var/log/httpd/error_log"</highlight>
1345 <p>If the <var>file-path</var>
1346 begins with a pipe character "<code>|</code>" then it is assumed to be a
1347 command to spawn to handle the error log.</p>
1349 <highlight language="config">ErrorLog "|/usr/local/bin/httpd_errors"</highlight>
1351 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1352 more information.</p>
1354 <p>Using <code>syslog</code> instead of a filename enables logging
1355 via syslogd(8) if the system supports it. The default is to use
1356 syslog facility <code>local7</code>, but you can override this by
1357 using the <code>syslog:<var>facility</var></code> syntax where
1358 <var>facility</var> can be one of the names usually documented in
1359 syslog(1). The facility is effectively global, and if it is changed
1360 in individual virtual hosts, the final facility specified affects the
1363 <highlight language="config">ErrorLog syslog:user</highlight>
1365 <p>Additional modules can provide their own ErrorLog providers. The syntax
1366 is similar to the <code>syslog</code> example above.</p>
1368 <p>SECURITY: See the <a
1369 href="../misc/security_tips.html#serverroot">security tips</a>
1370 document for details on why your security could be compromised
1371 if the directory where log files are stored is writable by
1372 anyone other than the user that starts the server.</p>
1373 <note type="warning"><title>Note</title>
1374 <p>When entering a file path on non-Unix platforms, care should be taken
1375 to make sure that only forward slashes are used even though the platform
1376 may allow the use of back slashes. In general it is a good idea to always
1377 use forward slashes throughout the configuration files.</p>
1380 <seealso><directive module="core">LogLevel</directive></seealso>
1381 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1382 </directivesynopsis>
1385 <name>ErrorLogFormat</name>
1386 <description>Format specification for error log entries</description>
1387 <syntax> ErrorLogFormat [connection|request] <var>format</var></syntax>
1388 <contextlist><context>server config</context><context>virtual host</context>
1392 <p><directive>ErrorLogFormat</directive> allows to specify what
1393 supplementary information is logged in the error log in addition to the
1394 actual log message.</p>
1396 <highlight language="config">
1398 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1401 <p>Specifying <code>connection</code> or <code>request</code> as first
1402 parameter allows to specify additional formats, causing additional
1403 information to be logged when the first message is logged for a specific
1404 connection or request, respectively. This additional information is only
1405 logged once per connection/request. If a connection or request is processed
1406 without causing any log message, the additional information is not logged
1409 <p>It can happen that some format string items do not produce output. For
1410 example, the Referer header is only present if the log message is
1411 associated to a request and the log message happens at a time when the
1412 Referer header has already been read from the client. If no output is
1413 produced, the default behavior is to delete everything from the preceding
1414 space character to the next space character. This means the log line is
1415 implicitly divided into fields on non-whitespace to whitespace transitions.
1416 If a format string item does not produce output, the whole field is
1417 omitted. For example, if the remote address <code>%a</code> in the log
1418 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1419 brackets are not logged either. Space characters can be escaped with a
1420 backslash to prevent them from delimiting a field. The combination '% '
1421 (percent space) is a zero-width field delimiter that does not produce any
1424 <p>The above behavior can be changed by adding modifiers to the format
1425 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1426 respective item does not produce any output. In once-per-connection/request
1427 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1428 item with the plus modifier does not produce any output, the whole line is
1431 <p>A number as modifier can be used to assign a log severity level to a
1432 format item. The item will only be logged if the severity of the log
1433 message is not higher than the specified log severity level. The number can
1434 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1436 <p>For example, here's what would happen if you added modifiers to
1437 the <code>%{Referer}i</code> token, which logs the
1438 <code>Referer</code> request header.</p>
1440 <table border="1" style="zebra">
1441 <columnspec><column width=".3"/><column width=".7"/></columnspec>
1443 <tr><th>Modified Token</th><th>Meaning</th></tr>
1446 <td><code>%-{Referer}i</code></td>
1447 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1451 <td><code>%+{Referer}i</code></td>
1452 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1456 <td><code>%4{Referer}i</code></td>
1457 <td>Logs the <code>Referer</code> only if the log message severity
1458 is higher than 4.</td>
1463 <p>Some format string items accept additional parameters in braces.</p>
1465 <table border="1" style="zebra">
1466 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1468 <tr><th>Format String</th> <th>Description</th></tr>
1470 <tr><td><code>%%</code></td>
1471 <td>The percent sign</td></tr>
1473 <tr><td><code>%a</code></td>
1474 <td>Client IP address and port of the request</td></tr>
1476 <tr><td><code>%{c}a</code></td>
1477 <td>Underlying peer IP address and port of the connection (see the
1478 <module>mod_remoteip</module> module)</td></tr>
1480 <tr><td><code>%A</code></td>
1481 <td>Local IP-address and port</td></tr>
1483 <tr><td><code>%{<em>name</em>}e</code></td>
1484 <td>Request environment variable <em>name</em></td></tr>
1486 <tr><td><code>%E</code></td>
1487 <td>APR/OS error status code and string</td></tr>
1489 <tr><td><code>%F</code></td>
1490 <td>Source file name and line number of the log call</td></tr>
1492 <tr><td><code>%{<em>name</em>}i</code></td>
1493 <td>Request header <em>name</em></td></tr>
1495 <tr><td><code>%k</code></td>
1496 <td>Number of keep-alive requests on this connection</td></tr>
1498 <tr><td><code>%l</code></td>
1499 <td>Loglevel of the message</td></tr>
1501 <tr><td><code>%L</code></td>
1502 <td>Log ID of the request</td></tr>
1504 <tr><td><code>%{c}L</code></td>
1505 <td>Log ID of the connection</td></tr>
1507 <tr><td><code>%{C}L</code></td>
1508 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1510 <tr><td><code>%m</code></td>
1511 <td>Name of the module logging the message</td></tr>
1513 <tr><td><code>%M</code></td>
1514 <td>The actual log message</td></tr>
1516 <tr><td><code>%{<em>name</em>}n</code></td>
1517 <td>Request note <em>name</em></td></tr>
1519 <tr><td><code>%P</code></td>
1520 <td>Process ID of current process</td></tr>
1522 <tr><td><code>%T</code></td>
1523 <td>Thread ID of current thread</td></tr>
1525 <tr><td><code>%{g}T</code></td>
1526 <td>System unique thread ID of current thread (the same ID as
1527 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1529 <tr><td><code>%t</code></td>
1530 <td>The current time</td></tr>
1532 <tr><td><code>%{u}t</code></td>
1533 <td>The current time including micro-seconds</td></tr>
1535 <tr><td><code>%{cu}t</code></td>
1536 <td>The current time in compact ISO 8601 format, including
1537 micro-seconds</td></tr>
1539 <tr><td><code>%v</code></td>
1540 <td>The canonical <directive module="core">ServerName</directive>
1541 of the current server.</td></tr>
1543 <tr><td><code>%V</code></td>
1544 <td>The server name of the server serving the request according to the
1545 <directive module="core" >UseCanonicalName</directive>
1548 <tr><td><code>\ </code> (backslash space)</td>
1549 <td>Non-field delimiting space</td></tr>
1551 <tr><td><code>% </code> (percent space)</td>
1552 <td>Field delimiter (no output)</td></tr>
1555 <p>The log ID format <code>%L</code> produces a unique id for a connection
1556 or request. This can be used to correlate which log lines belong to the
1557 same connection or request, which request happens on which connection.
1558 A <code>%L</code> format string is also available in
1559 <module>mod_log_config</module> to allow to correlate access log entries
1560 with error log lines. If <module>mod_unique_id</module> is loaded, its
1561 unique id will be used as log ID for requests.</p>
1563 <highlight language="config">
1564 #Example (default format for threaded MPMs)
1565 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1568 <p>This would result in error messages such as:</p>
1571 [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
1574 <p>Notice that, as discussed above, some fields are omitted
1575 entirely because they are not defined.</p>
1577 <highlight language="config">
1578 #Example (similar to the 2.2.x format)
1579 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1582 <highlight language="config">
1583 #Advanced example with request/connection log IDs
1584 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1585 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1586 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1587 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1588 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"
1592 <seealso><directive module="core">ErrorLog</directive></seealso>
1593 <seealso><directive module="core">LogLevel</directive></seealso>
1594 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1595 </directivesynopsis>
1598 <name>ExtendedStatus</name>
1599 <description>Keep track of extended status information for each
1600 request</description>
1601 <syntax>ExtendedStatus On|Off</syntax>
1602 <default>ExtendedStatus Off[*]</default>
1603 <contextlist><context>server config</context></contextlist>
1606 <p>This option tracks additional data per worker about the
1607 currently executing request and creates a utilization summary.
1608 You can see these variables during runtime by configuring
1609 <module>mod_status</module>. Note that other modules may
1610 rely on this scoreboard.</p>
1612 <p>This setting applies to the entire server and cannot be
1613 enabled or disabled on a virtualhost-by-virtualhost basis.
1614 The collection of extended status information can slow down
1615 the server. Also note that this setting cannot be changed
1616 during a graceful restart.</p>
1619 <p>Note that loading <module>mod_status</module> will change
1620 the default behavior to ExtendedStatus On, while other
1621 third party modules may do the same. Such modules rely on
1622 collecting detailed information about the state of all workers.
1623 The default is changed by <module>mod_status</module> beginning
1624 with version 2.3.6. The previous default was always Off.</p>
1629 </directivesynopsis>
1632 <name>FileETag</name>
1633 <description>File attributes used to create the ETag
1634 HTTP response header for static files</description>
1635 <syntax>FileETag <var>component</var> ...</syntax>
1636 <default>FileETag MTime Size</default>
1637 <contextlist><context>server config</context><context>virtual host</context>
1638 <context>directory</context><context>.htaccess</context>
1640 <override>FileInfo</override>
1641 <compatibility>The default used to be "INode MTime Size" in 2.3.14 and
1642 earlier.</compatibility>
1646 The <directive>FileETag</directive> directive configures the file
1647 attributes that are used to create the <code>ETag</code> (entity
1648 tag) response header field when the document is based on a static file.
1649 (The <code>ETag</code> value is used in cache management to save
1650 network bandwidth.) The
1651 <directive>FileETag</directive> directive allows you to choose
1652 which of these -- if any -- should be used. The recognized keywords are:
1656 <dt><strong>INode</strong></dt>
1657 <dd>The file's i-node number will be included in the calculation</dd>
1658 <dt><strong>MTime</strong></dt>
1659 <dd>The date and time the file was last modified will be included</dd>
1660 <dt><strong>Size</strong></dt>
1661 <dd>The number of bytes in the file will be included</dd>
1662 <dt><strong>All</strong></dt>
1663 <dd>All available fields will be used. This is equivalent to:
1664 <highlight language="config">FileETag INode MTime Size</highlight></dd>
1665 <dt><strong>None</strong></dt>
1666 <dd>If a document is file-based, no <code>ETag</code> field will be
1667 included in the response</dd>
1670 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1671 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1672 which allow changes to be made to the default setting inherited
1673 from a broader scope. Any keyword appearing without such a prefix
1674 immediately and completely cancels the inherited setting.</p>
1676 <p>If a directory's configuration includes
1677 <code>FileETag INode MTime Size</code>, and a
1678 subdirectory's includes <code>FileETag -INode</code>,
1679 the setting for that subdirectory (which will be inherited by
1680 any sub-subdirectories that don't override it) will be equivalent to
1681 <code>FileETag MTime Size</code>.</p>
1682 <note type="warning"><title>Warning</title>
1683 Do not change the default for directories or locations that have WebDAV
1684 enabled and use <module>mod_dav_fs</module> as a storage provider.
1685 <module>mod_dav_fs</module> uses <code>MTime Size</code>
1686 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1687 These conditional requests will break if the <code>ETag</code> format is
1688 changed via <directive>FileETag</directive>.
1690 <note><title>Server Side Includes</title>
1691 An ETag is not generated for responses parsed by <module>mod_include</module>
1692 since the response entity can change without a change of the INode, MTime, or Size
1693 of the static file with embedded SSI directives.
1697 </directivesynopsis>
1699 <directivesynopsis type="section">
1701 <description>Contains directives that apply to matched
1702 filenames</description>
1703 <syntax><Files "<var>filename</var>"> ... </Files></syntax>
1704 <contextlist><context>server config</context><context>virtual host</context>
1705 <context>directory</context><context>.htaccess</context>
1707 <override>All</override>
1710 <p>The <directive type="section">Files</directive> directive
1711 limits the scope of the enclosed directives by filename. It is comparable
1712 to the <directive module="core" type="section">Directory</directive>
1713 and <directive module="core" type="section">Location</directive>
1714 directives. It should be matched with a <code></Files></code>
1715 directive. The directives given within this section will be applied to
1716 any object with a basename (last component of filename) matching the
1717 specified filename. <directive type="section">Files</directive>
1718 sections are processed in the order they appear in the
1719 configuration file, after the <directive module="core"
1720 type="section">Directory</directive> sections and
1721 <code>.htaccess</code> files are read, but before <directive
1722 type="section" module="core">Location</directive> sections. Note
1723 that <directive type="section">Files</directive> can be nested
1724 inside <directive type="section"
1725 module="core">Directory</directive> sections to restrict the
1726 portion of the filesystem they apply to.</p>
1728 <p>The <var>filename</var> argument should include a filename, or
1729 a wild-card string, where <code>?</code> matches any single character,
1730 and <code>*</code> matches any sequences of characters.</p>
1731 <highlight language="config">
1732 <Files "cat.html">
1733 # Insert stuff that applies to cat.html here
1736 <Files "?at.*">
1737 # This would apply to cat.html, bat.html, hat.php and so on.
1740 <p><glossary ref="regex">Regular expressions</glossary>
1741 can also be used, with the addition of the
1742 <code>~</code> character. For example:</p>
1744 <highlight language="config">
1745 <Files ~ "\.(gif|jpe?g|png)$">
1750 <p>would match most common Internet graphics formats. <directive
1751 module="core" type="section">FilesMatch</directive> is preferred,
1754 <p>Note that unlike <directive type="section"
1755 module="core">Directory</directive> and <directive type="section"
1756 module="core">Location</directive> sections, <directive
1757 type="section">Files</directive> sections can be used inside
1758 <code>.htaccess</code> files. This allows users to control access to
1759 their own files, at a file-by-file level.</p>
1762 <seealso><a href="../sections.html">How <Directory>, <Location>
1763 and <Files> sections work</a> for an explanation of how these
1764 different sections are combined when a request is received</seealso>
1765 </directivesynopsis>
1767 <directivesynopsis type="section">
1768 <name>FilesMatch</name>
1769 <description>Contains directives that apply to regular-expression matched
1770 filenames</description>
1771 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1772 <contextlist><context>server config</context><context>virtual host</context>
1773 <context>directory</context><context>.htaccess</context>
1775 <override>All</override>
1778 <p>The <directive type="section">FilesMatch</directive> directive
1779 limits the scope of the enclosed directives by filename, just as the
1780 <directive module="core" type="section">Files</directive> directive
1781 does. However, it accepts a <glossary ref="regex">regular
1782 expression</glossary>. For example:</p>
1784 <highlight language="config">
1785 <FilesMatch ".+\.(gif|jpe?g|png)$">
1790 <p>would match most common Internet graphics formats.</p>
1792 <note>The <code>.+</code> at the start of the regex ensures that
1793 files named <code>.png</code>, or <code>.gif</code>, for example,
1794 are not matched.</note>
1796 <p>From 2.4.8 onwards, named groups and backreferences are captured and
1797 written to the environment with the corresponding name prefixed with
1798 "MATCH_" and in upper case. This allows elements of files to be referenced
1799 from within <a href="../expr.html">expressions</a> and modules like
1800 <module>mod_rewrite</module>. In order to prevent confusion, numbered
1801 (unnamed) backreferences are ignored. Use named groups instead.</p>
1803 <highlight language="config">
1804 <FilesMatch "^(?<sitename>[^/]+)">
1805 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1810 <seealso><a href="../sections.html">How <Directory>, <Location>
1811 and <Files> sections work</a> for an explanation of how these
1812 different sections are combined when a request is received</seealso>
1813 </directivesynopsis>
1816 <name>ForceType</name>
1817 <description>Forces all matching files to be served with the specified
1818 media type in the HTTP Content-Type header field</description>
1819 <syntax>ForceType <var>media-type</var>|None</syntax>
1820 <contextlist><context>directory</context><context>.htaccess</context>
1822 <override>FileInfo</override>
1825 <p>When placed into an <code>.htaccess</code> file or a
1826 <directive type="section" module="core">Directory</directive>, or
1827 <directive type="section" module="core">Location</directive> or
1828 <directive type="section" module="core">Files</directive>
1829 section, this directive forces all matching files to be served
1830 with the content type identification given by
1831 <var>media-type</var>. For example, if you had a directory full of
1832 GIF files, but did not want to label them all with <code>.gif</code>,
1833 you might want to use:</p>
1835 <highlight language="config">ForceType image/gif</highlight>
1837 <p>Note that this directive overrides other indirect media type
1838 associations defined in mime.types or via the
1839 <directive module="mod_mime">AddType</directive>.</p>
1841 <p>You can also override more general
1842 <directive>ForceType</directive> settings
1843 by using the value of <code>None</code>:</p>
1845 <highlight language="config">
1846 # force all files to be image/gif:
1847 <Location "/images">
1851 # but normal mime-type associations here:
1852 <Location "/images/mixed">
1857 <p>This directive primarily overrides the content types generated for
1858 static files served out of the filesystem. For resources other than
1859 static files, where the generator of the response typically specifies
1860 a Content-Type, this directive has no effect.</p>
1862 <note><title>Note</title>
1863 <p>When explicit directives such as
1864 <directive module="core" >SetHandler</directive> or
1865 <directive module="mod_mime">AddHandler</directive> do not apply
1866 to the current request, the internal handler name normally set by those
1867 directives is set to match the content type specified by this directive.
1868 This is a historical behavior that some third-party modules
1869 (such as mod_php) may use "magic" content types used only to signal the
1870 module to take responsibility for the matching request. Configurations
1871 that rely on such "magic" types should be avoided by the use of
1872 <directive module="core" >SetHandler</directive> or
1873 <directive module="mod_mime">AddHandler</directive>. </p>
1877 </directivesynopsis>
1879 <name>GprofDir</name>
1880 <description>Directory to write gmon.out profiling data to. </description>
1881 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1882 <contextlist><context>server config</context><context>virtual host</context>
1886 <p>When the server has been compiled with gprof profiling support,
1887 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1888 be written to the specified directory when the process exits. If the
1889 argument ends with a percent symbol ('%'), subdirectories are created
1890 for each process id.</p>
1892 <p>This directive currently only works with the <module>prefork</module>
1895 </directivesynopsis>
1898 <name>HostnameLookups</name>
1899 <description>Enables DNS lookups on client IP addresses</description>
1900 <syntax>HostnameLookups On|Off|Double</syntax>
1901 <default>HostnameLookups Off</default>
1902 <contextlist><context>server config</context><context>virtual host</context>
1903 <context>directory</context></contextlist>
1906 <p>This directive enables DNS lookups so that host names can be
1907 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1908 The value <code>Double</code> refers to doing double-reverse
1909 DNS lookup. That is, after a reverse lookup is performed, a forward
1910 lookup is then performed on that result. At least one of the IP
1911 addresses in the forward lookup must match the original
1912 address. (In "tcpwrappers" terminology this is called
1913 <code>PARANOID</code>.)</p>
1915 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1916 used for controlling access by hostname, a double reverse lookup
1917 will be performed. This is necessary for security. Note that the
1918 result of this double-reverse isn't generally available unless you
1919 set <code>HostnameLookups Double</code>. For example, if only
1920 <code>HostnameLookups On</code> and a request is made to an object
1921 that is protected by hostname restrictions, regardless of whether
1922 the double-reverse fails or not, CGIs will still be passed the
1923 single-reverse result in <code>REMOTE_HOST</code>.</p>
1925 <p>The default is <code>Off</code> in order to save the network
1926 traffic for those sites that don't truly need the reverse
1927 lookups done. It is also better for the end users because they
1928 don't have to suffer the extra latency that a lookup entails.
1929 Heavily loaded sites should leave this directive
1930 <code>Off</code>, since DNS lookups can take considerable
1931 amounts of time. The utility <program>logresolve</program>, compiled by
1932 default to the <code>bin</code> subdirectory of your installation
1933 directory, can be used to look up host names from logged IP addresses
1936 <p>Finally, if you have <a
1937 href="mod_authz_host.html#reqhost">hostname-based Require
1938 directives</a>, a hostname lookup will be performed regardless of
1939 the setting of <code>HostnameLookups</code>.</p>
1941 </directivesynopsis>
1943 <directivesynopsis type="section">
1945 <description>Contains directives that apply only if a condition is
1946 satisfied by a request at runtime</description>
1947 <syntax><If <var>expression</var>> ... </If></syntax>
1948 <contextlist><context>server config</context><context>virtual host</context>
1949 <context>directory</context><context>.htaccess</context>
1951 <override>All</override>
1954 <p>The <directive type="section">If</directive> directive
1955 evaluates an expression at runtime, and applies the enclosed
1956 directives if and only if the expression evaluates to true.
1959 <highlight language="config"><If "-z req('Host')"></highlight>
1961 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1962 Expressions may contain various shell-like operators for string
1963 comparison (<code>==</code>, <code>!=</code>, <code><</code>, ...),
1964 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1965 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1966 It is also possible to use regular expressions, </p>
1968 <highlight language="config"><If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"></highlight>
1970 <p>shell-like pattern matches and many other operations. These operations
1971 can be done on request headers (<code>req</code>), environment variables
1972 (<code>env</code>), and a large number of other properties. The full
1973 documentation is available in <a href="../expr.html">Expressions in
1974 Apache HTTP Server</a>.</p>
1976 <p>Only directives that support the <a href="directive-dict.html#Context"
1977 >directory context</a> can be used within this configuration section.</p>
1979 <note type="warning">
1980 Certain variables, such as <code>CONTENT_TYPE</code> and other
1981 response headers, are set after <If> conditions have already
1982 been evaluated, and so will not be available to use in this
1988 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1989 for a complete reference and more examples.</seealso>
1990 <seealso><directive type="section" module="core">ElseIf</directive></seealso>
1991 <seealso><directive type="section" module="core">Else</directive></seealso>
1992 <seealso><a href="../sections.html">How <Directory>, <Location>,
1993 <Files> sections work</a> for an explanation of how these
1994 different sections are combined when a request is received.
1995 <directive type="section">If</directive>,
1996 <directive type="section">ElseIf</directive>, and
1997 <directive type="section">Else</directive> are applied last.</seealso>
1998 </directivesynopsis>
2000 <directivesynopsis type="section">
2001 <name>IfDefine</name>
2002 <description>Encloses directives that will be processed only
2003 if a test is true at startup</description>
2004 <syntax><IfDefine [!]<var>parameter-name</var>> ...
2005 </IfDefine></syntax>
2006 <contextlist><context>server config</context><context>virtual host</context>
2007 <context>directory</context><context>.htaccess</context>
2009 <override>All</override>
2012 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
2013 </code> section is used to mark directives that are conditional. The
2014 directives within an <directive type="section">IfDefine</directive>
2015 section are only processed if the <var>test</var> is true. If <var>
2016 test</var> is false, everything between the start and end markers is
2019 <p>The <var>test</var> in the <directive type="section"
2020 >IfDefine</directive> section directive can be one of two forms:</p>
2023 <li><var>parameter-name</var></li>
2025 <li><code>!</code><var>parameter-name</var></li>
2028 <p>In the former case, the directives between the start and end
2029 markers are only processed if the parameter named
2030 <var>parameter-name</var> is defined. The second format reverses
2031 the test, and only processes the directives if
2032 <var>parameter-name</var> is <strong>not</strong> defined.</p>
2034 <p>The <var>parameter-name</var> argument is a define as given on the
2035 <program>httpd</program> command line via <code>-D<var>parameter</var>
2036 </code> at the time the server was started or by the <directive
2037 module="core">Define</directive> directive.</p>
2039 <p><directive type="section">IfDefine</directive> sections are
2040 nest-able, which can be used to implement simple
2041 multiple-parameter tests. Example:</p>
2043 <example>httpd -DReverseProxy -DUseCache -DMemCache ...</example>
2044 <highlight language="config">
2045 <IfDefine ReverseProxy>
2046 LoadModule proxy_module modules/mod_proxy.so
2047 LoadModule proxy_http_module modules/mod_proxy_http.so
2048 <IfDefine UseCache>
2049 LoadModule cache_module modules/mod_cache.so
2050 <IfDefine MemCache>
2051 LoadModule mem_cache_module modules/mod_mem_cache.so
2053 <IfDefine !MemCache>
2054 LoadModule cache_disk_module modules/mod_cache_disk.so
2060 </directivesynopsis>
2062 <directivesynopsis type="section">
2063 <name>IfModule</name>
2064 <description>Encloses directives that are processed conditional on the
2065 presence or absence of a specific module</description>
2066 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2067 </IfModule></syntax>
2068 <contextlist><context>server config</context><context>virtual host</context>
2069 <context>directory</context><context>.htaccess</context>
2071 <override>All</override>
2072 <compatibility>Module identifiers are available in version 2.1 and
2073 later.</compatibility>
2076 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
2077 section is used to mark directives that are conditional on the presence of
2078 a specific module. The directives within an <directive type="section"
2079 >IfModule</directive> section are only processed if the <var>test</var>
2080 is true. If <var>test</var> is false, everything between the start and
2081 end markers is ignored.</p>
2083 <p>The <var>test</var> in the <directive type="section"
2084 >IfModule</directive> section directive can be one of two forms:</p>
2087 <li><var>module</var></li>
2089 <li>!<var>module</var></li>
2092 <p>In the former case, the directives between the start and end
2093 markers are only processed if the module named <var>module</var>
2094 is included in Apache httpd -- either compiled in or
2095 dynamically loaded using <directive module="mod_so"
2096 >LoadModule</directive>. The second format reverses the test,
2097 and only processes the directives if <var>module</var> is
2098 <strong>not</strong> included.</p>
2100 <p>The <var>module</var> argument can be either the module identifier or
2101 the file name of the module, at the time it was compiled. For example,
2102 <code>rewrite_module</code> is the identifier and
2103 <code>mod_rewrite.c</code> is the file name. If a module consists of
2104 several source files, use the name of the file containing the string
2105 <code>STANDARD20_MODULE_STUFF</code>.</p>
2107 <p><directive type="section">IfModule</directive> sections are
2108 nest-able, which can be used to implement simple multiple-module
2111 <note>This section should only be used if you need to have one
2112 configuration file that works whether or not a specific module
2113 is available. In normal operation, directives need not be
2114 placed in <directive type="section">IfModule</directive>
2117 </directivesynopsis>
2120 <name>Include</name>
2121 <description>Includes other configuration files from within
2122 the server configuration files</description>
2123 <syntax>Include <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2124 <contextlist><context>server config</context><context>virtual host</context>
2125 <context>directory</context>
2127 <compatibility>Directory
2128 wildcard matching available in 2.3.6 and later</compatibility>
2131 <p>This directive allows inclusion of other configuration files
2132 from within the server configuration files.</p>
2134 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2135 in the filename or directory parts of the path to include several files
2136 at once, in alphabetical order. In addition, if
2137 <directive>Include</directive> points to a directory, rather than a file,
2138 Apache httpd will read all files in that directory and any subdirectory.
2139 However, including entire directories is not recommended, because it is
2140 easy to accidentally leave temporary files in a directory that can cause
2141 <program>httpd</program> to fail. Instead, we encourage you to use the
2142 wildcard syntax shown below, to include files that match a particular
2143 pattern, such as *.conf, for example.</p>
2145 <p>The <directive module="core">Include</directive> directive will
2146 <strong>fail with an error</strong> if a wildcard expression does not
2147 match any file. The <directive module="core">IncludeOptional</directive>
2148 directive can be used if non-matching wildcards should be ignored.</p>
2150 <p>The file path specified may be an absolute path, or may be relative
2151 to the <directive module="core">ServerRoot</directive> directory.</p>
2155 <highlight language="config">
2156 Include /usr/local/apache2/conf/ssl.conf
2157 Include /usr/local/apache2/conf/vhosts/*.conf
2160 <p>Or, providing paths relative to your <directive
2161 module="core">ServerRoot</directive> directory:</p>
2163 <highlight language="config">
2164 Include conf/ssl.conf
2165 Include conf/vhosts/*.conf
2168 <p>Wildcards may be included in the directory or file portion of the
2169 path. This example will fail if there is no subdirectory in conf/vhosts
2170 that contains at least one *.conf file:</p>
2172 <highlight language="config">Include conf/vhosts/*/*.conf</highlight>
2174 <p>Alternatively, the following command will just be ignored in case of
2175 missing files or directories:</p>
2177 <highlight language="config">IncludeOptional conf/vhosts/*/*.conf</highlight>
2181 <seealso><directive module="core">IncludeOptional</directive></seealso>
2182 <seealso><program>apachectl</program></seealso>
2183 </directivesynopsis>
2186 <name>IncludeOptional</name>
2187 <description>Includes other configuration files from within
2188 the server configuration files</description>
2189 <syntax>IncludeOptional <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
2190 <contextlist><context>server config</context><context>virtual host</context>
2191 <context>directory</context>
2193 <compatibility>Available in 2.3.6 and later</compatibility>
2196 <p>This directive allows inclusion of other configuration files
2197 from within the server configuration files. It works identically to the
2198 <directive module="core">Include</directive> directive, with the
2199 exception that if wildcards do not match any file or directory, the
2200 <directive module="core">IncludeOptional</directive> directive will be
2201 silently ignored instead of causing an error.</p>
2204 <seealso><directive module="core">Include</directive></seealso>
2205 <seealso><program>apachectl</program></seealso>
2206 </directivesynopsis>
2209 <name>KeepAlive</name>
2210 <description>Enables HTTP persistent connections</description>
2211 <syntax>KeepAlive On|Off</syntax>
2212 <default>KeepAlive On</default>
2213 <contextlist><context>server config</context><context>virtual host</context>
2217 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2218 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2219 which allow multiple requests to be sent over the same TCP
2220 connection. In some cases this has been shown to result in an
2221 almost 50% speedup in latency times for HTML documents with
2222 many images. To enable Keep-Alive connections, set
2223 <code>KeepAlive On</code>.</p>
2225 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2226 used if they are specifically requested by a client. In
2227 addition, a Keep-Alive connection with an HTTP/1.0 client can
2228 only be used when the length of the content is known in
2229 advance. This implies that dynamic content such as CGI output,
2230 SSI pages, and server-generated directory listings will
2231 generally not use Keep-Alive connections to HTTP/1.0 clients.
2232 For HTTP/1.1 clients, persistent connections are the default
2233 unless otherwise specified. If the client requests it, chunked
2234 encoding will be used in order to send content of unknown
2235 length over persistent connections.</p>
2237 <p>When a client uses a Keep-Alive connection, it will be counted
2238 as a single "request" for the <directive module="mpm_common"
2239 >MaxConnectionsPerChild</directive> directive, regardless
2240 of how many requests are sent using the connection.</p>
2243 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
2244 </directivesynopsis>
2247 <name>KeepAliveTimeout</name>
2248 <description>Amount of time the server will wait for subsequent
2249 requests on a persistent connection</description>
2250 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
2251 <default>KeepAliveTimeout 5</default>
2252 <contextlist><context>server config</context><context>virtual host</context>
2256 <p>The number of seconds Apache httpd will wait for a subsequent
2257 request before closing the connection. By adding a postfix of ms the
2258 timeout can be also set in milliseconds. Once a request has been
2259 received, the timeout value specified by the
2260 <directive module="core">Timeout</directive> directive applies.</p>
2262 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
2263 may cause performance problems in heavily loaded servers. The
2264 higher the timeout, the more server processes will be kept
2265 occupied waiting on connections with idle clients.</p>
2267 <p>If <directive>KeepAliveTimeout</directive> is <strong>not</strong>
2268 set for a name-based virtual host, the value of the first defined
2269 virtual host best matching the local IP and port will be used.</p>
2271 </directivesynopsis>
2273 <directivesynopsis type="section">
2275 <description>Restrict enclosed access controls to only certain HTTP
2276 methods</description>
2277 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
2278 </Limit></syntax>
2279 <contextlist><context>directory</context><context>.htaccess</context>
2281 <override>AuthConfig, Limit</override>
2284 <p>Access controls are normally effective for
2285 <strong>all</strong> access methods, and this is the usual
2286 desired behavior. <strong>In the general case, access control
2287 directives should not be placed within a
2288 <directive type="section">Limit</directive> section.</strong></p>
2290 <p>The purpose of the <directive type="section">Limit</directive>
2291 directive is to restrict the effect of the access controls to the
2292 nominated HTTP methods. For all other methods, the access
2293 restrictions that are enclosed in the <directive
2294 type="section">Limit</directive> bracket <strong>will have no
2295 effect</strong>. The following example applies the access control
2296 only to the methods <code>POST</code>, <code>PUT</code>, and
2297 <code>DELETE</code>, leaving all other methods unprotected:</p>
2299 <highlight language="config">
2300 <Limit POST PUT DELETE>
2305 <p>The method names listed can be one or more of: <code>GET</code>,
2306 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2307 <code>CONNECT</code>, <code>OPTIONS</code>,
2308 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2309 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2310 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2311 case-sensitive.</strong> If <code>GET</code> is used, it will also
2312 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2313 cannot be limited (see <directive module="core"
2314 >TraceEnable</directive>).</p>
2316 <note type="warning">A <directive type="section"
2317 module="core">LimitExcept</directive> section should always be
2318 used in preference to a <directive type="section">Limit</directive>
2319 section when restricting access, since a <directive type="section"
2320 module="core">LimitExcept</directive> section provides protection
2321 against arbitrary methods.</note>
2323 <p>The <directive type="section">Limit</directive> and
2324 <directive type="section" module="core">LimitExcept</directive>
2325 directives may be nested. In this case, each successive level of
2326 <directive type="section">Limit</directive> or <directive
2327 type="section" module="core">LimitExcept</directive> directives must
2328 further restrict the set of methods to which access controls apply.</p>
2330 <note type="warning">When using
2331 <directive type="section">Limit</directive> or
2332 <directive type="section">LimitExcept</directive> directives with
2333 the <directive module="mod_authz_core">Require</directive> directive,
2334 note that the first <directive module="mod_authz_core">Require</directive>
2335 to succeed authorizes the request, regardless of the presence of other
2336 <directive module="mod_authz_core">Require</directive> directives.</note>
2338 <p>For example, given the following configuration, all users will
2339 be authorized for <code>POST</code> requests, and the
2340 <code>Require group editors</code> directive will be ignored
2343 <highlight language="config">
2344 <LimitExcept GET>
2346 </LimitExcept>
2348 Require group editors
2352 </directivesynopsis>
2354 <directivesynopsis type="section">
2355 <name>LimitExcept</name>
2356 <description>Restrict access controls to all HTTP methods
2357 except the named ones</description>
2358 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2359 </LimitExcept></syntax>
2360 <contextlist><context>directory</context><context>.htaccess</context>
2362 <override>AuthConfig, Limit</override>
2365 <p><directive type="section">LimitExcept</directive> and
2366 <code></LimitExcept></code> are used to enclose
2367 a group of access control directives which will then apply to any
2368 HTTP access method <strong>not</strong> listed in the arguments;
2369 i.e., it is the opposite of a <directive type="section"
2370 module="core">Limit</directive> section and can be used to control
2371 both standard and nonstandard/unrecognized methods. See the
2372 documentation for <directive module="core"
2373 type="section">Limit</directive> for more details.</p>
2377 <highlight language="config">
2378 <LimitExcept POST GET>
2380 </LimitExcept>
2384 </directivesynopsis>
2387 <name>LimitInternalRecursion</name>
2388 <description>Determine maximum number of internal redirects and nested
2389 subrequests</description>
2390 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2391 <default>LimitInternalRecursion 10</default>
2392 <contextlist><context>server config</context><context>virtual host</context>
2396 <p>An internal redirect happens, for example, when using the <directive
2397 module="mod_actions">Action</directive> directive, which internally
2398 redirects the original request to a CGI script. A subrequest is Apache httpd's
2399 mechanism to find out what would happen for some URI if it were requested.
2400 For example, <module>mod_dir</module> uses subrequests to look for the
2401 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2404 <p><directive>LimitInternalRecursion</directive> prevents the server
2405 from crashing when entering an infinite loop of internal redirects or
2406 subrequests. Such loops are usually caused by misconfigurations.</p>
2408 <p>The directive stores two different limits, which are evaluated on
2409 per-request basis. The first <var>number</var> is the maximum number of
2410 internal redirects that may follow each other. The second <var>number</var>
2411 determines how deeply subrequests may be nested. If you specify only one
2412 <var>number</var>, it will be assigned to both limits.</p>
2414 <highlight language="config">LimitInternalRecursion 5</highlight>
2416 </directivesynopsis>
2419 <name>LimitRequestBody</name>
2420 <description>Restricts the total size of the HTTP request body sent
2421 from the client</description>
2422 <syntax>LimitRequestBody <var>bytes</var></syntax>
2423 <default>LimitRequestBody 0</default>
2424 <contextlist><context>server config</context><context>virtual host</context>
2425 <context>directory</context><context>.htaccess</context>
2427 <override>All</override>
2430 <p>This directive specifies the number of <var>bytes</var> from 0
2431 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2432 request body. See the note below for the limited applicability
2433 to proxy requests.</p>
2435 <p>The <directive>LimitRequestBody</directive> directive allows
2436 the user to set a limit on the allowed size of an HTTP request
2437 message body within the context in which the directive is given
2438 (server, per-directory, per-file or per-location). If the client
2439 request exceeds that limit, the server will return an error
2440 response instead of servicing the request. The size of a normal
2441 request message body will vary greatly depending on the nature of
2442 the resource and the methods allowed on that resource. CGI scripts
2443 typically use the message body for retrieving form information.
2444 Implementations of the <code>PUT</code> method will require
2445 a value at least as large as any representation that the server
2446 wishes to accept for that resource.</p>
2448 <p>This directive gives the server administrator greater
2449 control over abnormal client request behavior, which may be
2450 useful for avoiding some forms of denial-of-service
2453 <p>If, for example, you are permitting file upload to a particular
2454 location and wish to limit the size of the uploaded file to 100K,
2455 you might use the following directive:</p>
2457 <highlight language="config">LimitRequestBody 102400</highlight>
2459 <note><p>For a full description of how this directive is interpreted by
2460 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2464 </directivesynopsis>
2467 <name>LimitRequestFields</name>
2468 <description>Limits the number of HTTP request header fields that
2469 will be accepted from the client</description>
2470 <syntax>LimitRequestFields <var>number</var></syntax>
2471 <default>LimitRequestFields 100</default>
2472 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2475 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2476 32767. The default value is defined by the compile-time
2477 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2480 <p>The <directive>LimitRequestFields</directive> directive allows
2481 the server administrator to modify the limit on the number of
2482 request header fields allowed in an HTTP request. A server needs
2483 this value to be larger than the number of fields that a normal
2484 client request might include. The number of request header fields
2485 used by a client rarely exceeds 20, but this may vary among
2486 different client implementations, often depending upon the extent
2487 to which a user has configured their browser to support detailed
2488 content negotiation. Optional HTTP extensions are often expressed
2489 using request header fields.</p>
2491 <p>This directive gives the server administrator greater
2492 control over abnormal client request behavior, which may be
2493 useful for avoiding some forms of denial-of-service attacks.
2494 The value should be increased if normal clients see an error
2495 response from the server that indicates too many fields were
2496 sent in the request.</p>
2500 <highlight language="config">LimitRequestFields 50</highlight>
2502 <note type="warning"><title>Warning</title>
2503 <p> When name-based virtual hosting is used, the value for this
2504 directive is taken from the default (first-listed) virtual host for the
2505 local IP and port combination.</p>
2509 </directivesynopsis>
2512 <name>LimitRequestFieldSize</name>
2513 <description>Limits the size of the HTTP request header allowed from the
2514 client</description>
2515 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2516 <default>LimitRequestFieldSize 8190</default>
2517 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2520 <p>This directive specifies the number of <var>bytes</var>
2521 that will be allowed in an HTTP request header.</p>
2523 <p>The <directive>LimitRequestFieldSize</directive> directive
2524 allows the server administrator to set the limit
2525 on the allowed size of an HTTP request header field. A server
2526 needs this value to be large enough to hold any one header field
2527 from a normal client request. The size of a normal request header
2528 field will vary greatly among different client implementations,
2529 often depending upon the extent to which a user has configured
2530 their browser to support detailed content negotiation. SPNEGO
2531 authentication headers can be up to 12392 bytes.</p>
2533 <p>This directive gives the server administrator greater
2534 control over abnormal client request behavior, which may be
2535 useful for avoiding some forms of denial-of-service attacks.</p>
2539 <highlight language="config">LimitRequestFieldSize 4094</highlight>
2541 <note>Under normal conditions, the value should not be changed from
2544 <note type="warning"><title>Warning</title>
2545 <p> When name-based virtual hosting is used, the value for this
2546 directive is taken from the default (first-listed) virtual host best
2547 matching the current IP address and port combination.</p>
2550 </directivesynopsis>
2553 <name>LimitRequestLine</name>
2554 <description>Limit the size of the HTTP request line that will be accepted
2555 from the client</description>
2556 <syntax>LimitRequestLine <var>bytes</var></syntax>
2557 <default>LimitRequestLine 8190</default>
2558 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2561 <p>This directive sets the number of <var>bytes</var> that will be
2562 allowed on the HTTP request-line.</p>
2564 <p>The <directive>LimitRequestLine</directive> directive allows
2565 the server administrator to set the limit on the allowed size
2566 of a client's HTTP request-line. Since the request-line consists of the
2567 HTTP method, URI, and protocol version, the
2568 <directive>LimitRequestLine</directive> directive places a
2569 restriction on the length of a request-URI allowed for a request
2570 on the server. A server needs this value to be large enough to
2571 hold any of its resource names, including any information that
2572 might be passed in the query part of a <code>GET</code> request.</p>
2574 <p>This directive gives the server administrator greater
2575 control over abnormal client request behavior, which may be
2576 useful for avoiding some forms of denial-of-service attacks.</p>
2580 <highlight language="config">LimitRequestLine 4094</highlight>
2582 <note>Under normal conditions, the value should not be changed from
2585 <note type="warning"><title>Warning</title>
2586 <p> When name-based virtual hosting is used, the value for this
2587 directive is taken from the default (first-listed) virtual host best
2588 matching the current IP address and port combination.</p>
2592 </directivesynopsis>
2595 <name>LimitXMLRequestBody</name>
2596 <description>Limits the size of an XML-based request body</description>
2597 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2598 <default>LimitXMLRequestBody 1000000</default>
2599 <contextlist><context>server config</context><context>virtual host</context>
2600 <context>directory</context><context>.htaccess</context></contextlist>
2601 <override>All</override>
2604 <p>Limit (in bytes) on maximum size of an XML-based request
2605 body. A value of <code>0</code> will disable any checking.</p>
2609 <highlight language="config">LimitXMLRequestBody 0</highlight>
2612 </directivesynopsis>
2614 <directivesynopsis type="section">
2615 <name>Location</name>
2616 <description>Applies the enclosed directives only to matching
2618 <syntax><Location
2619 "<var>URL-path</var>|<var>URL</var>"> ... </Location></syntax>
2620 <contextlist><context>server config</context><context>virtual host</context>
2624 <p>The <directive type="section">Location</directive> directive
2625 limits the scope of the enclosed directives by URL. It is similar to the
2626 <directive type="section" module="core">Directory</directive>
2627 directive, and starts a subsection which is terminated with a
2628 <code></Location></code> directive. <directive
2629 type="section">Location</directive> sections are processed in the
2630 order they appear in the configuration file, after the <directive
2631 type="section" module="core">Directory</directive> sections and
2632 <code>.htaccess</code> files are read, and after the <directive
2633 type="section" module="core">Files</directive> sections.</p>
2635 <p><directive type="section">Location</directive> sections operate
2636 completely outside the filesystem. This has several consequences.
2637 Most importantly, <directive type="section">Location</directive>
2638 directives should not be used to control access to filesystem
2639 locations. Since several different URLs may map to the same
2640 filesystem location, such access controls may by circumvented.</p>
2642 <p>The enclosed directives will be applied to the request if the path component
2643 of the URL meets <em>any</em> of the following criteria:
2646 <li>The specified location matches exactly the path component of the URL.
2648 <li>The specified location, which ends in a forward slash, is a prefix
2649 of the path component of the URL (treated as a context root).
2651 <li>The specified location, with the addition of a trailing slash, is a
2652 prefix of the path component of the URL (also treated as a context root).
2656 In the example below, where no trailing slash is used, requests to
2657 /private1, /private1/ and /private1/file.txt will have the enclosed
2658 directives applied, but /private1other would not.
2660 <highlight language="config">
2661 <Location "/private1">
2666 In the example below, where a trailing slash is used, requests to
2667 /private2/ and /private2/file.txt will have the enclosed
2668 directives applied, but /private2 and /private2other would not.
2670 <highlight language="config">
2671 <Location "/private2<em>/</em>">
2676 <note><title>When to use <directive
2677 type="section">Location</directive></title>
2679 <p>Use <directive type="section">Location</directive> to apply
2680 directives to content that lives outside the filesystem. For
2681 content that lives in the filesystem, use <directive
2682 type="section" module="core">Directory</directive> and <directive
2683 type="section" module="core">Files</directive>. An exception is
2684 <code><Location "/"></code>, which is an easy way to
2685 apply a configuration to the entire server.</p>
2688 <p>For all origin (non-proxy) requests, the URL to be matched is a
2689 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2690 port, or query string may be included.</em> For proxy requests, the
2691 URL to be matched is of the form
2692 <code>scheme://servername/path</code>, and you must include the
2695 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2696 any single character, and <code>*</code> matches any sequences of
2697 characters. Neither wildcard character matches a / in the URL-path.</p>
2699 <p><glossary ref="regex">Regular expressions</glossary>
2700 can also be used, with the addition of the <code>~</code>
2701 character. For example:</p>
2703 <highlight language="config">
2704 <Location ~ "/(extra|special)/data">
2709 <p>would match URLs that contained the substring <code>/extra/data</code>
2710 or <code>/special/data</code>. The directive <directive
2711 type="section" module="core">LocationMatch</directive> behaves
2712 identical to the regex version of <directive
2713 type="section">Location</directive>, and is preferred, for the
2714 simple reason that <code>~</code> is hard to distinguish from
2715 <code>-</code> in many fonts.</p>
2717 <p>The <directive type="section">Location</directive>
2718 functionality is especially useful when combined with the
2719 <directive module="core">SetHandler</directive>
2720 directive. For example, to enable status requests but allow them
2721 only from browsers at <code>example.com</code>, you might use:</p>
2723 <highlight language="config">
2724 <Location "/status">
2725 SetHandler server-status
2726 Require host example.com
2730 <note><title>Note about / (slash)</title>
2731 <p>The slash character has special meaning depending on where in a
2732 URL it appears. People may be used to its behavior in the filesystem
2733 where multiple adjacent slashes are frequently collapsed to a single
2734 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2735 <code>/home/foo</code>). In URL-space this is not necessarily true.
2736 The <directive type="section" module="core">LocationMatch</directive>
2737 directive and the regex version of <directive type="section"
2738 >Location</directive> require you to explicitly specify multiple
2739 slashes if that is your intention.</p>
2741 <p>For example, <code><LocationMatch "^/abc"></code> would match
2742 the request URL <code>/abc</code> but not the request URL <code>
2743 //abc</code>. The (non-regex) <directive type="section"
2744 >Location</directive> directive behaves similarly when used for
2745 proxy requests. But when (non-regex) <directive type="section"
2746 >Location</directive> is used for non-proxy requests it will
2747 implicitly match multiple slashes with a single slash. For example,
2748 if you specify <code><Location "/abc/def"></code> and the
2749 request is to <code>/abc//def</code> then it will match.</p>
2752 <seealso><a href="../sections.html">How <Directory>, <Location>
2753 and <Files> sections work</a> for an explanation of how these
2754 different sections are combined when a request is received.</seealso>
2755 <seealso><directive module="core">LocationMatch</directive></seealso>
2756 </directivesynopsis>
2758 <directivesynopsis type="section">
2759 <name>LocationMatch</name>
2760 <description>Applies the enclosed directives only to regular-expression
2761 matching URLs</description>
2762 <syntax><LocationMatch
2763 <var>regex</var>> ... </LocationMatch></syntax>
2764 <contextlist><context>server config</context><context>virtual host</context>
2768 <p>The <directive type="section">LocationMatch</directive> directive
2769 limits the scope of the enclosed directives by URL, in an identical manner
2770 to <directive module="core" type="section">Location</directive>. However,
2771 it takes a <glossary ref="regex">regular expression</glossary>
2772 as an argument instead of a simple string. For example:</p>
2774 <highlight language="config">
2775 <LocationMatch "/(extra|special)/data">
2777 </LocationMatch>
2780 <p>would match URLs that contained the substring <code>/extra/data</code>
2781 or <code>/special/data</code>.</p>
2783 <note><p>If the intent is that a URL <strong>starts with</strong>
2784 <code>/extra/data</code>, rather than merely
2785 <strong>contains</strong> <code>/extra/data</code>, prefix the
2786 regular expression with a <code>^</code> to require this.</p>
2788 <highlight language="config">
2789 <LocationMatch "^/(extra|special)/data">
2793 <p>From 2.4.8 onwards, named groups and backreferences are captured and
2794 written to the environment with the corresponding name prefixed with
2795 "MATCH_" and in upper case. This allows elements of URLs to be referenced
2796 from within <a href="../expr.html">expressions</a> and modules like
2797 <module>mod_rewrite</module>. In order to prevent confusion, numbered
2798 (unnamed) backreferences are ignored. Use named groups instead.</p>
2800 <highlight language="config">
2801 <LocationMatch "^/combined/(?<sitename>[^/]+)">
2802 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
2803 </LocationMatch>
2807 <seealso><a href="../sections.html">How <Directory>, <Location>
2808 and <Files> sections work</a> for an explanation of how these
2809 different sections are combined when a request is received</seealso>
2810 </directivesynopsis>
2813 <name>LogLevel</name>
2814 <description>Controls the verbosity of the ErrorLog</description>
2815 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2816 [<var>module</var>:<var>level</var>] ...
2818 <default>LogLevel warn</default>
2819 <contextlist><context>server config</context><context>virtual host</context>
2820 <context>directory</context>
2822 <compatibility>Per-module and per-directory configuration is available in
2823 Apache HTTP Server 2.3.6 and later</compatibility>
2826 <p><directive>LogLevel</directive> adjusts the verbosity of the
2827 messages recorded in the error logs (see <directive
2828 module="core">ErrorLog</directive> directive). The following
2829 <var>level</var>s are available, in order of decreasing
2833 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2836 <th><strong>Level</strong> </th>
2838 <th><strong>Description</strong> </th>
2840 <th><strong>Example</strong> </th>
2844 <td><code>emerg</code> </td>
2846 <td>Emergencies - system is unusable.</td>
2848 <td>"Child cannot open lock file. Exiting"</td>
2852 <td><code>alert</code> </td>
2854 <td>Action must be taken immediately.</td>
2856 <td>"getpwuid: couldn't determine user name from uid"</td>
2860 <td><code>crit</code> </td>
2862 <td>Critical Conditions.</td>
2864 <td>"socket: Failed to get a socket, exiting child"</td>
2868 <td><code>error</code> </td>
2870 <td>Error conditions.</td>
2872 <td>"Premature end of script headers"</td>
2876 <td><code>warn</code> </td>
2878 <td>Warning conditions.</td>
2880 <td>"child process 1234 did not exit, sending another
2885 <td><code>notice</code> </td>
2887 <td>Normal but significant condition.</td>
2889 <td>"httpd: caught SIGBUS, attempting to dump core in
2894 <td><code>info</code> </td>
2896 <td>Informational.</td>
2898 <td>"Server seems busy, (you may need to increase
2899 StartServers, or Min/MaxSpareServers)..."</td>
2903 <td><code>debug</code> </td>
2905 <td>Debug-level messages</td>
2907 <td>"Opening config file ..."</td>
2910 <td><code>trace1</code> </td>
2912 <td>Trace messages</td>
2914 <td>"proxy: FTP: control connection complete"</td>
2917 <td><code>trace2</code> </td>
2919 <td>Trace messages</td>
2921 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2924 <td><code>trace3</code> </td>
2926 <td>Trace messages</td>
2928 <td>"openssl: Handshake: start"</td>
2931 <td><code>trace4</code> </td>
2933 <td>Trace messages</td>
2935 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2938 <td><code>trace5</code> </td>
2940 <td>Trace messages</td>
2942 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2945 <td><code>trace6</code> </td>
2947 <td>Trace messages</td>
2949 <td>"cache lookup FAILED, forcing new map lookup"</td>
2952 <td><code>trace7</code> </td>
2954 <td>Trace messages, dumping large amounts of data</td>
2956 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2959 <td><code>trace8</code> </td>
2961 <td>Trace messages, dumping large amounts of data</td>
2963 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2967 <p>When a particular level is specified, messages from all
2968 other levels of higher significance will be reported as well.
2969 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2970 then messages with log levels of <code>notice</code> and
2971 <code>warn</code> will also be posted.</p>
2973 <p>Using a level of at least <code>crit</code> is
2978 <highlight language="config">LogLevel notice</highlight>
2980 <note><title>Note</title>
2981 <p>When logging to a regular file, messages of the level
2982 <code>notice</code> cannot be suppressed and thus are always
2983 logged. However, this doesn't apply when logging is done
2984 using <code>syslog</code>.</p>
2987 <p>Specifying a level without a module name will reset the level
2988 for all modules to that level. Specifying a level with a module
2989 name will set the level for that module only. It is possible to
2990 use the module source file name, the module identifier, or the
2991 module identifier with the trailing <code>_module</code> omitted
2992 as module specification. This means the following three specifications
2995 <highlight language="config">
2996 LogLevel info ssl:warn
2997 LogLevel info mod_ssl.c:warn
2998 LogLevel info ssl_module:warn
3001 <p>It is also possible to change the level per directory:</p>
3003 <highlight language="config">
3005 <Directory "/usr/local/apache/htdocs/app">
3011 Per directory loglevel configuration only affects messages that are
3012 logged after the request has been parsed and that are associated with
3013 the request. Log messages which are associated with the connection or
3014 the server are not affected.
3017 <seealso><directive module="core">ErrorLog</directive></seealso>
3018 <seealso><directive module="core">ErrorLogFormat</directive></seealso>
3019 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
3020 </directivesynopsis>
3023 <name>MaxKeepAliveRequests</name>
3024 <description>Number of requests allowed on a persistent
3025 connection</description>
3026 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
3027 <default>MaxKeepAliveRequests 100</default>
3028 <contextlist><context>server config</context><context>virtual host</context>
3032 <p>The <directive>MaxKeepAliveRequests</directive> directive
3033 limits the number of requests allowed per connection when
3034 <directive module="core" >KeepAlive</directive> is on. If it is
3035 set to <code>0</code>, unlimited requests will be allowed. We
3036 recommend that this setting be kept to a high value for maximum
3037 server performance.</p>
3041 <highlight language="config">MaxKeepAliveRequests 500</highlight>
3043 </directivesynopsis>
3046 <name>MaxRanges</name>
3047 <description>Number of ranges allowed before returning the complete
3048 resource </description>
3049 <syntax>MaxRanges default | unlimited | none | <var>number-of-ranges</var></syntax>
3050 <default>MaxRanges 200</default>
3051 <contextlist><context>server config</context><context>virtual host</context>
3052 <context>directory</context>
3054 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3057 <p>The <directive>MaxRanges</directive> directive
3058 limits the number of HTTP ranges the server is willing to
3059 return to the client. If more ranges than permitted are requested,
3060 the complete resource is returned instead.</p>
3063 <dt><strong>default</strong></dt>
3064 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3066 <dt><strong>none</strong></dt>
3067 <dd>Range headers are ignored.</dd>
3069 <dt><strong>unlimited</strong></dt>
3070 <dd>The server does not limit the number of ranges it is
3071 willing to satisfy.</dd>
3073 <dt><var>number-of-ranges</var></dt>
3074 <dd>A positive number representing the maximum number of ranges the
3075 server is willing to satisfy.</dd>
3078 </directivesynopsis>
3081 <name>MaxRangeOverlaps</name>
3082 <description>Number of overlapping ranges (eg: <code>100-200,150-300</code>) allowed before returning the complete
3083 resource </description>
3084 <syntax>MaxRangeOverlaps default | unlimited | none | <var>number-of-ranges</var></syntax>
3085 <default>MaxRangeOverlaps 20</default>
3086 <contextlist><context>server config</context><context>virtual host</context>
3087 <context>directory</context>
3089 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3092 <p>The <directive>MaxRangeOverlaps</directive> directive
3093 limits the number of overlapping HTTP ranges the server is willing to
3094 return to the client. If more overlapping ranges than permitted are requested,
3095 the complete resource is returned instead.</p>
3098 <dt><strong>default</strong></dt>
3099 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3101 <dt><strong>none</strong></dt>
3102 <dd>No overlapping Range headers are allowed.</dd>
3104 <dt><strong>unlimited</strong></dt>
3105 <dd>The server does not limit the number of overlapping ranges it is
3106 willing to satisfy.</dd>
3108 <dt><var>number-of-ranges</var></dt>
3109 <dd>A positive number representing the maximum number of overlapping ranges the
3110 server is willing to satisfy.</dd>
3113 </directivesynopsis>
3116 <name>MaxRangeReversals</name>
3117 <description>Number of range reversals (eg: <code>100-200,50-70</code>) allowed before returning the complete
3118 resource </description>
3119 <syntax>MaxRangeReversals default | unlimited | none | <var>number-of-ranges</var></syntax>
3120 <default>MaxRangeReversals 20</default>
3121 <contextlist><context>server config</context><context>virtual host</context>
3122 <context>directory</context>
3124 <compatibility>Available in Apache HTTP Server 2.3.15 and later</compatibility>
3127 <p>The <directive>MaxRangeReversals</directive> directive
3128 limits the number of HTTP Range reversals the server is willing to
3129 return to the client. If more ranges reversals than permitted are requested,
3130 the complete resource is returned instead.</p>
3133 <dt><strong>default</strong></dt>
3134 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3136 <dt><strong>none</strong></dt>
3137 <dd>No Range reversals headers are allowed.</dd>
3139 <dt><strong>unlimited</strong></dt>
3140 <dd>The server does not limit the number of range reversals it is
3141 willing to satisfy.</dd>
3143 <dt><var>number-of-ranges</var></dt>
3144 <dd>A positive number representing the maximum number of range reversals the
3145 server is willing to satisfy.</dd>
3148 </directivesynopsis>
3152 <description>Configures mutex mechanism and lock file directory for all
3153 or specified mutexes</description>
3154 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
3155 <default>Mutex default</default>
3156 <contextlist><context>server config</context></contextlist>
3157 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
3160 <p>The <directive>Mutex</directive> directive sets the mechanism,
3161 and optionally the lock file location, that httpd and modules use
3162 to serialize access to resources. Specify <code>default</code> as
3163 the second argument to change the settings for all mutexes; specify
3164 a mutex name (see table below) as the second argument to override
3165 defaults only for that mutex.</p>
3167 <p>The <directive>Mutex</directive> directive is typically used in
3168 the following exceptional situations:</p>
3171 <li>change the mutex mechanism when the default mechanism selected
3172 by <glossary>APR</glossary> has a functional or performance
3175 <li>change the directory used by file-based mutexes when the
3176 default directory does not support locking</li>
3179 <note><title>Supported modules</title>
3180 <p>This directive only configures mutexes which have been registered
3181 with the core server using the <code>ap_mutex_register()</code> API.
3182 All modules bundled with httpd support the <directive>Mutex</directive>
3183 directive, but third-party modules may not. Consult the documentation
3184 of the third-party module, which must indicate the mutex name(s) which
3185 can be configured if this directive is supported.</p>
3188 <p>The following mutex <em>mechanisms</em> are available:</p>
3190 <li><code>default | yes</code>
3191 <p>This selects the default locking implementation, as determined by
3192 <glossary>APR</glossary>. The default locking implementation can
3193 be displayed by running <program>httpd</program> with the
3194 <code>-V</code> option.</p></li>
3196 <li><code>none | no</code>
3197 <p>This effectively disables the mutex, and is only allowed for a
3198 mutex if the module indicates that it is a valid choice. Consult the
3199 module documentation for more information.</p></li>
3201 <li><code>posixsem</code>
3202 <p>This is a mutex variant based on a Posix semaphore.</p>
3204 <note type="warning"><title>Warning</title>
3205 <p>The semaphore ownership is not recovered if a thread in the process
3206 holding the mutex segfaults, resulting in a hang of the web server.</p>
3210 <li><code>sysvsem</code>
3211 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3213 <note type="warning"><title>Warning</title>
3214 <p>It is possible to "leak" SysV semaphores if processes crash
3215 before the semaphore is removed.</p>
3218 <note type="warning"><title>Security</title>
3219 <p>The semaphore API allows for a denial of service attack by any
3220 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3221 all CGIs, unless you use something like <program>suexec</program>
3222 or <code>cgiwrapper</code>).</p>
3226 <li><code>sem</code>
3227 <p>This selects the "best" available semaphore implementation, choosing
3228 between Posix and SystemV IPC semaphores, in that order.</p></li>
3230 <li><code>pthread</code>
3231 <p>This is a mutex variant based on cross-process Posix thread
3234 <note type="warning"><title>Warning</title>
3235 <p>On most systems, if a child process terminates abnormally while
3236 holding a mutex that uses this implementation, the server will deadlock
3237 and stop responding to requests. When this occurs, the server will
3238 require a manual restart to recover.</p>
3239 <p>Solaris is a notable exception as it provides a mechanism which
3240 usually allows the mutex to be recovered after a child process
3241 terminates abnormally while holding a mutex.</p>
3242 <p>If your system implements the
3243 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3244 to use the <code>pthread</code> option safely.</p>
3248 <li><code>fcntl:/path/to/mutex</code>
3249 <p>This is a mutex variant where a physical (lock-)file and the
3250 <code>fcntl()</code> function are used as the mutex.</p>
3252 <note type="warning"><title>Warning</title>
3253 <p>When multiple mutexes based on this mechanism are used within
3254 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3255 can be reported for valid mutex operations if <code>fcntl()</code>
3256 is not thread-aware, such as on Solaris.</p>
3260 <li><code>flock:/path/to/mutex</code>
3261 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3262 with the exception that the <code>flock()</code> function is used to
3263 provide file locking.</p></li>
3265 <li><code>file:/path/to/mutex</code>
3266 <p>This selects the "best" available file locking implementation,
3267 choosing between <code>fcntl</code> and <code>flock</code>, in that
3271 <p>Most mechanisms are only available on selected platforms, where the
3272 underlying platform and <glossary>APR</glossary> support it. Mechanisms
3273 which aren't available on all platforms are <em>posixsem</em>,
3274 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3275 <em>flock</em>, and <em>file</em>.</p>
3277 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3278 the path, if provided, is a directory where the lock file will be created.
3279 The default directory is httpd's run-time file directory relative to
3280 <directive module="core">ServerRoot</directive>. Always use a local disk
3281 filesystem for <code>/path/to/mutex</code> and never a directory residing
3282 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3283 type, an optional instance string provided by the module, and unless the
3284 <code>OmitPID</code> keyword is specified, the process id of the httpd
3285 parent process will be appended to make the file name unique, avoiding
3286 conflicts when multiple httpd instances share a lock file directory. For
3287 example, if the mutex name is <code>mpm-accept</code> and the lock file
3288 directory is <code>/var/httpd/locks</code>, the lock file name for the
3289 httpd instance with parent process id 12345 would be
3290 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3292 <note type="warning"><title>Security</title>
3293 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3294 directory such as <code>/var/tmp</code> because someone could create
3295 a denial of service attack and prevent the server from starting by
3296 creating a lockfile with the same name as the one the server will try
3300 <p>The following table documents the names of mutexes used by httpd
3301 and bundled modules.</p>
3303 <table border="1" style="zebra">
3307 <th>Protected resource</th>
3310 <td><code>mpm-accept</code></td>
3311 <td><module>prefork</module> and <module>worker</module> MPMs</td>
3312 <td>incoming connections, to avoid the thundering herd problem;
3313 for more information, refer to the
3314 <a href="../misc/perf-tuning.html">performance tuning</a>
3318 <td><code>authdigest-client</code></td>
3319 <td><module>mod_auth_digest</module></td>
3320 <td>client list in shared memory</td>
3323 <td><code>authdigest-opaque</code></td>
3324 <td><module>mod_auth_digest</module></td>
3325 <td>counter in shared memory</td>
3328 <td><code>ldap-cache</code></td>
3329 <td><module>mod_ldap</module></td>
3330 <td>LDAP result cache</td>
3333 <td><code>rewrite-map</code></td>
3334 <td><module>mod_rewrite</module></td>
3335 <td>communication with external mapping programs, to avoid
3336 intermixed I/O from multiple requests</td>
3339 <td><code>ssl-cache</code></td>
3340 <td><module>mod_ssl</module></td>
3341 <td>SSL session cache</td>
3344 <td><code>ssl-stapling</code></td>
3345 <td><module>mod_ssl</module></td>
3346 <td>OCSP stapling response cache</td>
3349 <td><code>watchdog-callback</code></td>
3350 <td><module>mod_watchdog</module></td>
3351 <td>callback function of a particular client module</td>
3355 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3356 parent process id from the lock file name.</p>
3358 <p>In the following example, the mutex mechanism for the MPM accept
3359 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3360 with the associated lock file created in directory
3361 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3362 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3364 <highlight language="config">
3365 Mutex sysvsem default
3366 Mutex fcntl:/var/httpd/locks mpm-accept
3369 </directivesynopsis>
3372 <name>NameVirtualHost</name>
3373 <description>DEPRECATED: Designates an IP address for name-virtual
3374 hosting</description>
3375 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
3376 <contextlist><context>server config</context></contextlist>
3380 <p>Prior to 2.3.11, <directive>NameVirtualHost</directive> was required
3381 to instruct the server that a particular IP address and port combination
3382 was usable as a name-based virtual host. In 2.3.11 and later,
3383 any time an IP address and port combination is used in multiple virtual
3384 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3386 <p>This directive currently has no effect.</p>
3389 <seealso><a href="../vhosts/">Virtual Hosts
3390 documentation</a></seealso>
3392 </directivesynopsis>
3395 <name>Options</name>
3396 <description>Configures what features are available in a particular
3397 directory</description>
3399 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
3400 <default>Options FollowSymlinks</default>
3401 <contextlist><context>server config</context><context>virtual host</context>
3402 <context>directory</context><context>.htaccess</context>
3404 <override>Options</override>
3405 <compatibility>The default was changed from All to FollowSymlinks in 2.3.11</compatibility>
3408 <p>The <directive>Options</directive> directive controls which
3409 server features are available in a particular directory.</p>
3411 <p><var>option</var> can be set to <code>None</code>, in which
3412 case none of the extra features are enabled, or one or more of
3416 <dt><code>All</code></dt>
3418 <dd>All options except for <code>MultiViews</code>.</dd>
3420 <dt><code>ExecCGI</code></dt>
3423 Execution of CGI scripts using <module>mod_cgi</module>
3426 <dt><code>FollowSymLinks</code></dt>
3429 The server will follow symbolic links in this directory. This is
3430 the default setting.
3432 <p>Even though the server follows the symlink it does <em>not</em>
3433 change the pathname used to match against <directive type="section"
3434 module="core">Directory</directive> sections.</p>
3436 <p>The <code>FollowSymLinks</code> and
3437 <code>SymLinksIfOwnerMatch</code> <directive
3438 module="core">Options</directive> work only in <directive
3439 type="section" module="core">Directory</directive> sections or
3440 <code>.htaccess</code> files.</p>
3442 <p>Omitting this option should not be considered a security restriction,
3443 since symlink testing is subject to race conditions that make it
3447 <dt><code>Includes</code></dt>
3450 Server-side includes provided by <module>mod_include</module>
3453 <dt><code>IncludesNOEXEC</code></dt>
3457 Server-side includes are permitted, but the <code>#exec
3458 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3459 possible to <code>#include virtual</code> CGI scripts from
3460 <directive module="mod_alias">ScriptAlias</directive>ed
3463 <dt><code>Indexes</code></dt>
3466 If a URL which maps to a directory is requested and there
3467 is no <directive module="mod_dir">DirectoryIndex</directive>
3468 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3469 <module>mod_autoindex</module> will return a formatted listing
3470 of the directory.</dd>
3472 <dt><code>MultiViews</code></dt>
3475 <a href="../content-negotiation.html">Content negotiated</a>
3476 "MultiViews" are allowed using
3477 <module>mod_negotiation</module>.
3478 <note><title>Note</title> <p>This option gets ignored if set
3479 anywhere other than <directive module="core" type="section"
3480 >Directory</directive>, as <module>mod_negotiation</module>
3481 needs real resources to compare against and evaluate from.</p></note>
3484 <dt><code>SymLinksIfOwnerMatch</code></dt>
3486 <dd>The server will only follow symbolic links for which the
3487 target file or directory is owned by the same user id as the
3490 <note><title>Note</title>
3491 <p>The <code>FollowSymLinks</code> and
3492 <code>SymLinksIfOwnerMatch</code> <directive
3493 module="core">Options</directive> work only in <directive
3494 type="section" module="core">Directory</directive> sections or
3495 <code>.htaccess</code> files.</p>
3497 <p>This option should not be considered a security restriction,
3498 since symlink testing is subject to race conditions that make it
3503 <p>Normally, if multiple <directive>Options</directive> could
3504 apply to a directory, then the most specific one is used and
3505 others are ignored; the options are not merged. (See <a
3506 href="../sections.html#mergin">how sections are merged</a>.)
3507 However if <em>all</em> the options on the
3508 <directive>Options</directive> directive are preceded by a
3509 <code>+</code> or <code>-</code> symbol, the options are
3510 merged. Any options preceded by a <code>+</code> are added to the
3511 options currently in force, and any options preceded by a
3512 <code>-</code> are removed from the options currently in
3515 <note><title>Note</title>
3516 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3517 <code>-</code> with those without is not valid syntax and will be
3518 rejected during server startup by the syntax check with an abort.</p>
3521 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3523 <highlight language="config">
3524 <Directory "/web/docs">
3525 Options Indexes FollowSymLinks
3528 <Directory "/web/docs/spec">
3533 <p>then only <code>Includes</code> will be set for the
3534 <code>/web/docs/spec</code> directory. However if the second
3535 <directive>Options</directive> directive uses the <code>+</code> and
3536 <code>-</code> symbols:</p>
3538 <highlight language="config">
3539 <Directory "/web/docs">
3540 Options Indexes FollowSymLinks
3543 <Directory "/web/docs/spec">
3544 Options +Includes -Indexes
3548 <p>then the options <code>FollowSymLinks</code> and
3549 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3552 <note><title>Note</title>
3553 <p>Using <code>-IncludesNOEXEC</code> or
3554 <code>-Includes</code> disables server-side includes completely
3555 regardless of the previous setting.</p>
3558 <p>The default in the absence of any other settings is
3559 <code>FollowSymlinks</code>.</p>
3561 </directivesynopsis>
3564 <name>Protocol</name>
3565 <description>Protocol for a listening socket</description>
3566 <syntax>Protocol <var>protocol</var></syntax>
3567 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3568 <compatibility>Available in Apache 2.1.5 and later.
3569 On Windows, from Apache 2.3.3 and later.</compatibility>
3572 <p>This directive specifies the protocol used for a specific listening socket.
3573 The protocol is used to determine which module should handle a request and
3574 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3577 <p>You only need to set the protocol if you are running on non-standard ports;
3578 otherwise, <code>http</code> is assumed for port 80 and <code>https</code>
3581 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3583 <highlight language="config">Protocol https</highlight>
3585 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3587 <seealso><directive module="core">AcceptFilter</directive></seealso>
3588 <seealso><directive module="mpm_common">Listen</directive></seealso>
3589 </directivesynopsis>
3593 <name>Protocols</name>
3594 <description>Protocols available for a server/virtual host</description>
3595 <syntax>Protocols <var>protocol</var> ...</syntax>
3596 <default>Protocols http/1.1</default>
3597 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3598 <compatibility>Only available from Apache 2.4.17 and later.</compatibility>
3601 <p>This directive specifies the list of protocols supported for a
3602 server/virtual host. The list determines the allowed protocols
3603 a client may negotiate for this server/host.</p>
3605 <p>You need to set protocols if you want to extend the available
3606 protocols for a server/host. By default, only the http/1.1 protocol
3607 (which includes the compatibility with 1.0 and 0.9 clients) is
3610 <p>For example, if you want to support HTTP/2 for a server with TLS,
3613 <highlight language="config">
3614 Protocols h2 http/1.1
3617 <p>Valid protocols are <code>http/1.1</code> for http and https connections,
3618 <code>h2</code> on https connections and <code>h2c</code> for http
3619 connections. Modules may enable more protocols.</p>
3621 <p>It is safe to specify protocols that are unavailable/disabled. Such
3622 protocol names will simply be ignored.</p>
3624 <p>Protocols specified in base servers are inherited for virtual hosts
3625 only if the virtual host has no own Protocols directive. Or, the other
3626 way around, Protocols directives in virtual hosts replace any
3627 such directive in the base server.
3631 <seealso><directive module="core">ProtocolsHonorOrder</directive></seealso>
3632 </directivesynopsis>
3636 <name>ProtocolsHonorOrder</name>
3637 <description>Determines if order of Protocols determines precedence during negotiation</description>
3638 <syntax>ProtocolsHonorOrder On|Off</syntax>
3639 <default>ProtocolsHonorOrder On</default>
3640 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3641 <compatibility>Only available from Apache 2.4.17 and later.</compatibility>
3644 <p>This directive specifies if the server should honor the order in which
3645 the <directive>Protocols</directive> directive lists protocols.</p>
3647 <p>If configured Off, the client supplied list order of protocols has
3648 precedence over the order in the server configuration.</p>
3650 <p>With <directive>ProtocolsHonorOrder</directive> set to <code>on</code>
3651 (default), the client ordering does not matter and only the ordering
3652 in the server settings influences the outcome of the protocol
3656 <seealso><directive module="core">Protocols</directive></seealso>
3657 </directivesynopsis>
3661 <name>RLimitCPU</name>
3662 <description>Limits the CPU consumption of processes launched
3663 by Apache httpd children</description>
3664 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3665 <default>Unset; uses operating system defaults</default>
3666 <contextlist><context>server config</context><context>virtual host</context>
3667 <context>directory</context><context>.htaccess</context></contextlist>
3668 <override>All</override>
3671 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3672 resource limit for all processes and the second parameter sets
3673 the maximum resource limit. Either parameter can be a number,
3674 or <code>max</code> to indicate to the server that the limit should
3675 be set to the maximum allowed by the operating system
3676 configuration. Raising the maximum resource limit requires that
3677 the server is running as <code>root</code> or in the initial startup
3680 <p>This applies to processes forked from Apache httpd children
3681 servicing requests, not the Apache httpd children themselves. This
3682 includes CGI scripts and SSI exec commands, but not any
3683 processes forked from the Apache httpd parent, such as piped
3686 <p>CPU resource limits are expressed in seconds per
3689 <seealso><directive module="core">RLimitMEM</directive></seealso>
3690 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3691 </directivesynopsis>
3694 <name>RLimitMEM</name>
3695 <description>Limits the memory consumption of processes launched
3696 by Apache httpd children</description>
3697 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3698 <default>Unset; uses operating system defaults</default>
3699 <contextlist><context>server config</context><context>virtual host</context>
3700 <context>directory</context><context>.htaccess</context></contextlist>
3701 <override>All</override>
3704 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3705 resource limit for all processes and the second parameter sets
3706 the maximum resource limit. Either parameter can be a number,
3707 or <code>max</code> to indicate to the server that the limit should
3708 be set to the maximum allowed by the operating system
3709 configuration. Raising the maximum resource limit requires that
3710 the server is running as <code>root</code> or in the initial startup
3713 <p>This applies to processes forked from Apache httpd children
3714 servicing requests, not the Apache httpd children themselves. This
3715 includes CGI scripts and SSI exec commands, but not any
3716 processes forked from the Apache httpd parent, such as piped
3719 <p>Memory resource limits are expressed in bytes per
3722 <seealso><directive module="core">RLimitCPU</directive></seealso>
3723 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3724 </directivesynopsis>
3727 <name>RLimitNPROC</name>
3728 <description>Limits the number of processes that can be launched by
3729 processes launched by Apache httpd children</description>
3730 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3731 <default>Unset; uses operating system defaults</default>
3732 <contextlist><context>server config</context><context>virtual host</context>
3733 <context>directory</context><context>.htaccess</context></contextlist>
3734 <override>All</override>
3737 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3738 resource limit for all processes, and the second parameter sets
3739 the maximum resource limit. Either parameter can be a number,
3740 or <code>max</code> to indicate to the server that the limit
3741 should be set to the maximum allowed by the operating system
3742 configuration. Raising the maximum resource limit requires that
3743 the server is running as <code>root</code> or in the initial startup
3746 <p>This applies to processes forked from Apache httpd children
3747 servicing requests, not the Apache httpd children themselves. This
3748 includes CGI scripts and SSI exec commands, but not any
3749 processes forked from the Apache httpd parent, such as piped
3752 <p>Process limits control the number of processes per user.</p>
3754 <note><title>Note</title>
3755 <p>If CGI processes are <strong>not</strong> running
3756 under user ids other than the web server user id, this directive
3757 will limit the number of processes that the server itself can
3758 create. Evidence of this situation will be indicated by
3759 <strong><code>cannot fork</code></strong> messages in the
3760 <code>error_log</code>.</p>
3763 <seealso><directive module="core">RLimitMEM</directive></seealso>
3764 <seealso><directive module="core">RLimitCPU</directive></seealso>
3765 </directivesynopsis>
3768 <name>ScriptInterpreterSource</name>
3769 <description>Technique for locating the interpreter for CGI
3770 scripts</description>
3771 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3772 <default>ScriptInterpreterSource Script</default>
3773 <contextlist><context>server config</context><context>virtual host</context>
3774 <context>directory</context><context>.htaccess</context></contextlist>
3775 <override>FileInfo</override>
3776 <compatibility>Win32 only.</compatibility>
3779 <p>This directive is used to control how Apache httpd finds the
3780 interpreter used to run CGI scripts. The default setting is
3781 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3782 by the shebang line (first line, starting with <code>#!</code>) in the
3783 script. On Win32 systems this line usually looks like:</p>
3785 <highlight language="perl">#!C:/Perl/bin/perl.exe</highlight>
3787 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3789 <highlight language="perl">#!perl</highlight>
3791 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3792 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3793 searched using the script file extension (e.g., <code>.pl</code>) as a
3794 search key. The command defined by the registry subkey
3795 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3796 <code>Shell\Open\Command</code> is used to open the script file. If the
3797 registry keys cannot be found, Apache httpd falls back to the behavior of the
3798 <code>Script</code> option.</p>
3800 <note type="warning"><title>Security</title>
3801 <p>Be careful when using <code>ScriptInterpreterSource
3802 Registry</code> with <directive
3803 module="mod_alias">ScriptAlias</directive>'ed directories, because
3804 Apache httpd will try to execute <strong>every</strong> file within this
3805 directory. The <code>Registry</code> setting may cause undesired
3806 program calls on files which are typically not executed. For
3807 example, the default open command on <code>.htm</code> files on
3808 most Windows systems will execute Microsoft Internet Explorer, so
3809 any HTTP request for an <code>.htm</code> file existing within the
3810 script directory would start the browser in the background on the
3811 server. This is a good way to crash your system within a minute or
3815 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3816 2.0 does the same thing as <code>Registry</code> but uses only the
3817 subkey <code>Shell\ExecCGI\Command</code>. The
3818 <code>ExecCGI</code> key is not a common one. It must be
3819 configured manually in the windows registry and hence prevents
3820 accidental program calls on your system.</p>
3822 </directivesynopsis>
3825 <name>SeeRequestTail</name>
3826 <description>Determine if mod_status displays the first 63 characters
3827 of a request or the last 63, assuming the request itself is greater than
3828 63 chars.</description>
3829 <syntax>SeeRequestTail On|Off</syntax>
3830 <default>SeeRequestTail Off</default>
3831 <contextlist><context>server config</context></contextlist>
3832 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3835 <p>mod_status with <code>ExtendedStatus On</code>
3836 displays the actual request being handled.
3837 For historical purposes, only 63 characters of the request
3838 are actually stored for display purposes. This directive
3839 controls whether the 1st 63 characters are stored (the previous
3840 behavior and the default) or if the last 63 characters are. This
3841 is only applicable, of course, if the length of the request is
3842 64 characters or greater.</p>
3844 <p>If Apache httpd is handling <code
3845 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3846 > mod_status displays as follows:
3851 <th>Off (default)</th>
3852 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3856 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3861 </directivesynopsis>
3864 <name>ServerAdmin</name>
3865 <description>Email address that the server includes in error
3866 messages sent to the client</description>
3867 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3868 <contextlist><context>server config</context><context>virtual host</context>
3872 <p>The <directive>ServerAdmin</directive> sets the contact address
3873 that the server includes in any error messages it returns to the
3874 client. If the <code>httpd</code> doesn't recognize the supplied argument
3876 assumes, that it's an <var>email-address</var> and prepends it with
3877 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3878 actually use an email address, since there are a lot of CGI scripts that
3879 make that assumption. If you want to use an URL, it should point to another
3880 server under your control. Otherwise users may not be able to contact you in
3883 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3885 <highlight language="config">ServerAdmin www-admin@foo.example.com</highlight>
3886 <p>as users do not always mention that they are talking about the
3889 </directivesynopsis>
3892 <name>ServerAlias</name>
3893 <description>Alternate names for a host used when matching requests
3894 to name-virtual hosts</description>
3895 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3896 <contextlist><context>virtual host</context></contextlist>
3899 <p>The <directive>ServerAlias</directive> directive sets the
3900 alternate names for a host, for use with <a
3901 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3902 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3904 <highlight language="config">
3905 <VirtualHost *:80>
3906 ServerName server.example.com
3907 ServerAlias server server2.example.com server2
3908 ServerAlias *.example.com
3909 UseCanonicalName Off
3911 </VirtualHost>
3914 <p>Name-based virtual hosts for the best-matching set of <directive
3915 type="section" module="core">virtualhost</directive>s are processed
3916 in the order they appear in the configuration. The first matching <directive
3917 module="core">ServerName</directive> or <directive module="core"
3918 >ServerAlias</directive> is used, with no different precedence for wildcards
3919 (nor for ServerName vs. ServerAlias). </p>
3921 <p>The complete list of names in the <directive>VirtualHost</directive>
3922 directive are treated just like a (non wildcard)
3923 <directive>ServerAlias</directive>.</p>
3926 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3927 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3928 </directivesynopsis>
3931 <name>ServerName</name>
3932 <description>Hostname and port that the server uses to identify
3933 itself</description>
3934 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3935 <contextlist><context>server config</context><context>virtual host</context>
3939 <p>The <directive>ServerName</directive> directive sets the
3940 request scheme, hostname and
3941 port that the server uses to identify itself. This is used when
3942 creating redirection URLs.</p>
3944 <p>Additionally, <directive>ServerName</directive> is used (possibly
3945 in conjunction with <directive>ServerAlias</directive>) to uniquely
3946 identify a virtual host, when using <a
3947 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3949 <p>For example, if the name of the
3950 machine hosting the web server is <code>simple.example.com</code>,
3951 but the machine also has the DNS alias <code>www.example.com</code>
3952 and you wish the web server to be so identified, the following
3953 directive should be used:</p>
3955 <highlight language="config">ServerName www.example.com</highlight>
3957 <p>The <directive>ServerName</directive> directive
3958 may appear anywhere within the definition of a server. However,
3959 each appearance overrides the previous appearance (within that
3962 <p>If no <directive>ServerName</directive> is specified, then the
3963 server attempts to deduce the client visible hostname by performing a
3964 reverse lookup on an IP address of the systems hostname.</p>
3966 <p>If no port is specified in the
3967 <directive>ServerName</directive>, then the server will use the
3968 port from the incoming request. For optimal reliability and
3969 predictability, you should specify an explicit hostname and port
3970 using the <directive>ServerName</directive> directive.</p>
3972 <p>If you are using <a
3973 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3974 the <directive>ServerName</directive> inside a
3975 <directive type="section" module="core">VirtualHost</directive>
3976 section specifies what hostname must appear in the request's
3977 <code>Host:</code> header to match this virtual host.</p>
3979 <p>Sometimes, the server runs behind a device that processes SSL,
3980 such as a reverse proxy, load balancer or SSL offload
3981 appliance. When this is the case, specify the
3982 <code>https://</code> scheme and the port number to which the
3983 clients connect in the <directive>ServerName</directive> directive
3984 to make sure that the server generates the correct
3985 self-referential URLs.
3988 <p>See the description of the
3989 <directive module="core">UseCanonicalName</directive> and
3990 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3991 settings which determine whether self-referential URLs (e.g., by the
3992 <module>mod_dir</module> module) will refer to the
3993 specified port, or to the port number given in the client's request.
3996 <note type="warning">
3997 <p>Failure to set <directive>ServerName</directive> to a name that
3998 your server can resolve to an IP address will result in a startup
3999 warning. <code>httpd</code> will then use whatever hostname it can
4000 determine, using the system's <code>hostname</code> command. This
4001 will almost never be the hostname you actually want.</p>
4003 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
4009 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4010 Apache HTTP Server</a></seealso>
4011 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
4012 documentation</a></seealso>
4013 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4014 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
4015 <seealso><directive module="core">ServerAlias</directive></seealso>
4016 </directivesynopsis>
4019 <name>ServerPath</name>
4020 <description>Legacy URL pathname for a name-based virtual host that
4021 is accessed by an incompatible browser</description>
4022 <syntax>ServerPath <var>URL-path</var></syntax>
4023 <contextlist><context>virtual host</context></contextlist>
4026 <p>The <directive>ServerPath</directive> directive sets the legacy
4027 URL pathname for a host, for use with <a
4028 href="../vhosts/">name-based virtual hosts</a>.</p>
4030 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4031 </directivesynopsis>
4034 <name>ServerRoot</name>
4035 <description>Base directory for the server installation</description>
4036 <syntax>ServerRoot <var>directory-path</var></syntax>
4037 <default>ServerRoot /usr/local/apache</default>
4038 <contextlist><context>server config</context></contextlist>
4041 <p>The <directive>ServerRoot</directive> directive sets the
4042 directory in which the server lives. Typically it will contain the
4043 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
4044 paths in other configuration directives (such as <directive
4045 module="core">Include</directive> or <directive
4046 module="mod_so">LoadModule</directive>, for example) are taken as
4047 relative to this directory.</p>
4049 <highlight language="config">ServerRoot "/home/httpd"</highlight>
4051 <p>The default location of <directive>ServerRoot</directive> may be
4052 modified by using the <code>--prefix</code> argument to
4053 <a href="../programs/configure.html"><code>configure</code></a>, and
4054 most third-party distributions of the server have a different
4055 default location from the one listed above.</p>
4058 <seealso><a href="../invoking.html">the <code>-d</code>
4059 option to <code>httpd</code></a></seealso>
4060 <seealso><a href="../misc/security_tips.html#serverroot">the
4061 security tips</a> for information on how to properly set
4062 permissions on the <directive>ServerRoot</directive></seealso>
4063 </directivesynopsis>
4066 <name>ServerSignature</name>
4067 <description>Configures the footer on server-generated documents</description>
4068 <syntax>ServerSignature On|Off|EMail</syntax>
4069 <default>ServerSignature Off</default>
4070 <contextlist><context>server config</context><context>virtual host</context>
4071 <context>directory</context><context>.htaccess</context>
4073 <override>All</override>
4076 <p>The <directive>ServerSignature</directive> directive allows the
4077 configuration of a trailing footer line under server-generated
4078 documents (error messages, <module>mod_proxy</module> ftp directory
4079 listings, <module>mod_info</module> output, ...). The reason why you
4080 would want to enable such a footer line is that in a chain of proxies,
4081 the user often has no possibility to tell which of the chained servers
4082 actually produced a returned error message.</p>
4084 <p>The <code>Off</code>
4085 setting, which is the default, suppresses the footer line (and is
4086 therefore compatible with the behavior of Apache-1.2 and
4087 below). The <code>On</code> setting simply adds a line with the
4088 server version number and <directive
4089 module="core">ServerName</directive> of the serving virtual host,
4090 and the <code>EMail</code> setting additionally creates a
4091 "mailto:" reference to the <directive
4092 module="core">ServerAdmin</directive> of the referenced
4095 <p>After version 2.0.44, the details of the server version number
4096 presented are controlled by the <directive
4097 module="core">ServerTokens</directive> directive.</p>
4099 <seealso><directive module="core">ServerTokens</directive></seealso>
4100 </directivesynopsis>
4103 <name>ServerTokens</name>
4104 <description>Configures the <code>Server</code> HTTP response
4105 header</description>
4106 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
4107 <default>ServerTokens Full</default>
4108 <contextlist><context>server config</context></contextlist>
4111 <p>This directive controls whether <code>Server</code> response
4112 header field which is sent back to clients includes a
4113 description of the generic OS-type of the server as well as
4114 information about compiled-in modules.</p>
4117 <dt><code>ServerTokens Full</code> (or not specified)</dt>
4119 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4120 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4122 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4124 <dd>Server sends (<em>e.g.</em>): <code>Server:
4127 <dt><code>ServerTokens Major</code></dt>
4129 <dd>Server sends (<em>e.g.</em>): <code>Server:
4130 Apache/2</code></dd>
4132 <dt><code>ServerTokens Minor</code></dt>
4134 <dd>Server sends (<em>e.g.</em>): <code>Server:
4135 Apache/2.4</code></dd>
4137 <dt><code>ServerTokens Min[imal]</code></dt>
4139 <dd>Server sends (<em>e.g.</em>): <code>Server:
4140 Apache/2.4.2</code></dd>
4142 <dt><code>ServerTokens OS</code></dt>
4144 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4149 <p>This setting applies to the entire server, and cannot be
4150 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4152 <p>After version 2.0.44, this directive also controls the
4153 information presented by the <directive
4154 module="core">ServerSignature</directive> directive.</p>
4156 <note>Setting <directive>ServerTokens</directive> to less than
4157 <code>minimal</code> is not recommended because it makes it more
4158 difficult to debug interoperational problems. Also note that
4159 disabling the Server: header does nothing at all to make your
4160 server more secure. The idea of "security through obscurity"
4161 is a myth and leads to a false sense of safety.</note>
4164 <seealso><directive module="core">ServerSignature</directive></seealso>
4165 </directivesynopsis>
4168 <name>SetHandler</name>
4169 <description>Forces all matching files to be processed by a
4170 handler</description>
4171 <syntax>SetHandler <var>handler-name</var>|None</syntax>
4172 <contextlist><context>server config</context><context>virtual host</context>
4173 <context>directory</context><context>.htaccess</context>
4175 <override>FileInfo</override>
4178 <p>When placed into an <code>.htaccess</code> file or a
4179 <directive type="section" module="core">Directory</directive> or
4180 <directive type="section" module="core">Location</directive>
4181 section, this directive forces all matching files to be parsed
4182 through the <a href="../handler.html">handler</a> given by
4183 <var>handler-name</var>. For example, if you had a directory you
4184 wanted to be parsed entirely as imagemap rule files, regardless
4185 of extension, you might put the following into an
4186 <code>.htaccess</code> file in that directory:</p>
4188 <highlight language="config">SetHandler imap-file</highlight>
4190 <p>Another example: if you wanted to have the server display a
4191 status report whenever a URL of
4192 <code>http://servername/status</code> was called, you might put
4193 the following into <code>httpd.conf</code>:</p>
4195 <highlight language="config">
4196 <Location "/status">
4197 SetHandler server-status
4201 <p>You could also use this directive to configure a particular
4202 handler for files with a particular file extension. For example:</p>
4204 <highlight language="config">
4205 <FilesMatch "\.php$">
4206 SetHandler application/x-httpd-php
4210 <p>You can override an earlier defined <directive>SetHandler</directive>
4211 directive by using the value <code>None</code>.</p>
4213 <note><title>Note</title>
4214 <p>Because <directive>SetHandler</directive> overrides default handlers,
4215 normal behavior such as handling of URLs ending in a slash (/) as
4216 directories or index files is suppressed.</p></note>
4219 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
4221 </directivesynopsis>
4224 <name>SetInputFilter</name>
4225 <description>Sets the filters that will process client requests and POST
4227 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
4228 <contextlist><context>server config</context><context>virtual host</context>
4229 <context>directory</context><context>.htaccess</context>
4231 <override>FileInfo</override>
4234 <p>The <directive>SetInputFilter</directive> directive sets the
4235 filter or filters which will process client requests and POST
4236 input when they are received by the server. This is in addition to
4237 any filters defined elsewhere, including the
4238 <directive module="mod_mime">AddInputFilter</directive>
4241 <p>If more than one filter is specified, they must be separated
4242 by semicolons in the order in which they should process the
4245 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4246 </directivesynopsis>
4249 <name>SetOutputFilter</name>
4250 <description>Sets the filters that will process responses from the
4251 server</description>
4252 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
4253 <contextlist><context>server config</context><context>virtual host</context>
4254 <context>directory</context><context>.htaccess</context>
4256 <override>FileInfo</override>
4259 <p>The <directive>SetOutputFilter</directive> directive sets the filters
4260 which will process responses from the server before they are
4261 sent to the client. This is in addition to any filters defined
4262 elsewhere, including the
4263 <directive module="mod_mime">AddOutputFilter</directive>
4266 <p>For example, the following configuration will process all files
4267 in the <code>/www/data/</code> directory for server-side
4270 <highlight language="config">
4271 <Directory "/www/data/">
4272 SetOutputFilter INCLUDES
4276 <p>If more than one filter is specified, they must be separated
4277 by semicolons in the order in which they should process the
4280 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
4281 </directivesynopsis>
4284 <name>TimeOut</name>
4285 <description>Amount of time the server will wait for
4286 certain events before failing a request</description>
4287 <syntax>TimeOut <var>seconds</var></syntax>
4288 <default>TimeOut 60</default>
4289 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4292 <p>The <directive>TimeOut</directive> directive defines the length
4293 of time Apache httpd will wait for I/O in various circumstances:</p>
4296 <li>When reading data from the client, the length of time to
4297 wait for a TCP packet to arrive if the read buffer is
4300 <li>When writing data to the client, the length of time to wait
4301 for an acknowledgement of a packet if the send buffer is
4304 <li>In <module>mod_cgi</module>, the length of time to wait for
4305 output from a CGI script.</li>
4307 <li>In <module>mod_ext_filter</module>, the length of time to
4308 wait for output from a filtering process.</li>
4310 <li>In <module>mod_proxy</module>, the default timeout value if
4311 <directive module="mod_proxy">ProxyTimeout</directive> is not
4316 </directivesynopsis>
4319 <name>TraceEnable</name>
4320 <description>Determines the behavior on <code>TRACE</code> requests</description>
4321 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
4322 <default>TraceEnable on</default>
4323 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4326 <p>This directive overrides the behavior of <code>TRACE</code> for both
4327 the core server and <module>mod_proxy</module>. The default
4328 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4329 RFC 2616, which disallows any request body to accompany the request.
4330 <code>TraceEnable off</code> causes the core server and
4331 <module>mod_proxy</module> to return a <code>405</code> (Method not
4332 allowed) error to the client.</p>
4334 <p>Finally, for testing and diagnostic purposes only, request
4335 bodies may be allowed using the non-compliant <code>TraceEnable
4336 extended</code> directive. The core (as an origin server) will
4337 restrict the request body to 64k (plus 8k for chunk headers if
4338 <code>Transfer-Encoding: chunked</code> is used). The core will
4339 reflect the full headers and all chunk headers with the response
4340 body. As a proxy server, the request body is not restricted to 64k.</p>
4342 <note><title>Note</title>
4343 <p>Despite claims to the contrary, <code>TRACE</code> is not
4344 a security vulnerability, and there is no viable reason for
4345 it to be disabled. Doing so necessarily makes your server
4349 </directivesynopsis>
4352 <name>UnDefine</name>
4353 <description>Undefine the existence of a variable</description>
4354 <syntax>UnDefine <var>parameter-name</var></syntax>
4355 <contextlist><context>server config</context></contextlist>
4358 <p>Undoes the effect of a <directive module="core">Define</directive> or
4359 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
4360 <p>This directive can be used to toggle the use of <directive module="core"
4361 type="section">IfDefine</directive> sections without needing to alter
4362 <code>-D</code> arguments in any startup scripts.</p>
4363 <p>While this directive is supported in virtual host context,
4364 the changes it makes are visible to any later configuration
4365 directives, beyond any enclosing virtual host.</p>
4367 </directivesynopsis>
4370 <name>UseCanonicalName</name>
4371 <description>Configures how the server determines its own name and
4373 <syntax>UseCanonicalName On|Off|DNS</syntax>
4374 <default>UseCanonicalName Off</default>
4375 <contextlist><context>server config</context><context>virtual host</context>
4376 <context>directory</context></contextlist>
4379 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4380 URL -- that is, a URL that refers back to the same server. With
4381 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4382 specified in the <directive module="core">ServerName</directive>
4383 directive to construct the canonical name for the server. This name
4384 is used in all self-referential URLs, and for the values of
4385 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4387 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4388 self-referential URLs using the hostname and port supplied by
4389 the client if any are supplied (otherwise it will use the
4390 canonical name, as defined above). These values are the same
4391 that are used to implement <a
4392 href="../vhosts/name-based.html">name-based virtual hosts</a>
4393 and are available with the same clients. The CGI variables
4394 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4395 constructed from the client supplied values as well.</p>
4397 <p>An example where this may be useful is on an intranet server
4398 where you have users connecting to the machine using short
4399 names such as <code>www</code>. You'll notice that if the users
4400 type a shortname and a URL which is a directory, such as
4401 <code>http://www/splat</code>, <em>without the trailing
4402 slash</em>, then Apache httpd will redirect them to
4403 <code>http://www.example.com/splat/</code>. If you have
4404 authentication enabled, this will cause the user to have to
4405 authenticate twice (once for <code>www</code> and once again
4406 for <code>www.example.com</code> -- see <a
4407 href="http://wiki.apache.org/httpd/FAQ#Why_does_Apache_ask_for_my_password_twice_before_serving_a_file.3F">
4408 the FAQ on this subject for more information</a>). But if
4409 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
4410 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4412 <p>There is a third option, <code>UseCanonicalName DNS</code>,
4413 which is intended for use with mass IP-based virtual hosting to
4414 support ancient clients that do not provide a
4415 <code>Host:</code> header. With this option, Apache httpd does a
4416 reverse DNS lookup on the server IP address that the client
4417 connected to in order to work out self-referential URLs.</p>
4419 <note type="warning"><title>Warning</title>
4420 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>,
4421 they may be broken by this option. The client is essentially free
4422 to give whatever value they want as a hostname. But if the CGI is
4423 only using <code>SERVER_NAME</code> to construct self-referential URLs,
4424 then it should be just fine.</p>
4427 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
4428 <seealso><directive module="core">ServerName</directive></seealso>
4429 <seealso><directive module="mpm_common">Listen</directive></seealso>
4430 </directivesynopsis>
4433 <name>UseCanonicalPhysicalPort</name>
4434 <description>Configures how the server determines its own port</description>
4435 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
4436 <default>UseCanonicalPhysicalPort Off</default>
4437 <contextlist><context>server config</context><context>virtual host</context>
4438 <context>directory</context></contextlist>
4441 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4442 URL -- that is, a URL that refers back to the same server. With
4443 <code>UseCanonicalPhysicalPort On</code>, Apache httpd will, when
4444 constructing the canonical port for the server to honor
4445 the <directive module="core">UseCanonicalName</directive> directive,
4446 provide the actual physical port number being used by this request
4447 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>,
4448 Apache httpd will not ever use the actual physical port number, instead
4449 relying on all configured information to construct a valid port number.</p>
4451 <note><title>Note</title>
4452 <p>The ordering of the lookup when the physical port is used is as
4455 <dt><code>UseCanonicalName On</code></dt>
4458 <li>Port provided in <directive module="core">Servername</directive></li>
4459 <li>Physical port</li>
4460 <li>Default port</li>
4463 <dt><code>UseCanonicalName Off | DNS</code></dt>
4466 <li>Parsed port from <code>Host:</code> header</li>
4467 <li>Physical port</li>
4468 <li>Port provided in <directive module="core">Servername</directive></li>
4469 <li>Default port</li>
4474 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4475 physical ports are removed from the ordering.</p>
4479 <seealso><directive module="core">UseCanonicalName</directive></seealso>
4480 <seealso><directive module="core">ServerName</directive></seealso>
4481 <seealso><directive module="mpm_common">Listen</directive></seealso>
4482 </directivesynopsis>
4484 <directivesynopsis type="section">
4485 <name>VirtualHost</name>
4486 <description>Contains directives that apply only to a specific
4487 hostname or IP address</description>
4488 <syntax><VirtualHost
4489 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4490 ...> ... </VirtualHost></syntax>
4491 <contextlist><context>server config</context></contextlist>
4494 <p><directive type="section">VirtualHost</directive> and
4495 <code></VirtualHost></code> are used to enclose a group of
4496 directives that will apply only to a particular virtual host. Any
4497 directive that is allowed in a virtual host context may be
4498 used. When the server receives a request for a document on a
4499 particular virtual host, it uses the configuration directives
4500 enclosed in the <directive type="section">VirtualHost</directive>
4501 section. <var>Addr</var> can be any of the following, optionally followed by
4502 a colon and a port number (or *):</p>
4505 <li>The IP address of the virtual host;</li>
4507 <li>A fully qualified domain name for the IP address of the
4508 virtual host (not recommended);</li>
4510 <li>The character <code>*</code>, which acts as a wildcard and matches
4511 any IP address.</li>
4513 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4517 <highlight language="config">
4518 <VirtualHost 10.1.2.3:80>
4519 ServerAdmin webmaster@host.example.com
4520 DocumentRoot "/www/docs/host.example.com"
4521 ServerName host.example.com
4522 ErrorLog "logs/host.example.com-error_log"
4523 TransferLog "logs/host.example.com-access_log"
4524 </VirtualHost>
4528 <p>IPv6 addresses must be specified in square brackets because
4529 the optional port number could not be determined otherwise. An
4530 IPv6 example is shown below:</p>
4532 <highlight language="config">
4533 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
4534 ServerAdmin webmaster@host.example.com
4535 DocumentRoot "/www/docs/host.example.com"
4536 ServerName host.example.com
4537 ErrorLog "logs/host.example.com-error_log"
4538 TransferLog "logs/host.example.com-access_log"
4539 </VirtualHost>
4542 <p>Each Virtual Host must correspond to a different IP address,
4543 different port number, or a different host name for the server,
4544 in the former case the server machine must be configured to
4545 accept IP packets for multiple addresses. (If the machine does
4546 not have multiple network interfaces, then this can be
4547 accomplished with the <code>ifconfig alias</code> command -- if
4548 your OS supports it).</p>
4550 <note><title>Note</title>
4551 <p>The use of <directive type="section">VirtualHost</directive> does
4552 <strong>not</strong> affect what addresses Apache httpd listens on. You
4553 may need to ensure that Apache httpd is listening on the correct addresses
4554 using <directive module="mpm_common">Listen</directive>.</p>
4557 <p>A <directive module="core">ServerName</directive> should be
4558 specified inside each <directive
4559 type="section">VirtualHost</directive> block. If it is absent, the
4560 <directive module="core">ServerName</directive> from the "main"
4561 server configuration will be inherited.</p>
4563 <p>When a request is received, the server first maps it to the best matching
4564 <directive type="section">VirtualHost</directive> based on the local
4565 IP address and port combination only. Non-wildcards have a higher
4566 precedence. If no match based on IP and port occurs at all, the
4567 "main" server configuration is used.</p>
4569 <p>If multiple virtual hosts contain the best matching IP address and port,
4570 the server selects from these virtual hosts the best match based on the
4571 requested hostname. If no matching name-based virtual host is found,
4572 then the first listed virtual host that matched the IP address will be
4573 used. As a consequence, the first listed virtual host for a given IP address
4574 and port combination is the default virtual host for that IP and port
4577 <note type="warning"><title>Security</title>
4578 <p>See the <a href="../misc/security_tips.html">security tips</a>
4579 document for details on why your security could be compromised if the
4580 directory where log files are stored is writable by anyone other
4581 than the user that starts the server.</p>
4584 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4585 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4586 Apache HTTP Server</a></seealso>
4587 <seealso><a href="../bind.html">Setting
4588 which addresses and ports Apache HTTP Server uses</a></seealso>
4589 <seealso><a href="../sections.html">How <Directory>, <Location>
4590 and <Files> sections work</a> for an explanation of how these
4591 different sections are combined when a request is received</seealso>
4592 </directivesynopsis>
4595 <name>MergeTrailers</name>
4596 <description>Determines whether trailers are merged into headers</description>
4597 <syntax>MergeTrailers [on|off]</syntax>
4598 <default>MergeTrailers off</default>
4599 <contextlist><context>server config</context><context>virtual host</context></contextlist>
4600 <compatibility>2.4.11 and later</compatibility>
4603 <p>This directive controls whether HTTP trailers are copied into the
4604 internal representation of HTTP headers. This merging occurs when the
4605 request body has been completely consumed, long after most header
4606 processing would have a chance to examine or modify request headers.</p>
4607 <p>This option is provided for compatibility with releases prior to 2.4.11,
4608 where trailers were always merged.</p>
4610 </directivesynopsis>
4613 <name>QualifyRedirectURL</name>
4614 <description>Controls whether the REDIRECT_URL environment variable is
4615 fully qualified</description>
4616 <syntax>QualifyRedirectURL ON|OFF</syntax>
4617 <default>QualifyRedirectURL OFF</default>
4618 <contextlist><context>server config</context><context>virtual host</context>
4619 <context>directory</context>
4621 <override>FileInfo</override>
4622 <compatibility>Directive supported in 2.4.18 and later. 2.4.17 acted
4623 as if 'QualifyRedirectURL ON' was configured.</compatibility>
4626 <p>This directive controls whether the server will ensure that the
4627 REDIRECT_URL environment variable is fully qualified. By default,
4628 the variable contains the verbatim URL requested by the client,
4629 such as "/index.html". With <directive module="core"
4630 >QualifyRedirectURL ON</directive>, the same request would result in a
4631 value such as "http://www.example.com/index.html".</p>
4632 <p>Even without this directive set, when a request is issued against a
4633 fully qualified URL, REDIRECT_URL will remain fully qualified.
4636 </directivesynopsis>