2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Core Apache HTTP Server features that are always
27 available</description>
31 <name>AcceptFilter</name>
32 <description>Configures optimizations for a Protocol's Listener Sockets</description>
33 <syntax>AcceptFilter <var>protocol</var> <var>accept_filter</var></syntax>
34 <contextlist><context>server config</context></contextlist>
35 <compatibility>Available in Apache httpd 2.1.5 and later.
36 On Windows from Apache httpd 2.3.3 and later.</compatibility>
39 <p>This directive enables operating system specific optimizations for a
40 listening socket by the Protocol type. The basic premise is for the
41 kernel to not send a socket to the server process until either data
42 is received or an entire HTTP Request is buffered. Only
43 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
44 FreeBSD's Accept Filters</a>, Linux's more primitive
45 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
46 are currently supported.</p>
48 <p>Using <code>none</code> for an argument will disable any accept filters
49 for that protocol. This is useful for protocols that require a server
50 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
51 <example>AcceptFilter nntp none</example>
53 <p>The default values on FreeBSD are:</p>
55 AcceptFilter http httpready <br/>
56 AcceptFilter https dataready
59 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
60 the kernel level. Once an entire request is received, the kernel then
61 sends it to the server. See the
62 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
63 accf_http(9)</a> man page for more details. Since HTTPS requests are
64 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
65 accf_data(9)</a> filter is used.</p>
67 <p>The default values on Linux are:</p>
69 AcceptFilter http data <br/>
70 AcceptFilter https data
73 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
74 requests. Any value besides <code>none</code> will enable
75 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
77 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
78 tcp(7)</a> man page.</p>
80 <p>The default values on Windows are:</p>
82 AcceptFilter http data <br/>
83 AcceptFilter https data
86 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
87 API, and does not support http protocol buffering. There are two values
88 which utilize the Windows AcceptEx() API and will recycle network
89 sockets between connections. <code>data</code> waits until data has
90 been transmitted as documented above, and the initial data buffer and
91 network endpoint addresses are all retrieved from the single AcceptEx()
92 invocation. <code>connect</code> will use the AcceptEx() API, also
93 retrieve the network endpoint addresses, but like <code>none</code>
94 the <code>connect</code> option does not wait for the initial data
97 <p>On Windows, <code>none</code> uses accept() rather than than AcceptEx()
98 and will not recycle sockets between connections. This is useful for
99 network adapters with broken driver support, as well as some virtual
100 network providers such as vpn drivers, or spam, virus or spyware
107 <name>AcceptPathInfo</name>
108 <description>Resources accept trailing pathname information</description>
109 <syntax>AcceptPathInfo On|Off|Default</syntax>
110 <default>AcceptPathInfo Default</default>
111 <contextlist><context>server config</context>
112 <context>virtual host</context><context>directory</context>
113 <context>.htaccess</context></contextlist>
114 <override>FileInfo</override>
115 <compatibility>Available in Apache httpd 2.0.30 and later</compatibility>
119 <p>This directive controls whether requests that contain trailing
120 pathname information that follows an actual filename (or
121 non-existent file in an existing directory) will be accepted or
122 rejected. The trailing pathname information can be made
123 available to scripts in the <code>PATH_INFO</code> environment
126 <p>For example, assume the location <code>/test/</code> points to
127 a directory that contains only the single file
128 <code>here.html</code>. Then requests for
129 <code>/test/here.html/more</code> and
130 <code>/test/nothere.html/more</code> both collect
131 <code>/more</code> as <code>PATH_INFO</code>.</p>
133 <p>The three possible arguments for the
134 <directive>AcceptPathInfo</directive> directive are:</p>
136 <dt><code>Off</code></dt><dd>A request will only be accepted if it
137 maps to a literal path that exists. Therefore a request with
138 trailing pathname information after the true filename such as
139 <code>/test/here.html/more</code> in the above example will return
140 a 404 NOT FOUND error.</dd>
142 <dt><code>On</code></dt><dd>A request will be accepted if a
143 leading path component maps to a file that exists. The above
144 example <code>/test/here.html/more</code> will be accepted if
145 <code>/test/here.html</code> maps to a valid file.</dd>
147 <dt><code>Default</code></dt><dd>The treatment of requests with
148 trailing pathname information is determined by the <a
149 href="../handler.html">handler</a> responsible for the request.
150 The core handler for normal files defaults to rejecting
151 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
152 href="mod_cgi.html">cgi-script</a> and <a
153 href="mod_isapi.html">isapi-handler</a>, generally accept
154 <code>PATH_INFO</code> by default.</dd>
157 <p>The primary purpose of the <code>AcceptPathInfo</code>
158 directive is to allow you to override the handler's choice of
159 accepting or rejecting <code>PATH_INFO</code>. This override is required,
160 for example, when you use a <a href="../filter.html">filter</a>, such
161 as <a href="mod_include.html">INCLUDES</a>, to generate content
162 based on <code>PATH_INFO</code>. The core handler would usually reject
163 the request, so you can use the following configuration to enable
167 <Files "mypaths.shtml"><br />
169 Options +Includes<br />
170 SetOutputFilter INCLUDES<br />
171 AcceptPathInfo On<br />
180 <name>AccessFileName</name>
181 <description>Name of the distributed configuration file</description>
182 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
183 <default>AccessFileName .htaccess</default>
184 <contextlist><context>server config</context><context>virtual host</context>
188 <p>While processing a request the server looks for
189 the first existing configuration file from this list of names in
190 every directory of the path to the document, if distributed
191 configuration files are <a href="#allowoverride">enabled for that
192 directory</a>. For example:</p>
198 <p>before returning the document
199 <code>/usr/local/web/index.html</code>, the server will read
200 <code>/.acl</code>, <code>/usr/.acl</code>,
201 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
202 for directives, unless they have been disabled with</p>
205 <Directory /><br />
207 AllowOverride None<br />
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).
244 AddDefaultCharset utf-8
247 <p><directive>AddDefaultCharset</directive> should only be used when all
248 of the text resources to which it applies are known to be in that
249 character encoding and it is too inconvenient to label their charset
250 individually. One such example is to add the charset parameter
251 to resources containing generated content, such as legacy CGI
252 scripts, that might be vulnerable to cross-site scripting attacks
253 due to user-provided data being included in the output. Note, however,
254 that a better solution is to just fix (or delete) those scripts, since
255 setting a default charset does not protect users that have enabled
256 the "auto-detect character encoding" feature on their browser.</p>
258 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
262 <name>AllowEncodedSlashes</name>
263 <description>Determines whether encoded path separators in URLs are allowed to
264 be passed through</description>
265 <syntax>AllowEncodedSlashes On|Off</syntax>
266 <default>AllowEncodedSlashes Off</default>
267 <contextlist><context>server config</context><context>virtual host</context>
269 <compatibility>Available in Apache httpd 2.0.46 and later</compatibility>
272 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
273 which contain encoded path separators (<code>%2F</code> for <code>/</code>
274 and additionally <code>%5C</code> for <code>\</code> on according systems)
275 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
277 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
278 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
280 <note><title>Note</title>
281 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
282 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
283 according systems) will be left as such in the otherwise decoded URL
287 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
291 <name>AllowOverride</name>
292 <description>Types of directives that are allowed in
293 <code>.htaccess</code> files</description>
294 <syntax>AllowOverride All|None|<var>directive-type</var>
295 [<var>directive-type</var>] ...</syntax>
296 <default>AllowOverride All</default>
297 <contextlist><context>directory</context></contextlist>
300 <p>When the server finds an <code>.htaccess</code> file (as
301 specified by <directive module="core">AccessFileName</directive>)
302 it needs to know which directives declared in that file can override
303 earlier configuration directives.</p>
305 <note><title>Only available in <Directory> sections</title>
306 <directive>AllowOverride</directive> is valid only in
307 <directive type="section" module="core">Directory</directive>
308 sections specified without regular expressions, not in <directive
309 type="section" module="core">Location</directive>, <directive
310 module="core" type="section">DirectoryMatch</directive> or
311 <directive type="section" module="core">Files</directive> sections.
314 <p>When this directive is set to <code>None</code>, then
315 <a href="#accessfilename">.htaccess</a> files are completely ignored.
316 In this case, the server will not even attempt to read
317 <code>.htaccess</code> files in the filesystem.</p>
319 <p>When this directive is set to <code>All</code>, then any
320 directive which has the .htaccess <a
321 href="directive-dict.html#Context">Context</a> is allowed in
322 <code>.htaccess</code> files.</p>
324 <p>The <var>directive-type</var> can be one of the following
325 groupings of directives.</p>
332 Allow use of the authorization directives (<directive
333 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
334 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
335 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
336 <directive module="mod_authn_core">AuthName</directive>,
337 <directive module="mod_authn_core">AuthType</directive>, <directive
338 module="mod_authn_file">AuthUserFile</directive>, <directive
339 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
344 Allow use of the directives controlling document types
345 (<directive module="core">ErrorDocument</directive>,
346 <directive module="core">ForceType</directive>,
347 <directive module="mod_negotiation">LanguagePriority</directive>,
348 <directive module="core">SetHandler</directive>,
349 <directive module="core">SetInputFilter</directive>,
350 <directive module="core">SetOutputFilter</directive>, and
351 <module>mod_mime</module> Add* and Remove* directives),
352 document meta data (<directive
353 module="mod_headers">Header</directive>, <directive
354 module="mod_headers">RequestHeader</directive>, <directive
355 module="mod_setenvif">SetEnvIf</directive>, <directive
356 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
357 module="mod_setenvif">BrowserMatch</directive>, <directive
358 module="mod_usertrack">CookieExpires</directive>, <directive
359 module="mod_usertrack">CookieDomain</directive>, <directive
360 module="mod_usertrack">CookieStyle</directive>, <directive
361 module="mod_usertrack">CookieTracking</directive>, <directive
362 module="mod_usertrack">CookieName</directive>),
363 <module>mod_rewrite</module> directives <directive
364 module="mod_rewrite">RewriteEngine</directive>, <directive
365 module="mod_rewrite">RewriteOptions</directive>, <directive
366 module="mod_rewrite">RewriteBase</directive>, <directive
367 module="mod_rewrite">RewriteCond</directive>, <directive
368 module="mod_rewrite">RewriteRule</directive>) and
369 <directive module="mod_actions">Action</directive> from
370 <module>mod_actions</module>.
376 Allow use of the directives controlling directory indexing
378 module="mod_autoindex">AddDescription</directive>,
379 <directive module="mod_autoindex">AddIcon</directive>, <directive
380 module="mod_autoindex">AddIconByEncoding</directive>,
381 <directive module="mod_autoindex">AddIconByType</directive>,
382 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
383 module="mod_dir">DirectoryIndex</directive>, <directive
384 module="mod_autoindex">FancyIndexing</directive>, <directive
385 module="mod_autoindex">HeaderName</directive>, <directive
386 module="mod_autoindex">IndexIgnore</directive>, <directive
387 module="mod_autoindex">IndexOptions</directive>, <directive
388 module="mod_autoindex">ReadmeName</directive>,
394 Allow use of the directives controlling host access (<directive
395 module="mod_authz_host">Allow</directive>, <directive
396 module="mod_authz_host">Deny</directive> and <directive
397 module="mod_authz_host">Order</directive>).</dd>
399 <dt>Options[=<var>Option</var>,...]</dt>
402 Allow use of the directives controlling specific directory
403 features (<directive module="core">Options</directive> and
404 <directive module="mod_include">XBitHack</directive>).
405 An equal sign may be given followed by a comma (but no spaces)
406 separated lists of options that may be set using the <directive
407 module="core">Options</directive> command.</dd>
413 AllowOverride AuthConfig Indexes
416 <p>In the example above all directives that are neither in the group
417 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
420 <note><p>For security and performance reasons, do not set
421 <code>AllowOverride</code> to anything other than <code>None</code>
422 in your <code><Directory /></code> block. Instead, find (or
423 create) the <code><Directory></code> block that refers to the
424 directory where you're actually planning to place a
425 <code>.htaccess</code> file.</p>
429 <seealso><directive module="core">AccessFileName</directive></seealso>
430 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
431 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
435 <name>CGIMapExtension</name>
436 <description>Technique for locating the interpreter for CGI
437 scripts</description>
438 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
439 <contextlist><context>directory</context><context>.htaccess</context>
441 <override>FileInfo</override>
442 <compatibility>NetWare only</compatibility>
445 <p>This directive is used to control how Apache httpd finds the
446 interpreter used to run CGI scripts. For example, setting
447 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
448 cause all CGI script files with a <code>.foo</code> extension to
449 be passed to the FOO interpreter.</p>
454 <name>ContentDigest</name>
455 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
456 headers</description>
457 <syntax>ContentDigest On|Off</syntax>
458 <default>ContentDigest Off</default>
459 <contextlist><context>server config</context><context>virtual host</context>
460 <context>directory</context><context>.htaccess</context>
462 <override>Options</override>
463 <status>Experimental</status>
466 <p>This directive enables the generation of
467 <code>Content-MD5</code> headers as defined in RFC1864
468 respectively RFC2616.</p>
470 <p>MD5 is an algorithm for computing a "message digest"
471 (sometimes called "fingerprint") of arbitrary-length data, with
472 a high degree of confidence that any alterations in the data
473 will be reflected in alterations in the message digest.</p>
475 <p>The <code>Content-MD5</code> header provides an end-to-end
476 message integrity check (MIC) of the entity-body. A proxy or
477 client may check this header for detecting accidental
478 modification of the entity-body in transit. Example header:</p>
481 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
484 <p>Note that this can cause performance problems on your server
485 since the message digest is computed on every request (the
486 values are not cached).</p>
488 <p><code>Content-MD5</code> is only sent for documents served
489 by the <module>core</module>, and not by any module. For example,
490 SSI documents, output from CGI scripts, and byte range responses
491 do not have this header.</p>
496 <name>DefaultType</name>
497 <description>This directive has no effect other than to emit warnings
498 if the value is not <code>none</code>. In prior versions, DefaultType
499 would specify a default media type to assign to response content for
500 which no other media type configuration could be found.
502 <syntax>DefaultType <var>media-type|none</var></syntax>
503 <default>DefaultType none</default>
504 <contextlist><context>server config</context><context>virtual host</context>
505 <context>directory</context><context>.htaccess</context>
507 <override>FileInfo</override>
508 <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>
511 <p>This directive has been disabled. For backwards compatibility
512 of configuration files, it may be specified with the value
513 <code>none</code>, meaning no default media type. For example:</p>
519 <p><code>DefaultType None</code> is only available in
520 httpd-2.2.7 and later.</p>
522 <p>Use the mime.types configuration file and the
523 <directive module="mod_mime">AddType</directive> to configure media
524 type assignments via file extensions, or the
525 <directive module="core">ForceType</directive> directive to configure
526 the media type for specific resources. Otherwise, the server will
527 send the response without a Content-Type header field and the
528 recipient may attempt to guess the media type.</p>
534 <description>Define the existence of a variable</description>
535 <syntax>Define <var>parameter-name</var></syntax>
536 <contextlist><context>server config</context></contextlist>
539 <p>Equivalent to passing the <code>-D</code> argument to <program
540 >httpd</program>.</p>
541 <p>This directive can be used to toggle the use of <directive module="core"
542 type="section">IfDefine</directive> sections without needing to alter
543 <code>-D</code> arguments in any startup scripts.</p>
547 <directivesynopsis type="section">
548 <name>Directory</name>
549 <description>Enclose a group of directives that apply only to the
550 named file-system directory and sub-directories</description>
551 <syntax><Directory <var>directory-path</var>>
552 ... </Directory></syntax>
553 <contextlist><context>server config</context><context>virtual host</context>
557 <p><directive type="section">Directory</directive> and
558 <code></Directory></code> are used to enclose a group of
559 directives that will apply only to the named directory and
560 sub-directories of that directory. Any directive that is allowed
561 in a directory context may be used. <var>Directory-path</var> is
562 either the full path to a directory, or a wild-card string using
563 Unix shell-style matching. In a wild-card string, <code>?</code> matches
564 any single character, and <code>*</code> matches any sequences of
565 characters. You may also use <code>[]</code> character ranges. None
566 of the wildcards match a `/' character, so <code><Directory
567 /*/public_html></code> will not match
568 <code>/home/user/public_html</code>, but <code><Directory
569 /home/*/public_html></code> will match. Example:</p>
572 <Directory /usr/local/httpd/htdocs><br />
574 Options Indexes FollowSymLinks<br />
580 <p>Be careful with the <var>directory-path</var> arguments:
581 They have to literally match the filesystem path which Apache httpd uses
582 to access the files. Directives applied to a particular
583 <code><Directory></code> will not apply to files accessed from
584 that same directory via a different path, such as via different symbolic
588 <p><glossary ref="regex">Regular
589 expressions</glossary> can also be used, with the addition of the
590 <code>~</code> character. For example:</p>
593 <Directory ~ "^/www/.*/[0-9]{3}">
596 <p>would match directories in <code>/www/</code> that consisted of
599 <p>If multiple (non-regular expression) <directive
600 type="section">Directory</directive> sections
601 match the directory (or one of its parents) containing a document,
602 then the directives are applied in the order of shortest match
603 first, interspersed with the directives from the <a
604 href="#accessfilename">.htaccess</a> files. For example,
608 <Directory /><br />
610 AllowOverride None<br />
612 </Directory><br />
614 <Directory /home/><br />
616 AllowOverride FileInfo<br />
621 <p>for access to the document <code>/home/web/dir/doc.html</code>
625 <li>Apply directive <code>AllowOverride None</code>
626 (disabling <code>.htaccess</code> files).</li>
628 <li>Apply directive <code>AllowOverride FileInfo</code> (for
629 directory <code>/home</code>).</li>
631 <li>Apply any <code>FileInfo</code> directives in
632 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
633 <code>/home/web/dir/.htaccess</code> in that order.</li>
636 <p>Regular expressions are not considered until after all of the
637 normal sections have been applied. Then all of the regular
638 expressions are tested in the order they appeared in the
639 configuration file. For example, with</p>
642 <Directory ~ abc$><br />
644 # ... directives here ...<br />
649 <p>the regular expression section won't be considered until after
650 all normal <directive type="section">Directory</directive>s and
651 <code>.htaccess</code> files have been applied. Then the regular
652 expression will match on <code>/home/abc/public_html/abc</code> and
653 the corresponding <directive type="section">Directory</directive> will
656 <p><strong>Note that the default access for
657 <code><Directory /></code> is <code>Allow from All</code>.
658 This means that Apache httpd will serve any file mapped from an URL. It is
659 recommended that you change this with a block such
663 <Directory /><br />
665 Order Deny,Allow<br />
671 <p><strong>and then override this for directories you
672 <em>want</em> accessible. See the <a
673 href="../misc/security_tips.html">Security Tips</a> page for more
674 details.</strong></p>
676 <p>The directory sections occur in the <code>httpd.conf</code> file.
677 <directive type="section">Directory</directive> directives
678 cannot nest, and cannot appear in a <directive module="core"
679 type="section">Limit</directive> or <directive module="core"
680 type="section">LimitExcept</directive> section.</p>
682 <seealso><a href="../sections.html">How <Directory>,
683 <Location> and <Files> sections work</a> for an
684 explanation of how these different sections are combined when a
685 request is received</seealso>
688 <directivesynopsis type="section">
689 <name>DirectoryMatch</name>
690 <description>Enclose directives that apply to
691 file-system directories matching a regular expression.</description>
692 <syntax><DirectoryMatch <var>regex</var>>
693 ... </DirectoryMatch></syntax>
694 <contextlist><context>server config</context><context>virtual host</context>
698 <p><directive type="section">DirectoryMatch</directive> and
699 <code></DirectoryMatch></code> are used to enclose a group
700 of directives which will apply only to the named directory,
701 the same as <directive module="core" type="section">Directory</directive>.
702 However, it takes as an argument a
703 <glossary ref="regex">regular expression</glossary>. For example:</p>
706 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
709 <p>would match directories in <code>/www/</code> that consisted of three
712 <note><title>Compatability</title>
713 Prior to 2.3.9, this directive implicitly applied to sub-directories
714 (like <directive module="core" type="section">Directory</directive>) and
715 could not match the end of line symbol ($). In 2.3.9 and later,
716 only directories that match the expression are affected by the enclosed
720 <note><title>Trailing Slash</title>
721 This directive applies to requests for directories that may or may
722 not end in a trailing slash, so expressions that are anchored to the
723 end of line ($) must be written with care.
726 <seealso><directive type="section" module="core">Directory</directive> for
727 a description of how regular expressions are mixed in with normal
728 <directive type="section">Directory</directive>s</seealso>
730 href="../sections.html">How <Directory>, <Location> and
731 <Files> sections work</a> for an explanation of how these different
732 sections are combined when a request is received</seealso>
736 <name>DocumentRoot</name>
737 <description>Directory that forms the main document tree visible
738 from the web</description>
739 <syntax>DocumentRoot <var>directory-path</var></syntax>
740 <default>DocumentRoot /usr/local/apache/htdocs</default>
741 <contextlist><context>server config</context><context>virtual host</context>
745 <p>This directive sets the directory from which <program>httpd</program>
746 will serve files. Unless matched by a directive like <directive
747 module="mod_alias">Alias</directive>, the server appends the
748 path from the requested URL to the document root to make the
749 path to the document. Example:</p>
752 DocumentRoot /usr/web
756 <code>http://www.my.host.com/index.html</code> refers to
757 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
758 not absolute then it is assumed to be relative to the <directive
759 module="core">ServerRoot</directive>.</p>
761 <p>The <directive>DocumentRoot</directive> should be specified without
762 a trailing slash.</p>
764 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
765 Locations</a></seealso>
769 <name>EnableMMAP</name>
770 <description>Use memory-mapping to read files during delivery</description>
771 <syntax>EnableMMAP On|Off</syntax>
772 <default>EnableMMAP On</default>
773 <contextlist><context>server config</context><context>virtual host</context>
774 <context>directory</context><context>.htaccess</context>
776 <override>FileInfo</override>
779 <p>This directive controls whether the <program>httpd</program> may use
780 memory-mapping if it needs to read the contents of a file during
781 delivery. By default, when the handling of a request requires
782 access to the data within a file -- for example, when delivering a
783 server-parsed file using <module>mod_include</module> -- Apache httpd
784 memory-maps the file if the OS supports it.</p>
786 <p>This memory-mapping sometimes yields a performance improvement.
787 But in some environments, it is better to disable the memory-mapping
788 to prevent operational problems:</p>
791 <li>On some multiprocessor systems, memory-mapping can reduce the
792 performance of the <program>httpd</program>.</li>
793 <li>Deleting or truncating a file while <program>httpd</program>
794 has it memory-mapped can cause <program>httpd</program> to
795 crash with a segmentation fault.
799 <p>For server configurations that are vulnerable to these problems,
800 you should disable memory-mapping of delivered files by specifying:</p>
806 <p>For NFS mounted files, this feature may be disabled explicitly for
807 the offending files by specifying:</p>
810 <Directory "/path-to-nfs-files">
820 <name>EnableSendfile</name>
821 <description>Use the kernel sendfile support to deliver files to the client</description>
822 <syntax>EnableSendfile On|Off</syntax>
823 <default>EnableSendfile Off</default>
824 <contextlist><context>server config</context><context>virtual host</context>
825 <context>directory</context><context>.htaccess</context>
827 <override>FileInfo</override>
828 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
829 version 2.3.9.</compatibility>
832 <p>This directive controls whether <program>httpd</program> may use the
833 sendfile support from the kernel to transmit file contents to the client.
834 By default, when the handling of a request requires no access
835 to the data within a file -- for example, when delivering a
836 static file -- Apache httpd uses sendfile to deliver the file contents
837 without ever reading the file if the OS supports it.</p>
839 <p>This sendfile mechanism avoids separate read and send operations,
840 and buffer allocations. But on some platforms or within some
841 filesystems, it is better to disable this feature to avoid
842 operational problems:</p>
845 <li>Some platforms may have broken sendfile support that the build
846 system did not detect, especially if the binaries were built on
847 another box and moved to such a machine with broken sendfile
849 <li>On Linux the use of sendfile triggers TCP-checksum
850 offloading bugs on certain networking cards when using IPv6.</li>
851 <li>On Linux on Itanium, sendfile may be unable to handle files
852 over 2GB in size.</li>
853 <li>With a network-mounted <directive
854 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
855 the kernel may be unable to serve the network file through
859 <p>For server configurations that are not vulnerable to these problems,
860 you may enable this feature by specifying:</p>
866 <p>For network mounted files, this feature may be disabled explicitly
867 for the offending files by specifying:</p>
870 <Directory "/path-to-nfs-files">
876 <p>Please note that the per-directory and .htaccess configuration
877 of <directive>EnableSendfile</directive> is not supported by
878 <module>mod_disk_cache</module>.
879 Only global definition of <directive>EnableSendfile</directive>
880 is taken into account by the module.
886 <name>ErrorDocument</name>
887 <description>What the server will return to the client
888 in case of an error</description>
889 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
890 <contextlist><context>server config</context><context>virtual host</context>
891 <context>directory</context><context>.htaccess</context>
893 <override>FileInfo</override>
894 <compatibility>Quoting syntax for text messages is different in Apache HTTP Server
898 <p>In the event of a problem or error, Apache httpd can be configured
899 to do one of four things,</p>
902 <li>output a simple hardcoded error message</li>
904 <li>output a customized message</li>
906 <li>redirect to a local <var>URL-path</var> to handle the
909 <li>redirect to an external <var>URL</var> to handle the
913 <p>The first option is the default, while options 2-4 are
914 configured using the <directive>ErrorDocument</directive>
915 directive, which is followed by the HTTP response code and a URL
916 or a message. Apache httpd will sometimes offer additional information
917 regarding the problem/error.</p>
919 <p>URLs can begin with a slash (/) for local web-paths (relative
920 to the <directive module="core">DocumentRoot</directive>), or be a
921 full URL which the client can resolve. Alternatively, a message
922 can be provided to be displayed by the browser. Examples:</p>
925 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
926 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
927 ErrorDocument 401 /subscription_info.html<br />
928 ErrorDocument 403 "Sorry can't allow you access today"
931 <p>Additionally, the special value <code>default</code> can be used
932 to specify Apache httpd's simple hardcoded message. While not required
933 under normal circumstances, <code>default</code> will restore
934 Apache httpd's simple hardcoded message for configurations that would
935 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
938 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
939 <Directory /web/docs><br />
941 ErrorDocument 404 default<br />
946 <p>Note that when you specify an <directive>ErrorDocument</directive>
947 that points to a remote URL (ie. anything with a method such as
948 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
949 client to tell it where to find the document, even if the
950 document ends up being on the same server. This has several
951 implications, the most important being that the client will not
952 receive the original error status code, but instead will
953 receive a redirect status code. This in turn can confuse web
954 robots and other clients which try to determine if a URL is
955 valid using the status code. In addition, if you use a remote
956 URL in an <code>ErrorDocument 401</code>, the client will not
957 know to prompt the user for a password since it will not
958 receive the 401 status code. Therefore, <strong>if you use an
959 <code>ErrorDocument 401</code> directive then it must refer to a local
960 document.</strong></p>
962 <p>Microsoft Internet Explorer (MSIE) will by default ignore
963 server-generated error messages when they are "too small" and substitute
964 its own "friendly" error messages. The size threshold varies depending on
965 the type of error, but in general, if you make your error document
966 greater than 512 bytes, then MSIE will show the server-generated
967 error rather than masking it. More information is available in
968 Microsoft Knowledge Base article <a
969 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
972 <p>Although most error messages can be overriden, there are certain
973 circumstances where the internal messages are used regardless of the
974 setting of <directive module="core">ErrorDocument</directive>. In
975 particular, if a malformed request is detected, normal request processing
976 will be immediately halted and the internal error message returned.
977 This is necessary to guard against security problems caused by
980 <p>If you are using mod_proxy, you may wish to enable
981 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
982 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
983 Apache httpd will not generate custom error documents for proxied content.</p>
986 <seealso><a href="../custom-error.html">documentation of
987 customizable responses</a></seealso>
991 <name>ErrorLog</name>
992 <description>Location where the server will log errors</description>
993 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
994 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
995 <contextlist><context>server config</context><context>virtual host</context>
999 <p>The <directive>ErrorLog</directive> directive sets the name of
1000 the file to which the server will log any errors it encounters. If
1001 the <var>file-path</var> is not absolute then it is assumed to be
1002 relative to the <directive module="core">ServerRoot</directive>.</p>
1004 <example><title>Example</title>
1005 ErrorLog /var/log/httpd/error_log
1008 <p>If the <var>file-path</var>
1009 begins with a pipe character "<code>|</code>" then it is assumed to be a
1010 command to spawn to handle the error log.</p>
1012 <example><title>Example</title>
1013 ErrorLog "|/usr/local/bin/httpd_errors"
1016 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1017 more information.</p>
1019 <p>Using <code>syslog</code> instead of a filename enables logging
1020 via syslogd(8) if the system supports it. The default is to use
1021 syslog facility <code>local7</code>, but you can override this by
1022 using the <code>syslog:<var>facility</var></code> syntax where
1023 <var>facility</var> can be one of the names usually documented in
1026 <example><title>Example</title>
1027 ErrorLog syslog:user
1030 <p>SECURITY: See the <a
1031 href="../misc/security_tips.html#serverroot">security tips</a>
1032 document for details on why your security could be compromised
1033 if the directory where log files are stored is writable by
1034 anyone other than the user that starts the server.</p>
1035 <note type="warning"><title>Note</title>
1036 <p>When entering a file path on non-Unix platforms, care should be taken
1037 to make sure that only forward slashed are used even though the platform
1038 may allow the use of back slashes. In general it is a good idea to always
1039 use forward slashes throughout the configuration files.</p>
1042 <seealso><directive module="core">LogLevel</directive></seealso>
1043 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1044 </directivesynopsis>
1047 <name>ErrorLogFormat</name>
1048 <description>Format specification for error log entries</description>
1049 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1050 <contextlist><context>server config</context><context>virtual host</context>
1052 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1055 <p><directive>ErrorLogFormat</directive> allows to specify what
1056 supplementary information is logged in the error log in addition to the
1057 actual log message.</p>
1059 <example><title>Simple example</title>
1060 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1063 <p>Specifying <code>connection</code> or <code>request</code> as first
1064 paramter allows to specify additional formats, causing additional
1065 information to be logged when the first message is logged for a specific
1066 connection or request, respectivly. This additional information is only
1067 logged once per connection/request. If a connection or request is processed
1068 without causing any log message, the additional information is not logged
1071 <p>It can happen that some format string items do not produce output. For
1072 example, the Referer header is only present if the log message is
1073 associated to a request and the log message happens at a time when the
1074 Referer header has already been read from the client. If no output is
1075 produced, the default behaviour is to delete everything from the preceeding
1076 space character to the next space character. This means the log line is
1077 implicitly divided into fields on non-whitespace to whitespace transitions.
1078 If a format string item does not produce output, the whole field is
1079 ommitted. For example, if the remote address <code>%a</code> in the log
1080 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1081 brackets are not logged either. Space characters can be escaped with a
1082 backslash to prevent them from delimiting a field. The combination '% '
1083 (percent space) is a zero-witdh field delimiter that does not produce any
1086 <p>The above behaviour can be changed by adding modifiers to the format
1087 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1088 respective item does not produce any output. In once-per-connection/request
1089 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1090 item with the plus modifier does not produce any output, the whole line is
1093 <p>A number as modifier can be used to assign a log severity level to a
1094 format item. The item will only be logged if the severity of the log
1095 message is not higher than the specified log severity level. The number can
1096 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1098 <p>Some format string items accept additional parameters in braces.</p>
1100 <table border="1" style="zebra">
1101 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1103 <tr><th>Format String</th> <th>Description</th></tr>
1105 <tr><td><code>%%</code></td>
1106 <td>The percent sign</td></tr>
1108 <tr><td><code>%...a</code></td>
1109 <td>Remote IP-address and port</td></tr>
1111 <tr><td><code>%...A</code></td>
1112 <td>Local IP-address and port</td></tr>
1114 <tr><td><code>%...{name}e</code></td>
1115 <td>Request environment variable <code>name</code></td></tr>
1117 <tr><td><code>%...E</code></td>
1118 <td>APR/OS error status code and string</td></tr>
1120 <tr><td><code>%...F</code></td>
1121 <td>Source file name and line number of the log call</td></tr>
1123 <tr><td><code>%...{name}i</code></td>
1124 <td>Request header <code>name</code></td></tr>
1126 <tr><td><code>%...k</code></td>
1127 <td>Number of keep-alive requests on this connection</td></tr>
1129 <tr><td><code>%...l</code></td>
1130 <td>Loglevel of the message</td></tr>
1132 <tr><td><code>%...L</code></td>
1133 <td>Log ID of the request</td></tr>
1135 <tr><td><code>%...{c}L</code></td>
1136 <td>Log ID of the connection</td></tr>
1138 <tr><td><code>%...{C}L</code></td>
1139 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1141 <tr><td><code>%...m</code></td>
1142 <td>Name of the module logging the message</td></tr>
1144 <tr><td><code>%M</code></td>
1145 <td>The actual log message</td></tr>
1147 <tr><td><code>%...{name}n</code></td>
1148 <td>Request note <code>name</code></td></tr>
1150 <tr><td><code>%...P</code></td>
1151 <td>Process ID of current process</td></tr>
1153 <tr><td><code>%...T</code></td>
1154 <td>Thread ID of current thread</td></tr>
1156 <tr><td><code>%...t</code></td>
1157 <td>The current time</td></tr>
1159 <tr><td><code>%...{u}t</code></td>
1160 <td>The current time including micro-seconds</td></tr>
1162 <tr><td><code>%...{cu}t</code></td>
1163 <td>The current time in compact ISO 8601 format, including
1164 micro-seconds</td></tr>
1166 <tr><td><code>%...v</code></td>
1167 <td>The canonical <directive module="core">ServerName</directive>
1168 of the current server.</td></tr>
1170 <tr><td><code>%...V</code></td>
1171 <td>The server name of the server serving the request according to the
1172 <directive module="core" >UseCanonicalName</directive>
1175 <tr><td><code>\ </code> (backslash space)</td>
1176 <td>Non-field delimiting space</td></tr>
1178 <tr><td><code>% </code> (percent space)</td>
1179 <td>Field delimiter (no output)</td></tr>
1182 <p>The log ID format <code>%L</code> produces a unique id for a connection
1183 or request. This can be used to correlate which log lines belong to the
1184 same connection or request, which request happens on which connection.
1185 A <code>%L</code> format string is also available in
1186 <module>mod_log_config</module>, to allow to correlate access log entries
1187 with error log lines. If <module>mod_unique_id</module> is loaded, its
1188 unique id will be used as log ID for requests.</p>
1190 <example><title>Example (somewhat similar to default format)</title>
1191 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1192 %M% ,\ referer\ %{Referer}i"
1195 <example><title>Example (similar to the 2.2.x format)</title>
1196 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1197 %M% ,\ referer\ %{Referer}i"
1200 <example><title>Advanced example with request/connection log IDs</title>
1201 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1202 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1203 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1204 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1205 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1209 <seealso><directive module="core">ErrorLog</directive></seealso>
1210 <seealso><directive module="core">LogLevel</directive></seealso>
1211 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1212 </directivesynopsis>
1215 <name>ExtendedStatus</name>
1216 <description>Keep track of extended status information for each
1217 request</description>
1218 <syntax>ExtendedStatus On|Off</syntax>
1219 <default>ExtendedStatus Off[*]</default>
1220 <contextlist><context>server config</context></contextlist>
1223 <p>This option tracks additional data per worker about the
1224 currently executing request, and a utilization summary; you
1225 can see these variables during runtime by configuring
1226 <module>mod_status</module>. Note that other modules may
1227 rely on this scoreboard.</p>
1229 <p>This setting applies to the entire server, and cannot be
1230 enabled or disabled on a virtualhost-by-virtualhost basis.
1231 The collection of extended status information can slow down
1232 the server. Also note that this setting cannot be changed
1233 during a graceful restart.</p>
1236 <p>Note that loading <module>mod_status</module> will change
1237 the default behavior to ExtendedStatus On, while other
1238 third party modules may do the same. Such modules rely on
1239 collecting detailed information about the state of all workers.
1240 The default is changed by <module>mod_status</module> beginning
1241 with version 2.3.6; the previous default was always Off.</p>
1246 </directivesynopsis>
1249 <name>FileETag</name>
1250 <description>File attributes used to create the ETag
1251 HTTP response header for static files</description>
1252 <syntax>FileETag <var>component</var> ...</syntax>
1253 <default>FileETag INode MTime Size</default>
1254 <contextlist><context>server config</context><context>virtual host</context>
1255 <context>directory</context><context>.htaccess</context>
1257 <override>FileInfo</override>
1261 The <directive>FileETag</directive> directive configures the file
1262 attributes that are used to create the <code>ETag</code> (entity
1263 tag) response header field when the document is based on a static file.
1264 (The <code>ETag</code> value is used in cache management to save
1265 network bandwidth.) The
1266 <directive>FileETag</directive> directive allows you to choose
1267 which of these -- if any -- should be used. The recognized keywords are:
1271 <dt><strong>INode</strong></dt>
1272 <dd>The file's i-node number will be included in the calculation</dd>
1273 <dt><strong>MTime</strong></dt>
1274 <dd>The date and time the file was last modified will be included</dd>
1275 <dt><strong>Size</strong></dt>
1276 <dd>The number of bytes in the file will be included</dd>
1277 <dt><strong>All</strong></dt>
1278 <dd>All available fields will be used. This is equivalent to:
1279 <example>FileETag INode MTime Size</example></dd>
1280 <dt><strong>None</strong></dt>
1281 <dd>If a document is file-based, no <code>ETag</code> field will be
1282 included in the response</dd>
1285 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1286 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1287 which allow changes to be made to the default setting inherited
1288 from a broader scope. Any keyword appearing without such a prefix
1289 immediately and completely cancels the inherited setting.</p>
1291 <p>If a directory's configuration includes
1292 <code>FileETag INode MTime Size</code>, and a
1293 subdirectory's includes <code>FileETag -INode</code>,
1294 the setting for that subdirectory (which will be inherited by
1295 any sub-subdirectories that don't override it) will be equivalent to
1296 <code>FileETag MTime Size</code>.</p>
1297 <note type="warning"><title>Warning</title>
1298 Do not change the default for directories or locations that have WebDAV
1299 enabled and use <module>mod_dav_fs</module> as a storage provider.
1300 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1301 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1302 These conditional requests will break if the <code>ETag</code> format is
1303 changed via <directive>FileETag</directive>.
1305 <note><title>Server Side Includes</title>
1306 An ETag is not generated for responses parsed by <module>mod_include</module>,
1307 since the response entity can change without a change of the INode, MTime, or Size
1308 of the static file with embedded SSI directives.
1312 </directivesynopsis>
1314 <directivesynopsis type="section">
1316 <description>Contains directives that apply to matched
1317 filenames</description>
1318 <syntax><Files <var>filename</var>> ... </Files></syntax>
1319 <contextlist><context>server config</context><context>virtual host</context>
1320 <context>directory</context><context>.htaccess</context>
1322 <override>All</override>
1325 <p>The <directive type="section">Files</directive> directive
1326 limits the scope of the enclosed directives by filename. It is comparable
1327 to the <directive module="core" type="section">Directory</directive>
1328 and <directive module="core" type="section">Location</directive>
1329 directives. It should be matched with a <code></Files></code>
1330 directive. The directives given within this section will be applied to
1331 any object with a basename (last component of filename) matching the
1332 specified filename. <directive type="section">Files</directive>
1333 sections are processed in the order they appear in the
1334 configuration file, after the <directive module="core"
1335 type="section">Directory</directive> sections and
1336 <code>.htaccess</code> files are read, but before <directive
1337 type="section" module="core">Location</directive> sections. Note
1338 that <directive type="section">Files</directive> can be nested
1339 inside <directive type="section"
1340 module="core">Directory</directive> sections to restrict the
1341 portion of the filesystem they apply to.</p>
1343 <p>The <var>filename</var> argument should include a filename, or
1344 a wild-card string, where <code>?</code> matches any single character,
1345 and <code>*</code> matches any sequences of characters.
1346 <glossary ref="regex">Regular expressions</glossary>
1347 can also be used, with the addition of the
1348 <code>~</code> character. For example:</p>
1351 <Files ~ "\.(gif|jpe?g|png)$">
1354 <p>would match most common Internet graphics formats. <directive
1355 module="core" type="section">FilesMatch</directive> is preferred,
1358 <p>Note that unlike <directive type="section"
1359 module="core">Directory</directive> and <directive type="section"
1360 module="core">Location</directive> sections, <directive
1361 type="section">Files</directive> sections can be used inside
1362 <code>.htaccess</code> files. This allows users to control access to
1363 their own files, at a file-by-file level.</p>
1366 <seealso><a href="../sections.html">How <Directory>, <Location>
1367 and <Files> sections work</a> for an explanation of how these
1368 different sections are combined when a request is received</seealso>
1369 </directivesynopsis>
1371 <directivesynopsis type="section">
1372 <name>FilesMatch</name>
1373 <description>Contains directives that apply to regular-expression matched
1374 filenames</description>
1375 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1376 <contextlist><context>server config</context><context>virtual host</context>
1377 <context>directory</context><context>.htaccess</context>
1379 <override>All</override>
1382 <p>The <directive type="section">FilesMatch</directive> directive
1383 limits the scope of the enclosed directives by filename, just as the
1384 <directive module="core" type="section">Files</directive> directive
1385 does. However, it accepts a <glossary ref="regex">regular
1386 expression</glossary>. For example:</p>
1389 <FilesMatch "\.(gif|jpe?g|png)$">
1392 <p>would match most common Internet graphics formats.</p>
1395 <seealso><a href="../sections.html">How <Directory>, <Location>
1396 and <Files> sections work</a> for an explanation of how these
1397 different sections are combined when a request is received</seealso>
1398 </directivesynopsis>
1401 <name>ForceType</name>
1402 <description>Forces all matching files to be served with the specified
1403 media type in the HTTP Content-Type header field</description>
1404 <syntax>ForceType <var>media-type</var>|None</syntax>
1405 <contextlist><context>directory</context><context>.htaccess</context>
1407 <override>FileInfo</override>
1408 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1411 <p>When placed into an <code>.htaccess</code> file or a
1412 <directive type="section" module="core">Directory</directive>, or
1413 <directive type="section" module="core">Location</directive> or
1414 <directive type="section" module="core">Files</directive>
1415 section, this directive forces all matching files to be served
1416 with the content type identification given by
1417 <var>media-type</var>. For example, if you had a directory full of
1418 GIF files, but did not want to label them all with <code>.gif</code>,
1419 you might want to use:</p>
1425 <p>Note that this directive overrides other indirect media type
1426 associations defined in mime.types or via the
1427 <directive module="mod_mime">AddType</directive>.</p>
1429 <p>You can also override more general
1430 <directive>ForceType</directive> settings
1431 by using the value of <code>None</code>:</p>
1434 # force all files to be image/gif:<br />
1435 <Location /images><br />
1437 ForceType image/gif<br />
1439 </Location><br />
1441 # but normal mime-type associations here:<br />
1442 <Location /images/mixed><br />
1444 ForceType None<br />
1449 <p>This directive primarily overrides the content types generated for
1450 static files served out of the filesystem. For resources other than
1451 static files, where the generator of the response typically specifies
1452 a Content-Type, this directive has no effect.</p>
1455 </directivesynopsis>
1458 <name>HostnameLookups</name>
1459 <description>Enables DNS lookups on client IP addresses</description>
1460 <syntax>HostnameLookups On|Off|Double</syntax>
1461 <default>HostnameLookups Off</default>
1462 <contextlist><context>server config</context><context>virtual host</context>
1463 <context>directory</context></contextlist>
1466 <p>This directive enables DNS lookups so that host names can be
1467 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1468 The value <code>Double</code> refers to doing double-reverse
1469 DNS lookup. That is, after a reverse lookup is performed, a forward
1470 lookup is then performed on that result. At least one of the IP
1471 addresses in the forward lookup must match the original
1472 address. (In "tcpwrappers" terminology this is called
1473 <code>PARANOID</code>.)</p>
1475 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1476 used for controlling access by hostname, a double reverse lookup
1477 will be performed. This is necessary for security. Note that the
1478 result of this double-reverse isn't generally available unless you
1479 set <code>HostnameLookups Double</code>. For example, if only
1480 <code>HostnameLookups On</code> and a request is made to an object
1481 that is protected by hostname restrictions, regardless of whether
1482 the double-reverse fails or not, CGIs will still be passed the
1483 single-reverse result in <code>REMOTE_HOST</code>.</p>
1485 <p>The default is <code>Off</code> in order to save the network
1486 traffic for those sites that don't truly need the reverse
1487 lookups done. It is also better for the end users because they
1488 don't have to suffer the extra latency that a lookup entails.
1489 Heavily loaded sites should leave this directive
1490 <code>Off</code>, since DNS lookups can take considerable
1491 amounts of time. The utility <program>logresolve</program>, compiled by
1492 default to the <code>bin</code> subdirectory of your installation
1493 directory, can be used to look up host names from logged IP addresses
1496 </directivesynopsis>
1498 <directivesynopsis type="section">
1500 <description>Contains directives that apply only if a condition is
1501 satisfied by a request at runtime</description>
1502 <syntax><If <var>expression</var>> ... </If></syntax>
1503 <contextlist><context>server config</context><context>virtual host</context>
1504 <context>directory</context><context>.htaccess</context>
1506 <override>All</override>
1509 <p>The <directive type="section">If</directive> directive
1510 evaluates an expression at runtime, and applies the enclosed
1511 directives if and only if the expression evaluates to true.
1515 <If "$req{Host} = ''">
1518 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1520 <p>You may compare the value of any variable in the request headers
1521 ($req), response headers ($resp) or environment ($env) in your
1524 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1525 operator to compare if the expression is in a given range:</p>
1528 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1533 <seealso><a href="../sections.html">How <Directory>, <Location>,
1534 <Files> sections work</a> for an explanation of how these
1535 different sections are combined when a request is received.
1536 <directive type="section">If</directive> has the same precedence
1537 and usage as <directive type="section">Files</directive></seealso>
1538 </directivesynopsis>
1540 <directivesynopsis type="section">
1541 <name>IfDefine</name>
1542 <description>Encloses directives that will be processed only
1543 if a test is true at startup</description>
1544 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1545 </IfDefine></syntax>
1546 <contextlist><context>server config</context><context>virtual host</context>
1547 <context>directory</context><context>.htaccess</context>
1549 <override>All</override>
1552 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1553 </code> section is used to mark directives that are conditional. The
1554 directives within an <directive type="section">IfDefine</directive>
1555 section are only processed if the <var>test</var> is true. If <var>
1556 test</var> is false, everything between the start and end markers is
1559 <p>The <var>test</var> in the <directive type="section"
1560 >IfDefine</directive> section directive can be one of two forms:</p>
1563 <li><var>parameter-name</var></li>
1565 <li><code>!</code><var>parameter-name</var></li>
1568 <p>In the former case, the directives between the start and end
1569 markers are only processed if the parameter named
1570 <var>parameter-name</var> is defined. The second format reverses
1571 the test, and only processes the directives if
1572 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1574 <p>The <var>parameter-name</var> argument is a define as given on the
1575 <program>httpd</program> command line via <code>-D<var>parameter</var>
1576 </code> at the time the server was started or by the <directive
1577 module="core">Define</directive> directive.</p>
1579 <p><directive type="section">IfDefine</directive> sections are
1580 nest-able, which can be used to implement simple
1581 multiple-parameter tests. Example:</p>
1584 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1587 <IfDefine ReverseProxy><br />
1589 LoadModule proxy_module modules/mod_proxy.so<br />
1590 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1591 <IfDefine UseCache><br />
1593 LoadModule cache_module modules/mod_cache.so<br />
1594 <IfDefine MemCache><br />
1596 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1598 </IfDefine><br />
1599 <IfDefine !MemCache><br />
1601 LoadModule disk_cache_module modules/mod_disk_cache.so<br />
1610 </directivesynopsis>
1612 <directivesynopsis type="section">
1613 <name>IfModule</name>
1614 <description>Encloses directives that are processed conditional on the
1615 presence or absence of a specific module</description>
1616 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1617 </IfModule></syntax>
1618 <contextlist><context>server config</context><context>virtual host</context>
1619 <context>directory</context><context>.htaccess</context>
1621 <override>All</override>
1622 <compatibility>Module identifiers are available in version 2.1 and
1623 later.</compatibility>
1626 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1627 section is used to mark directives that are conditional on the presence of
1628 a specific module. The directives within an <directive type="section"
1629 >IfModule</directive> section are only processed if the <var>test</var>
1630 is true. If <var>test</var> is false, everything between the start and
1631 end markers is ignored.</p>
1633 <p>The <var>test</var> in the <directive type="section"
1634 >IfModule</directive> section directive can be one of two forms:</p>
1637 <li><var>module</var></li>
1639 <li>!<var>module</var></li>
1642 <p>In the former case, the directives between the start and end
1643 markers are only processed if the module named <var>module</var>
1644 is included in Apache httpd -- either compiled in or
1645 dynamically loaded using <directive module="mod_so"
1646 >LoadModule</directive>. The second format reverses the test,
1647 and only processes the directives if <var>module</var> is
1648 <strong>not</strong> included.</p>
1650 <p>The <var>module</var> argument can be either the module identifier or
1651 the file name of the module, at the time it was compiled. For example,
1652 <code>rewrite_module</code> is the identifier and
1653 <code>mod_rewrite.c</code> is the file name. If a module consists of
1654 several source files, use the name of the file containing the string
1655 <code>STANDARD20_MODULE_STUFF</code>.</p>
1657 <p><directive type="section">IfModule</directive> sections are
1658 nest-able, which can be used to implement simple multiple-module
1661 <note>This section should only be used if you need to have one
1662 configuration file that works whether or not a specific module
1663 is available. In normal operation, directives need not be
1664 placed in <directive type="section">IfModule</directive>
1667 </directivesynopsis>
1670 <name>Include</name>
1671 <description>Includes other configuration files from within
1672 the server configuration files</description>
1673 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1674 <contextlist><context>server config</context><context>virtual host</context>
1675 <context>directory</context>
1677 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1678 wildcard matching available in 2.3.6 and later</compatibility>
1681 <p>This directive allows inclusion of other configuration files
1682 from within the server configuration files.</p>
1684 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1685 in the filename or directory parts of the path to include several files
1686 at once, in alphabetical order. In addition, if
1687 <directive>Include</directive> points to a directory, rather than a file,
1688 Apache httpd will read all files in that directory and any subdirectory.
1689 However, including entire directories is not recommended, because it is
1690 easy to accidentally leave temporary files in a directory that can cause
1691 <program>httpd</program> to fail. Instead, we encourage you to use the
1692 wildcard syntax shown below, to include files that match a particular
1693 pattern, such as *.conf, for example.</p>
1695 <p>When a wildcard is specified for a <strong>file</strong> component of
1696 the path, and no file matches the wildcard, the
1697 <directive module="core">Include</directive>
1698 directive will be <strong>silently ignored</strong>. When a wildcard is
1699 specified for a <strong>directory</strong> component of the path, and
1700 no directory matches the wildcard, the
1701 <directive module="core">Include</directive> directive will
1702 <strong>fail with an error</strong> saying the directory cannot be found.
1705 <p>For further control over the behaviour of the server when no files or
1706 directories match, prefix the path with the modifiers <var>optional</var>
1707 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1708 file or directory that does not match will be silently ignored. If
1709 <var>strict</var> is specified, any wildcard file or directory that does
1710 not match at least one file will cause server startup to fail.</p>
1712 <p>When a directory or file component of the path is
1713 specified exactly, and that directory or file does not exist,
1714 <directive module="core">Include</directive> directive will fail with an
1715 error saying the file or directory cannot be found.</p>
1717 <p>The file path specified may be an absolute path, or may be relative
1718 to the <directive module="core">ServerRoot</directive> directory.</p>
1723 Include /usr/local/apache2/conf/ssl.conf<br />
1724 Include /usr/local/apache2/conf/vhosts/*.conf
1727 <p>Or, providing paths relative to your <directive
1728 module="core">ServerRoot</directive> directory:</p>
1731 Include conf/ssl.conf<br />
1732 Include conf/vhosts/*.conf
1735 <p>Wildcards may be included in the directory or file portion of the
1736 path. In the following example, the server will fail to load if no
1737 directories match conf/vhosts/*, but will load successfully if no
1738 files match *.conf.</p>
1741 Include conf/vhosts/*/vhost.conf<br />
1742 Include conf/vhosts/*/*.conf
1745 <p>In this example, the server will fail to load if either
1746 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1749 Include strict conf/vhosts/*/*.conf
1752 <p>In this example, the server load successfully if either conf/vhosts/*
1753 matches no directories, or if *.conf matches no files:</p>
1756 Include optional conf/vhosts/*/*.conf
1761 <seealso><program>apachectl</program></seealso>
1762 </directivesynopsis>
1765 <name>KeepAlive</name>
1766 <description>Enables HTTP persistent connections</description>
1767 <syntax>KeepAlive On|Off</syntax>
1768 <default>KeepAlive On</default>
1769 <contextlist><context>server config</context><context>virtual host</context>
1773 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1774 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1775 which allow multiple requests to be sent over the same TCP
1776 connection. In some cases this has been shown to result in an
1777 almost 50% speedup in latency times for HTML documents with
1778 many images. To enable Keep-Alive connections, set
1779 <code>KeepAlive On</code>.</p>
1781 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1782 used if they are specifically requested by a client. In
1783 addition, a Keep-Alive connection with an HTTP/1.0 client can
1784 only be used when the length of the content is known in
1785 advance. This implies that dynamic content such as CGI output,
1786 SSI pages, and server-generated directory listings will
1787 generally not use Keep-Alive connections to HTTP/1.0 clients.
1788 For HTTP/1.1 clients, persistent connections are the default
1789 unless otherwise specified. If the client requests it, chunked
1790 encoding will be used in order to send content of unknown
1791 length over persistent connections.</p>
1793 <p>When a client uses a Keep-Alive connection it will be counted
1794 as a single "request" for the <directive module="mpm_common"
1795 >MaxConnectionsPerChild</directive> directive, regardless
1796 of how many requests are sent using the connection.</p>
1799 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1800 </directivesynopsis>
1803 <name>KeepAliveTimeout</name>
1804 <description>Amount of time the server will wait for subsequent
1805 requests on a persistent connection</description>
1806 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1807 <default>KeepAliveTimeout 5</default>
1808 <contextlist><context>server config</context><context>virtual host</context>
1810 <compatibility>Specifying a value in milliseconds is available in
1811 Apache httpd 2.3.2 and later</compatibility>
1814 <p>The number of seconds Apache httpd will wait for a subsequent
1815 request before closing the connection. By adding a postfix of ms the
1816 timeout can be also set in milliseconds. Once a request has been
1817 received, the timeout value specified by the
1818 <directive module="core">Timeout</directive> directive applies.</p>
1820 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1821 may cause performance problems in heavily loaded servers. The
1822 higher the timeout, the more server processes will be kept
1823 occupied waiting on connections with idle clients.</p>
1825 <p>In a name-based virtual host context, the value of the first
1826 defined virtual host (the default host) in a set of <directive
1827 module="core">NameVirtualHost</directive> will be used.
1828 The other values will be ignored.</p>
1830 </directivesynopsis>
1832 <directivesynopsis type="section">
1834 <description>Restrict enclosed access controls to only certain HTTP
1835 methods</description>
1836 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1837 </Limit></syntax>
1838 <contextlist><context>directory</context><context>.htaccess</context>
1840 <override>AuthConfig, Limit</override>
1843 <p>Access controls are normally effective for
1844 <strong>all</strong> access methods, and this is the usual
1845 desired behavior. <strong>In the general case, access control
1846 directives should not be placed within a
1847 <directive type="section">Limit</directive> section.</strong></p>
1849 <p>The purpose of the <directive type="section">Limit</directive>
1850 directive is to restrict the effect of the access controls to the
1851 nominated HTTP methods. For all other methods, the access
1852 restrictions that are enclosed in the <directive
1853 type="section">Limit</directive> bracket <strong>will have no
1854 effect</strong>. The following example applies the access control
1855 only to the methods <code>POST</code>, <code>PUT</code>, and
1856 <code>DELETE</code>, leaving all other methods unprotected:</p>
1859 <Limit POST PUT DELETE><br />
1861 Require valid-user<br />
1866 <p>The method names listed can be one or more of: <code>GET</code>,
1867 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1868 <code>CONNECT</code>, <code>OPTIONS</code>,
1869 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1870 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1871 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1872 case-sensitive.</strong> If <code>GET</code> is used it will also
1873 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1874 cannot be limited (see <directive module="core"
1875 >TraceEnable</directive>).</p>
1877 <note type="warning">A <directive type="section"
1878 module="core">LimitExcept</directive> section should always be
1879 used in preference to a <directive type="section">Limit</directive>
1880 section when restricting access, since a <directive type="section"
1881 module="core">LimitExcept</directive> section provides protection
1882 against arbitrary methods.</note>
1884 <p>The <directive type="section">Limit</directive> and
1885 <directive type="section" module="core">LimitExcept</directive>
1886 directives may be nested. In this case, each successive level of
1887 <directive type="section">Limit</directive> or <directive
1888 type="section" module="core">LimitExcept</directive> directives must
1889 further restrict the set of methods to which access controls apply.</p>
1891 <note type="warning">When using
1892 <directive type="section">Limit</directive> or
1893 <directive type="section">LimitExcept</directive> directives with
1894 the <directive module="mod_authz_core">Require</directive> directive,
1895 note that the first <directive module="mod_authz_core">Require</directive>
1896 to succeed authorizes the request, regardless of the presence of other
1897 <directive module="mod_authz_core">Require</directive> directives.</note>
1899 <p>For example, given the following configuration, all users will
1900 be authorized for <code>POST</code> requests, and the
1901 <code>Require group editors</code> directive will be ignored
1905 <LimitExcept GET>
1909 </LimitExcept><br />
1912 Require group editors
1917 </directivesynopsis>
1919 <directivesynopsis type="section">
1920 <name>LimitExcept</name>
1921 <description>Restrict access controls to all HTTP methods
1922 except the named ones</description>
1923 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1924 </LimitExcept></syntax>
1925 <contextlist><context>directory</context><context>.htaccess</context>
1927 <override>AuthConfig, Limit</override>
1930 <p><directive type="section">LimitExcept</directive> and
1931 <code></LimitExcept></code> are used to enclose
1932 a group of access control directives which will then apply to any
1933 HTTP access method <strong>not</strong> listed in the arguments;
1934 i.e., it is the opposite of a <directive type="section"
1935 module="core">Limit</directive> section and can be used to control
1936 both standard and nonstandard/unrecognized methods. See the
1937 documentation for <directive module="core"
1938 type="section">Limit</directive> for more details.</p>
1943 <LimitExcept POST GET><br />
1945 Require valid-user<br />
1947 </LimitExcept>
1951 </directivesynopsis>
1954 <name>LimitInternalRecursion</name>
1955 <description>Determine maximum number of internal redirects and nested
1956 subrequests</description>
1957 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
1958 <default>LimitInternalRecursion 10</default>
1959 <contextlist><context>server config</context><context>virtual host</context>
1961 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
1964 <p>An internal redirect happens, for example, when using the <directive
1965 module="mod_actions">Action</directive> directive, which internally
1966 redirects the original request to a CGI script. A subrequest is Apache httpd's
1967 mechanism to find out what would happen for some URI if it were requested.
1968 For example, <module>mod_dir</module> uses subrequests to look for the
1969 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
1972 <p><directive>LimitInternalRecursion</directive> prevents the server
1973 from crashing when entering an infinite loop of internal redirects or
1974 subrequests. Such loops are usually caused by misconfigurations.</p>
1976 <p>The directive stores two different limits, which are evaluated on
1977 per-request basis. The first <var>number</var> is the maximum number of
1978 internal redirects, that may follow each other. The second <var>number</var>
1979 determines, how deep subrequests may be nested. If you specify only one
1980 <var>number</var>, it will be assigned to both limits.</p>
1982 <example><title>Example</title>
1983 LimitInternalRecursion 5
1986 </directivesynopsis>
1989 <name>LimitRequestBody</name>
1990 <description>Restricts the total size of the HTTP request body sent
1991 from the client</description>
1992 <syntax>LimitRequestBody <var>bytes</var></syntax>
1993 <default>LimitRequestBody 0</default>
1994 <contextlist><context>server config</context><context>virtual host</context>
1995 <context>directory</context><context>.htaccess</context>
1997 <override>All</override>
2000 <p>This directive specifies the number of <var>bytes</var> from 0
2001 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2004 <p>The <directive>LimitRequestBody</directive> directive allows
2005 the user to set a limit on the allowed size of an HTTP request
2006 message body within the context in which the directive is given
2007 (server, per-directory, per-file or per-location). If the client
2008 request exceeds that limit, the server will return an error
2009 response instead of servicing the request. The size of a normal
2010 request message body will vary greatly depending on the nature of
2011 the resource and the methods allowed on that resource. CGI scripts
2012 typically use the message body for retrieving form information.
2013 Implementations of the <code>PUT</code> method will require
2014 a value at least as large as any representation that the server
2015 wishes to accept for that resource.</p>
2017 <p>This directive gives the server administrator greater
2018 control over abnormal client request behavior, which may be
2019 useful for avoiding some forms of denial-of-service
2022 <p>If, for example, you are permitting file upload to a particular
2023 location, and wish to limit the size of the uploaded file to 100K,
2024 you might use the following directive:</p>
2027 LimitRequestBody 102400
2031 </directivesynopsis>
2034 <name>LimitRequestFields</name>
2035 <description>Limits the number of HTTP request header fields that
2036 will be accepted from the client</description>
2037 <syntax>LimitRequestFields <var>number</var></syntax>
2038 <default>LimitRequestFields 100</default>
2039 <contextlist><context>server config</context></contextlist>
2042 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2043 32767. The default value is defined by the compile-time
2044 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2047 <p>The <directive>LimitRequestFields</directive> directive allows
2048 the server administrator to modify the limit on the number of
2049 request header fields allowed in an HTTP request. A server needs
2050 this value to be larger than the number of fields that a normal
2051 client request might include. The number of request header fields
2052 used by a client rarely exceeds 20, but this may vary among
2053 different client implementations, often depending upon the extent
2054 to which a user has configured their browser to support detailed
2055 content negotiation. Optional HTTP extensions are often expressed
2056 using request header fields.</p>
2058 <p>This directive gives the server administrator greater
2059 control over abnormal client request behavior, which may be
2060 useful for avoiding some forms of denial-of-service attacks.
2061 The value should be increased if normal clients see an error
2062 response from the server that indicates too many fields were
2063 sent in the request.</p>
2068 LimitRequestFields 50
2072 </directivesynopsis>
2075 <name>LimitRequestFieldSize</name>
2076 <description>Limits the size of the HTTP request header allowed from the
2077 client</description>
2078 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2079 <default>LimitRequestFieldSize 8190</default>
2080 <contextlist><context>server config</context></contextlist>
2083 <p>This directive specifies the number of <var>bytes</var>
2084 that will be allowed in an HTTP request header.</p>
2086 <p>The <directive>LimitRequestFieldSize</directive> directive
2087 allows the server administrator to reduce or increase the limit
2088 on the allowed size of an HTTP request header field. A server
2089 needs this value to be large enough to hold any one header field
2090 from a normal client request. The size of a normal request header
2091 field will vary greatly among different client implementations,
2092 often depending upon the extent to which a user has configured
2093 their browser to support detailed content negotiation. SPNEGO
2094 authentication headers can be up to 12392 bytes.</p>
2096 <p>This directive gives the server administrator greater
2097 control over abnormal client request behavior, which may be
2098 useful for avoiding some forms of denial-of-service attacks.</p>
2103 LimitRequestFieldSize 4094
2106 <note>Under normal conditions, the value should not be changed from
2110 </directivesynopsis>
2113 <name>LimitRequestLine</name>
2114 <description>Limit the size of the HTTP request line that will be accepted
2115 from the client</description>
2116 <syntax>LimitRequestLine <var>bytes</var></syntax>
2117 <default>LimitRequestLine 8190</default>
2118 <contextlist><context>server config</context></contextlist>
2121 <p>This directive sets the number of <var>bytes</var> that will be
2122 allowed on the HTTP request-line.</p>
2124 <p>The <directive>LimitRequestLine</directive> directive allows
2125 the server administrator to reduce or increase the limit on the allowed size
2126 of a client's HTTP request-line. Since the request-line consists of the
2127 HTTP method, URI, and protocol version, the
2128 <directive>LimitRequestLine</directive> directive places a
2129 restriction on the length of a request-URI allowed for a request
2130 on the server. A server needs this value to be large enough to
2131 hold any of its resource names, including any information that
2132 might be passed in the query part of a <code>GET</code> request.</p>
2134 <p>This directive gives the server administrator greater
2135 control over abnormal client request behavior, which may be
2136 useful for avoiding some forms of denial-of-service attacks.</p>
2141 LimitRequestLine 4094
2144 <note>Under normal conditions, the value should not be changed from
2147 </directivesynopsis>
2150 <name>LimitXMLRequestBody</name>
2151 <description>Limits the size of an XML-based request body</description>
2152 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2153 <default>LimitXMLRequestBody 1000000</default>
2154 <contextlist><context>server config</context><context>virtual host</context>
2155 <context>directory</context><context>.htaccess</context></contextlist>
2156 <override>All</override>
2159 <p>Limit (in bytes) on maximum size of an XML-based request
2160 body. A value of <code>0</code> will disable any checking.</p>
2165 LimitXMLRequestBody 0
2169 </directivesynopsis>
2171 <directivesynopsis type="section">
2172 <name>Location</name>
2173 <description>Applies the enclosed directives only to matching
2175 <syntax><Location
2176 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2177 <contextlist><context>server config</context><context>virtual host</context>
2181 <p>The <directive type="section">Location</directive> directive
2182 limits the scope of the enclosed directives by URL. It is similar to the
2183 <directive type="section" module="core">Directory</directive>
2184 directive, and starts a subsection which is terminated with a
2185 <code></Location></code> directive. <directive
2186 type="section">Location</directive> sections are processed in the
2187 order they appear in the configuration file, after the <directive
2188 type="section" module="core">Directory</directive> sections and
2189 <code>.htaccess</code> files are read, and after the <directive
2190 type="section" module="core">Files</directive> sections.</p>
2192 <p><directive type="section">Location</directive> sections operate
2193 completely outside the filesystem. This has several consequences.
2194 Most importantly, <directive type="section">Location</directive>
2195 directives should not be used to control access to filesystem
2196 locations. Since several different URLs may map to the same
2197 filesystem location, such access controls may by circumvented.</p>
2199 <note><title>When to use <directive
2200 type="section">Location</directive></title>
2202 <p>Use <directive type="section">Location</directive> to apply
2203 directives to content that lives outside the filesystem. For
2204 content that lives in the filesystem, use <directive
2205 type="section" module="core">Directory</directive> and <directive
2206 type="section" module="core">Files</directive>. An exception is
2207 <code><Location /></code>, which is an easy way to
2208 apply a configuration to the entire server.</p>
2211 <p>For all origin (non-proxy) requests, the URL to be matched is a
2212 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2213 port, or query string may be included.</em> For proxy requests, the
2214 URL to be matched is of the form
2215 <code>scheme://servername/path</code>, and you must include the
2218 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2219 any single character, and <code>*</code> matches any sequences of
2220 characters. Neither wildcard character matches a / in the URL-path.</p>
2222 <p><glossary ref="regex">Regular expressions</glossary>
2223 can also be used, with the addition of the <code>~</code>
2224 character. For example:</p>
2227 <Location ~ "/(extra|special)/data">
2230 <p>would match URLs that contained the substring <code>/extra/data</code>
2231 or <code>/special/data</code>. The directive <directive
2232 type="section" module="core">LocationMatch</directive> behaves
2233 identical to the regex version of <directive
2234 type="section">Location</directive>, and is preferred, for the
2235 simple reason that <code>~</code> is hard to distinguish from
2236 <code>-</code> in many fonts.</p>
2238 <p>The <directive type="section">Location</directive>
2239 functionality is especially useful when combined with the
2240 <directive module="core">SetHandler</directive>
2241 directive. For example, to enable status requests, but allow them
2242 only from browsers at <code>example.com</code>, you might use:</p>
2245 <Location /status><br />
2247 SetHandler server-status<br />
2248 Order Deny,Allow<br />
2250 Allow from .example.com<br />
2255 <note><title>Note about / (slash)</title>
2256 <p>The slash character has special meaning depending on where in a
2257 URL it appears. People may be used to its behavior in the filesystem
2258 where multiple adjacent slashes are frequently collapsed to a single
2259 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2260 <code>/home/foo</code>). In URL-space this is not necessarily true.
2261 The <directive type="section" module="core">LocationMatch</directive>
2262 directive and the regex version of <directive type="section"
2263 >Location</directive> require you to explicitly specify multiple
2264 slashes if that is your intention.</p>
2266 <p>For example, <code><LocationMatch ^/abc></code> would match
2267 the request URL <code>/abc</code> but not the request URL <code>
2268 //abc</code>. The (non-regex) <directive type="section"
2269 >Location</directive> directive behaves similarly when used for
2270 proxy requests. But when (non-regex) <directive type="section"
2271 >Location</directive> is used for non-proxy requests it will
2272 implicitly match multiple slashes with a single slash. For example,
2273 if you specify <code><Location /abc/def></code> and the
2274 request is to <code>/abc//def</code> then it will match.</p>
2277 <seealso><a href="../sections.html">How <Directory>, <Location>
2278 and <Files> sections work</a> for an explanation of how these
2279 different sections are combined when a request is received.</seealso>
2280 <seealso><directive module="core">LocationMatch</directive></seealso>
2281 </directivesynopsis>
2283 <directivesynopsis type="section">
2284 <name>LocationMatch</name>
2285 <description>Applies the enclosed directives only to regular-expression
2286 matching URLs</description>
2287 <syntax><LocationMatch
2288 <var>regex</var>> ... </LocationMatch></syntax>
2289 <contextlist><context>server config</context><context>virtual host</context>
2293 <p>The <directive type="section">LocationMatch</directive> directive
2294 limits the scope of the enclosed directives by URL, in an identical manner
2295 to <directive module="core" type="section">Location</directive>. However,
2296 it takes a <glossary ref="regex">regular expression</glossary>
2297 as an argument instead of a simple string. For example:</p>
2300 <LocationMatch "/(extra|special)/data">
2303 <p>would match URLs that contained the substring <code>/extra/data</code>
2304 or <code>/special/data</code>.</p>
2307 <seealso><a href="../sections.html">How <Directory>, <Location>
2308 and <Files> sections work</a> for an explanation of how these
2309 different sections are combined when a request is received</seealso>
2310 </directivesynopsis>
2313 <name>LogLevel</name>
2314 <description>Controls the verbosity of the ErrorLog</description>
2315 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2316 [<var>module</var>:<var>level</var>] ...
2318 <default>LogLevel warn</default>
2319 <contextlist><context>server config</context><context>virtual host</context>
2320 <context>directory</context>
2322 <compatibility>Per-module and per-directory configuration is available in
2323 Apache HTTP Server 2.3.6 and later</compatibility>
2326 <p><directive>LogLevel</directive> adjusts the verbosity of the
2327 messages recorded in the error logs (see <directive
2328 module="core">ErrorLog</directive> directive). The following
2329 <var>level</var>s are available, in order of decreasing
2333 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2336 <th><strong>Level</strong> </th>
2338 <th><strong>Description</strong> </th>
2340 <th><strong>Example</strong> </th>
2344 <td><code>emerg</code> </td>
2346 <td>Emergencies - system is unusable.</td>
2348 <td>"Child cannot open lock file. Exiting"</td>
2352 <td><code>alert</code> </td>
2354 <td>Action must be taken immediately.</td>
2356 <td>"getpwuid: couldn't determine user name from uid"</td>
2360 <td><code>crit</code> </td>
2362 <td>Critical Conditions.</td>
2364 <td>"socket: Failed to get a socket, exiting child"</td>
2368 <td><code>error</code> </td>
2370 <td>Error conditions.</td>
2372 <td>"Premature end of script headers"</td>
2376 <td><code>warn</code> </td>
2378 <td>Warning conditions.</td>
2380 <td>"child process 1234 did not exit, sending another
2385 <td><code>notice</code> </td>
2387 <td>Normal but significant condition.</td>
2389 <td>"httpd: caught SIGBUS, attempting to dump core in
2394 <td><code>info</code> </td>
2396 <td>Informational.</td>
2398 <td>"Server seems busy, (you may need to increase
2399 StartServers, or Min/MaxSpareServers)..."</td>
2403 <td><code>debug</code> </td>
2405 <td>Debug-level messages</td>
2407 <td>"Opening config file ..."</td>
2410 <td><code>trace1</code> </td>
2412 <td>Trace messages</td>
2414 <td>"proxy: FTP: control connection complete"</td>
2417 <td><code>trace2</code> </td>
2419 <td>Trace messages</td>
2421 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2424 <td><code>trace3</code> </td>
2426 <td>Trace messages</td>
2428 <td>"openssl: Handshake: start"</td>
2431 <td><code>trace4</code> </td>
2433 <td>Trace messages</td>
2435 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2438 <td><code>trace5</code> </td>
2440 <td>Trace messages</td>
2442 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2445 <td><code>trace6</code> </td>
2447 <td>Trace messages</td>
2449 <td>"cache lookup FAILED, forcing new map lookup"</td>
2452 <td><code>trace7</code> </td>
2454 <td>Trace messages, dumping large amounts of data</td>
2456 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2459 <td><code>trace8</code> </td>
2461 <td>Trace messages, dumping large amounts of data</td>
2463 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2467 <p>When a particular level is specified, messages from all
2468 other levels of higher significance will be reported as well.
2469 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2470 then messages with log levels of <code>notice</code> and
2471 <code>warn</code> will also be posted.</p>
2473 <p>Using a level of at least <code>crit</code> is
2482 <note><title>Note</title>
2483 <p>When logging to a regular file messages of the level
2484 <code>notice</code> cannot be suppressed and thus are always
2485 logged. However, this doesn't apply when logging is done
2486 using <code>syslog</code>.</p>
2489 <p>Specifying a level without a module name will reset the level
2490 for all modules to that level. Specifying a level with a module
2491 name will set the level for that module only. It is possible to
2492 use the module source file name, the module identifier, or the
2493 module identifier with the trailing <code>_module</code> omitted
2494 as module specification. This means the following three specifications
2498 LogLevel info ssl:warn<br />
2499 LogLevel info mod_ssl.c:warn<br />
2500 LogLevel info ssl_module:warn<br />
2503 <p>It is also possible to change the level per directory:</p>
2507 <Directory /usr/local/apache/htdocs/app><br />
2508 LogLevel debug<br />
2513 Per directory loglevel configuration only affects messages that are
2514 logged after the request has been parsed and that are associated with
2515 the request. Log messages which are associated with the connection or
2516 the server are not affected.
2519 </directivesynopsis>
2522 <name>MaxKeepAliveRequests</name>
2523 <description>Number of requests allowed on a persistent
2524 connection</description>
2525 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2526 <default>MaxKeepAliveRequests 100</default>
2527 <contextlist><context>server config</context><context>virtual host</context>
2531 <p>The <directive>MaxKeepAliveRequests</directive> directive
2532 limits the number of requests allowed per connection when
2533 <directive module="core" >KeepAlive</directive> is on. If it is
2534 set to <code>0</code>, unlimited requests will be allowed. We
2535 recommend that this setting be kept to a high value for maximum
2536 server performance.</p>
2541 MaxKeepAliveRequests 500
2544 </directivesynopsis>
2548 <description>Configures mutex mechanism and lock file directory for all
2549 or specified mutexes</description>
2550 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2551 <default>Mutex default</default>
2552 <contextlist><context>server config</context></contextlist>
2553 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2556 <p>The <directive>Mutex</directive> directive sets the mechanism,
2557 and optionally the lock file location, that httpd and modules use
2558 to serialize access to resources. Specify <code>default</code> as
2559 the first argument to change the settings for all mutexes; specify
2560 a mutex name (see table below) as the first argument to override
2561 defaults only for that mutex.</p>
2563 <p>The <directive>Mutex</directive> directive is typically used in
2564 the following exceptional situations:</p>
2567 <li>change the mutex mechanism when the default mechanism selected
2568 by <glossary>APR</glossary> has a functional or performance
2571 <li>change the directory used by file-based mutexes when the
2572 default directory does not support locking</li>
2575 <note><title>Supported modules</title>
2576 <p>This directive only configures mutexes which have been registered
2577 with the core server using the <code>ap_mutex_register()</code> API.
2578 All modules bundled with httpd support the <directive>Mutex</directive>
2579 directive, but third-party modules may not. Consult the documentation
2580 of the third-party module, which must indicate the mutex name(s) which
2581 can be configured if this directive is supported.</p>
2584 <p>The following mutex <em>mechanisms</em> are available:</p>
2586 <li><code>default | yes</code>
2587 <p>This selects the default locking implementation, as determined by
2588 <glossary>APR</glossary>. The default locking implementation can
2589 be displayed by running <program>httpd</program> with the
2590 <code>-V</code> option.</p></li>
2592 <li><code>none | no</code>
2593 <p>This effectively disables the mutex, and is only allowed for a
2594 mutex if the module indicates that it is a valid choice. Consult the
2595 module documentation for more information.</p></li>
2597 <li><code>posixsem</code>
2598 <p>This is a mutex variant based on a Posix semaphore.</p>
2600 <note type="warning"><title>Warning</title>
2601 <p>The semaphore ownership is not recovered if a thread in the process
2602 holding the mutex segfaults, resulting in a hang of the web server.</p>
2606 <li><code>sysvsem</code>
2607 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2609 <note type="warning"><title>Warning</title>
2610 <p>It is possible to "leak" SysV semaphores if processes crash
2611 before the semaphore is removed.</p>
2614 <note type="warning"><title>Security</title>
2615 <p>The semaphore API allows for a denial of service attack by any
2616 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2617 all CGIs, unless you use something like <program>suexec</program>
2618 or <code>cgiwrapper</code>).</p>
2622 <li><code>sem</code>
2623 <p>This selects the "best" available semaphore implementation, choosing
2624 between Posix and SystemV IPC semaphores, in that order.</p></li>
2626 <li><code>pthread</code>
2627 <p>This is a mutex variant based on cross-process Posix thread
2630 <note type="warning"><title>Warning</title>
2631 <p>On most systems, if a child process terminates abnormally while
2632 holding a mutex that uses this implementation, the server will deadlock
2633 and stop responding to requests. When this occurs, the server will
2634 require a manual restart to recover.</p>
2635 <p>Solaris is a notable exception as it provides a mechanism which
2636 usually allows the mutex to be recovered after a child process
2637 terminates abnormally while holding a mutex.</p>
2638 <p>If your system implements the
2639 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2640 to use the <code>pthread</code> option safely.</p>
2644 <li><code>fcntl:/path/to/mutex</code>
2645 <p>This is a mutex variant where a physical (lock-)file and the
2646 <code>fcntl()</code> function are used as the mutex.</p>
2648 <note type="warning"><title>Warning</title>
2649 <p>When multiple mutexes based on this mechanism are used within
2650 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2651 can be reported for valid mutex operations if <code>fcntl()</code>
2652 is not thread-aware, such as on Solaris.</p>
2656 <li><code>flock:/path/to/mutex</code>
2657 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2658 with the exception that the <code>flock()</code> function is used to
2659 provide file locking.</p></li>
2661 <li><code>file:/path/to/mutex</code>
2662 <p>This selects the "best" available file locking implementation,
2663 choosing between <code>fcntl</code> and <code>flock</code>, in that
2667 <p>Most mechanisms are only available on selected platforms, where the
2668 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2669 which aren't available on all platforms are <em>posixsem</em>,
2670 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2671 <em>flock</em>, and <em>file</em>.</p>
2673 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2674 the path, if provided, is a directory where the lock file will be created.
2675 The default directory is httpd's run-time file directory relative to
2676 <directive module="core">ServerRoot</directive>. Always use a local disk
2677 filesystem for <code>/path/to/mutex</code> and never a directory residing
2678 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2679 type, an optional instance string provided by the module, and unless the
2680 <code>OmitPID</code> keyword is specified, the process id of the httpd
2681 parent process will be appended to to make the file name unique, avoiding
2682 conflicts when multiple httpd instances share a lock file directory. For
2683 example, if the mutex name is <code>mpm-accept</code> and the lock file
2684 directory is <code>/var/httpd/locks</code>, the lock file name for the
2685 httpd instance with parent process id 12345 would be
2686 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2688 <note type="warning"><title>Security</title>
2689 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2690 directory such as <code>/var/tmp</code> because someone could create
2691 a denial of service attack and prevent the server from starting by
2692 creating a lockfile with the same name as the one the server will try
2696 <p>The following table documents the names of mutexes used by httpd
2697 and bundled modules.</p>
2699 <table border="1" style="zebra">
2703 <th>Protected resource</th>
2706 <td><code>mpm-accept</code></td>
2707 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2708 <td>incoming connections, to avoid the thundering herd problem;
2709 for more information, refer to the
2710 <a href="../misc/perf-tuning.html">performance tuning</a>
2714 <td><code>authdigest-client</code></td>
2715 <td><module>mod_auth_digest</module></td>
2716 <td>client list in shared memory</td>
2719 <td><code>authdigest-opaque</code></td>
2720 <td><module>mod_auth_digest</module></td>
2721 <td>counter in shared memory</td>
2724 <td><code>ldap-cache</code></td>
2725 <td><module>mod_ldap</module></td>
2726 <td>LDAP result cache</td>
2729 <td><code>rewrite-map</code></td>
2730 <td><module>mod_rewrite</module></td>
2731 <td>communication with external mapping programs, to avoid
2732 intermixed I/O from multiple requests</td>
2735 <td><code>ssl-cache</code></td>
2736 <td><module>mod_ssl</module></td>
2737 <td>SSL session cache</td>
2740 <td><code>ssl-stapling</code></td>
2741 <td><module>mod_ssl</module></td>
2742 <td>OCSP stapling response cache</td>
2745 <td><code>watchdog-callback</code></td>
2746 <td><module>mod_watchdog</module></td>
2747 <td>callback function of a particular client module</td>
2751 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2752 parent process id from the lock file name.</p>
2754 <p>In the following example, the mutex mechanism for the MPM accept
2755 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2756 with the associated lock file created in directory
2757 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2758 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2761 Mutex default sysvsem<br />
2762 Mutex mpm-accept fcntl:/var/httpd/locks
2765 </directivesynopsis>
2768 <name>NameVirtualHost</name>
2769 <description>Designates an IP address for name-virtual
2770 hosting</description>
2771 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2772 <contextlist><context>server config</context></contextlist>
2776 <p>A single <directive>NameVirtualHost</directive> directive
2777 identifies a set of identical virtual hosts on which the server will
2778 further select from on the basis of the <em>hostname</em>
2779 requested by the client. The <directive>NameVirtualHost</directive>
2780 directive is a required directive if you want to configure
2781 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2783 <p>This directive, and the corresponding <directive >VirtualHost</directive>,
2784 <em>must</em> be qualified with a port number if the server supports both HTTP
2785 and HTTPS connections.</p>
2787 <p>Although <var>addr</var> can be a hostname, it is recommended
2788 that you always use an IP address or a wildcard. A wildcard
2789 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2790 as their argument.</p>
2792 <p>In cases where a firewall or other proxy receives the requests and
2793 forwards them on a different IP address to the server, you must specify the
2794 IP address of the physical interface on the machine which will be
2795 servicing the requests. </p>
2797 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2798 will only select among the first two virtual hosts. Requests received on
2799 port 80 on any other interface will only select among the third and fourth
2800 virtual hosts. In the common case where the interface isn't important
2801 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2805 NameVirtualHost 192.0.2.1:80<br />
2806 NameVirtualHost *:80<br /><br />
2808 <VirtualHost 192.0.2.1:80><br />
2809 ServerName namebased-a.example.com<br />
2810 </VirtualHost><br />
2812 <VirtualHost 192.0.2.1:80><br />
2813 Servername namebased-b.example.com<br />
2814 </VirtualHost><br />
2816 <VirtualHost *:80><br />
2817 ServerName namebased-c.example.com <br />
2818 </VirtualHost><br />
2820 <VirtualHost *:80><br />
2821 ServerName namebased-d.example.com <br />
2822 </VirtualHost><br />
2827 <p>If no matching virtual host is found, then the first listed
2828 virtual host that matches the IP address and port will be used.</p>
2831 <p>IPv6 addresses must be enclosed in square brackets, as shown
2832 in the following example:</p>
2835 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2838 <note><title>Argument to <directive type="section">VirtualHost</directive>
2840 <p>Note that the argument to the <directive
2841 type="section">VirtualHost</directive> directive must
2842 exactly match the argument to the <directive
2843 >NameVirtualHost</directive> directive.</p>
2846 NameVirtualHost 192.0.2.2:80<br />
2847 <VirtualHost 192.0.2.2:80><br />
2849 </VirtualHost><br />
2854 <seealso><a href="../vhosts/">Virtual Hosts
2855 documentation</a></seealso>
2857 </directivesynopsis>
2860 <name>Options</name>
2861 <description>Configures what features are available in a particular
2862 directory</description>
2864 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2865 <default>Options All</default>
2866 <contextlist><context>server config</context><context>virtual host</context>
2867 <context>directory</context><context>.htaccess</context>
2869 <override>Options</override>
2872 <p>The <directive>Options</directive> directive controls which
2873 server features are available in a particular directory.</p>
2875 <p><var>option</var> can be set to <code>None</code>, in which
2876 case none of the extra features are enabled, or one or more of
2880 <dt><code>All</code></dt>
2882 <dd>All options except for <code>MultiViews</code>. This is the default
2885 <dt><code>ExecCGI</code></dt>
2888 Execution of CGI scripts using <module>mod_cgi</module>
2891 <dt><code>FollowSymLinks</code></dt>
2895 The server will follow symbolic links in this directory.
2897 <p>Even though the server follows the symlink it does <em>not</em>
2898 change the pathname used to match against <directive type="section"
2899 module="core">Directory</directive> sections.</p>
2900 <p>Note also, that this option <strong>gets ignored</strong> if set
2901 inside a <directive type="section" module="core">Location</directive>
2903 <p>Omitting this option should not be considered a security restriction,
2904 since symlink testing is subject to race conditions that make it
2908 <dt><code>Includes</code></dt>
2911 Server-side includes provided by <module>mod_include</module>
2914 <dt><code>IncludesNOEXEC</code></dt>
2918 Server-side includes are permitted, but the <code>#exec
2919 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2920 possible to <code>#include virtual</code> CGI scripts from
2921 <directive module="mod_alias">ScriptAlias</directive>ed
2924 <dt><code>Indexes</code></dt>
2927 If a URL which maps to a directory is requested, and there
2928 is no <directive module="mod_dir">DirectoryIndex</directive>
2929 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2930 <module>mod_autoindex</module> will return a formatted listing
2931 of the directory.</dd>
2933 <dt><code>MultiViews</code></dt>
2936 <a href="../content-negotiation.html">Content negotiated</a>
2937 "MultiViews" are allowed using
2938 <module>mod_negotiation</module>.</dd>
2940 <dt><code>SymLinksIfOwnerMatch</code></dt>
2942 <dd>The server will only follow symbolic links for which the
2943 target file or directory is owned by the same user id as the
2946 <note><title>Note</title> <p>This option gets ignored if
2947 set inside a <directive module="core"
2948 type="section">Location</directive> section.</p>
2949 <p>This option should not be considered a security restriction,
2950 since symlink testing is subject to race conditions that make it
2951 circumventable.</p></note>
2955 <p>Normally, if multiple <directive>Options</directive> could
2956 apply to a directory, then the most specific one is used and
2957 others are ignored; the options are not merged. (See <a
2958 href="../sections.html#mergin">how sections are merged</a>.)
2959 However if <em>all</em> the options on the
2960 <directive>Options</directive> directive are preceded by a
2961 <code>+</code> or <code>-</code> symbol, the options are
2962 merged. Any options preceded by a <code>+</code> are added to the
2963 options currently in force, and any options preceded by a
2964 <code>-</code> are removed from the options currently in
2967 <note type="warning"><title>Warning</title>
2968 <p>Mixing <directive>Options</directive> with a <code>+</code> or
2969 <code>-</code> with those without is not valid syntax, and is likely
2970 to cause unexpected results.</p>
2973 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2976 <Directory /web/docs><br />
2978 Options Indexes FollowSymLinks<br />
2980 </Directory><br />
2982 <Directory /web/docs/spec><br />
2984 Options Includes<br />
2989 <p>then only <code>Includes</code> will be set for the
2990 <code>/web/docs/spec</code> directory. However if the second
2991 <directive>Options</directive> directive uses the <code>+</code> and
2992 <code>-</code> symbols:</p>
2995 <Directory /web/docs><br />
2997 Options Indexes FollowSymLinks<br />
2999 </Directory><br />
3001 <Directory /web/docs/spec><br />
3003 Options +Includes -Indexes<br />
3008 <p>then the options <code>FollowSymLinks</code> and
3009 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3012 <note><title>Note</title>
3013 <p>Using <code>-IncludesNOEXEC</code> or
3014 <code>-Includes</code> disables server-side includes completely
3015 regardless of the previous setting.</p>
3018 <p>The default in the absence of any other settings is
3019 <code>All</code>.</p>
3021 </directivesynopsis>
3024 <name>RLimitCPU</name>
3025 <description>Limits the CPU consumption of processes launched
3026 by Apache httpd children</description>
3027 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3028 <default>Unset; uses operating system defaults</default>
3029 <contextlist><context>server config</context><context>virtual host</context>
3030 <context>directory</context><context>.htaccess</context></contextlist>
3031 <override>All</override>
3034 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3035 resource limit for all processes and the second parameter sets
3036 the maximum resource limit. Either parameter can be a number,
3037 or <code>max</code> to indicate to the server that the limit should
3038 be set to the maximum allowed by the operating system
3039 configuration. Raising the maximum resource limit requires that
3040 the server is running as <code>root</code>, or in the initial startup
3043 <p>This applies to processes forked off from Apache httpd children
3044 servicing requests, not the Apache httpd children themselves. This
3045 includes CGI scripts and SSI exec commands, but not any
3046 processes forked off from the Apache httpd parent such as piped
3049 <p>CPU resource limits are expressed in seconds per
3052 <seealso><directive module="core">RLimitMEM</directive></seealso>
3053 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3054 </directivesynopsis>
3057 <name>RLimitMEM</name>
3058 <description>Limits the memory consumption of processes launched
3059 by Apache httpd children</description>
3060 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3061 <default>Unset; uses operating system defaults</default>
3062 <contextlist><context>server config</context><context>virtual host</context>
3063 <context>directory</context><context>.htaccess</context></contextlist>
3064 <override>All</override>
3067 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3068 resource limit for all processes and the second parameter sets
3069 the maximum resource limit. Either parameter can be a number,
3070 or <code>max</code> to indicate to the server that the limit should
3071 be set to the maximum allowed by the operating system
3072 configuration. Raising the maximum resource limit requires that
3073 the server is running as <code>root</code>, or in the initial startup
3076 <p>This applies to processes forked off from Apache httpd children
3077 servicing requests, not the Apache httpd children themselves. This
3078 includes CGI scripts and SSI exec commands, but not any
3079 processes forked off from the Apache httpd parent such as piped
3082 <p>Memory resource limits are expressed in bytes per
3085 <seealso><directive module="core">RLimitCPU</directive></seealso>
3086 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3087 </directivesynopsis>
3090 <name>RLimitNPROC</name>
3091 <description>Limits the number of processes that can be launched by
3092 processes launched by Apache httpd children</description>
3093 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3094 <default>Unset; uses operating system defaults</default>
3095 <contextlist><context>server config</context><context>virtual host</context>
3096 <context>directory</context><context>.htaccess</context></contextlist>
3097 <override>All</override>
3100 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3101 resource limit for all processes and the second parameter sets
3102 the maximum resource limit. Either parameter can be a number,
3103 or <code>max</code> to indicate to the server that the limit
3104 should be set to the maximum allowed by the operating system
3105 configuration. Raising the maximum resource limit requires that
3106 the server is running as <code>root</code>, or in the initial startup
3109 <p>This applies to processes forked off from Apache httpd children
3110 servicing requests, not the Apache httpd children themselves. This
3111 includes CGI scripts and SSI exec commands, but not any
3112 processes forked off from the Apache httpd parent such as piped
3115 <p>Process limits control the number of processes per user.</p>
3117 <note><title>Note</title>
3118 <p>If CGI processes are <strong>not</strong> running
3119 under user ids other than the web server user id, this directive
3120 will limit the number of processes that the server itself can
3121 create. Evidence of this situation will be indicated by
3122 <strong><code>cannot fork</code></strong> messages in the
3123 <code>error_log</code>.</p>
3126 <seealso><directive module="core">RLimitMEM</directive></seealso>
3127 <seealso><directive module="core">RLimitCPU</directive></seealso>
3128 </directivesynopsis>
3131 <name>ScriptInterpreterSource</name>
3132 <description>Technique for locating the interpreter for CGI
3133 scripts</description>
3134 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3135 <default>ScriptInterpreterSource Script</default>
3136 <contextlist><context>server config</context><context>virtual host</context>
3137 <context>directory</context><context>.htaccess</context></contextlist>
3138 <override>FileInfo</override>
3139 <compatibility>Win32 only;
3140 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3141 later</compatibility>
3144 <p>This directive is used to control how Apache httpd finds the
3145 interpreter used to run CGI scripts. The default setting is
3146 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3147 by the shebang line (first line, starting with <code>#!</code>) in the
3148 script. On Win32 systems this line usually looks like:</p>
3151 #!C:/Perl/bin/perl.exe
3154 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3160 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3161 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3162 searched using the script file extension (e.g., <code>.pl</code>) as a
3163 search key. The command defined by the registry subkey
3164 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3165 <code>Shell\Open\Command</code> is used to open the script file. If the
3166 registry keys cannot be found, Apache httpd falls back to the behavior of the
3167 <code>Script</code> option.</p>
3169 <note type="warning"><title>Security</title>
3170 <p>Be careful when using <code>ScriptInterpreterSource
3171 Registry</code> with <directive
3172 module="mod_alias">ScriptAlias</directive>'ed directories, because
3173 Apache httpd will try to execute <strong>every</strong> file within this
3174 directory. The <code>Registry</code> setting may cause undesired
3175 program calls on files which are typically not executed. For
3176 example, the default open command on <code>.htm</code> files on
3177 most Windows systems will execute Microsoft Internet Explorer, so
3178 any HTTP request for an <code>.htm</code> file existing within the
3179 script directory would start the browser in the background on the
3180 server. This is a good way to crash your system within a minute or
3184 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3185 2.0 does the same thing as <code>Registry</code> but uses only the
3186 subkey <code>Shell\ExecCGI\Command</code>. The
3187 <code>ExecCGI</code> key is not a common one. It must be
3188 configured manually in the windows registry and hence prevents
3189 accidental program calls on your system.</p>
3191 </directivesynopsis>
3194 <name>SeeRequestTail</name>
3195 <description>Determine if mod_status displays the first 63 characters
3196 of a request or the last 63, assuming the request itself is greater than
3197 63 chars.</description>
3198 <syntax>SeeRequestTail On|Off</syntax>
3199 <default>SeeRequestTail Off</default>
3200 <contextlist><context>server config</context></contextlist>
3201 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3204 <p>mod_status with <code>ExtendedStatus On</code>
3205 displays the actual request being handled.
3206 For historical purposes, only 63 characters of the request
3207 are actually stored for display purposes. This directive
3208 controls whether the 1st 63 characters are stored (the previous
3209 behavior and the default) or if the last 63 characters are. This
3210 is only applicable, of course, if the length of the request is
3211 64 characters or greater.</p>
3213 <p>If Apache httpd is handling <code
3214 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3215 > mod_status displays as follows:
3220 <th>Off (default)</th>
3221 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3225 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3230 </directivesynopsis>
3233 <name>ServerAdmin</name>
3234 <description>Email address that the server includes in error
3235 messages sent to the client</description>
3236 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3237 <contextlist><context>server config</context><context>virtual host</context>
3241 <p>The <directive>ServerAdmin</directive> sets the contact address
3242 that the server includes in any error messages it returns to the
3243 client. If the <code>httpd</code> doesn't recognize the supplied argument
3245 assumes, that it's an <var>email-address</var> and prepends it with
3246 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3247 actually use an email address, since there are a lot of CGI scripts that
3248 make that assumption. If you want to use an URL, it should point to another
3249 server under your control. Otherwise users may not be able to contact you in
3252 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3255 ServerAdmin www-admin@foo.example.com
3257 <p>as users do not always mention that they are talking about the
3260 </directivesynopsis>
3263 <name>ServerAlias</name>
3264 <description>Alternate names for a host used when matching requests
3265 to name-virtual hosts</description>
3266 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3267 <contextlist><context>virtual host</context></contextlist>
3270 <p>The <directive>ServerAlias</directive> directive sets the
3271 alternate names for a host, for use with <a
3272 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3273 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3276 <VirtualHost *:80><br />
3277 ServerName server.domain.com<br />
3278 ServerAlias server server2.domain.com server2<br />
3279 ServerAlias *.example.com<br />
3280 UseCanonicalName Off<br />
3282 </VirtualHost>
3285 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3286 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3287 </directivesynopsis>
3290 <name>ServerName</name>
3291 <description>Hostname and port that the server uses to identify
3292 itself</description>
3293 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3294 <contextlist><context>server config</context><context>virtual host</context>
3298 <p>The <directive>ServerName</directive> directive sets the
3299 request scheme, hostname and
3300 port that the server uses to identify itself. This is used when
3301 creating redirection URLs.</p>
3303 <p>Additionally, <directive>ServerName</directive> is used (possibly
3304 in conjunction with <directive>ServerAlias</directive>) to uniquely
3305 identify a virtual host, when using <a
3306 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3308 <p>For example, if the name of the
3309 machine hosting the web server is <code>simple.example.com</code>,
3310 but the machine also has the DNS alias <code>www.example.com</code>
3311 and you wish the web server to be so identified, the following
3312 directive should be used:</p>
3315 ServerName www.example.com:80
3318 <p>The <directive>ServerName</directive> directive
3319 may appear anywhere within the definition of a server. However,
3320 each appearance overrides the previous appearance (within that
3323 <p>If no <directive>ServerName</directive> is specified, then the
3324 server attempts to deduce the hostname by performing a reverse
3325 lookup on the IP address. If no port is specified in the
3326 <directive>ServerName</directive>, then the server will use the
3327 port from the incoming request. For optimal reliability and
3328 predictability, you should specify an explicit hostname and port
3329 using the <directive>ServerName</directive> directive.</p>
3331 <p>If you are using <a
3332 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3333 the <directive>ServerName</directive> inside a
3334 <directive type="section" module="core">VirtualHost</directive>
3335 section specifies what hostname must appear in the request's
3336 <code>Host:</code> header to match this virtual host.</p>
3338 <p>Sometimes, the server runs behind a device that processes SSL,
3339 such as a reverse proxy, load balancer or SSL offload
3340 appliance. When this is the case, specify the
3341 <code>https://</code> scheme and the port number to which the
3342 clients connect in the <directive>ServerName</directive> directive
3343 to make sure that the server generates the correct
3344 self-referential URLs.
3347 <p>See the description of the
3348 <directive module="core">UseCanonicalName</directive> and
3349 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3350 settings which determine whether self-referential URLs (e.g., by the
3351 <module>mod_dir</module> module) will refer to the
3352 specified port, or to the port number given in the client's request.
3355 <note type="warning">
3356 <p>Failure to set <directive>ServerName</directive> to a name that
3357 your server can resolve to an IP address will result in a startup
3358 warning. <code>httpd</code> will then use whatever hostname it can
3359 determine, using the system's <code>hostname</code> command. This
3360 will almost never be the hostname you actually want.</p>
3362 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3368 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3369 Apache HTTP Server</a></seealso>
3370 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3371 documentation</a></seealso>
3372 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3373 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3374 <seealso><directive module="core">NameVirtualHost</directive></seealso>
3375 <seealso><directive module="core">ServerAlias</directive></seealso>
3376 </directivesynopsis>
3379 <name>ServerPath</name>
3380 <description>Legacy URL pathname for a name-based virtual host that
3381 is accessed by an incompatible browser</description>
3382 <syntax>ServerPath <var>URL-path</var></syntax>
3383 <contextlist><context>virtual host</context></contextlist>
3386 <p>The <directive>ServerPath</directive> directive sets the legacy
3387 URL pathname for a host, for use with <a
3388 href="../vhosts/">name-based virtual hosts</a>.</p>
3390 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3391 </directivesynopsis>
3394 <name>ServerRoot</name>
3395 <description>Base directory for the server installation</description>
3396 <syntax>ServerRoot <var>directory-path</var></syntax>
3397 <default>ServerRoot /usr/local/apache</default>
3398 <contextlist><context>server config</context></contextlist>
3401 <p>The <directive>ServerRoot</directive> directive sets the
3402 directory in which the server lives. Typically it will contain the
3403 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3404 paths in other configuration directives (such as <directive
3405 module="core">Include</directive> or <directive
3406 module="mod_so">LoadModule</directive>, for example) are taken as
3407 relative to this directory.</p>
3409 <example><title>Example</title>
3410 ServerRoot /home/httpd
3414 <seealso><a href="../invoking.html">the <code>-d</code>
3415 option to <code>httpd</code></a></seealso>
3416 <seealso><a href="../misc/security_tips.html#serverroot">the
3417 security tips</a> for information on how to properly set
3418 permissions on the <directive>ServerRoot</directive></seealso>
3419 </directivesynopsis>
3422 <name>ServerSignature</name>
3423 <description>Configures the footer on server-generated documents</description>
3424 <syntax>ServerSignature On|Off|EMail</syntax>
3425 <default>ServerSignature Off</default>
3426 <contextlist><context>server config</context><context>virtual host</context>
3427 <context>directory</context><context>.htaccess</context>
3429 <override>All</override>
3432 <p>The <directive>ServerSignature</directive> directive allows the
3433 configuration of a trailing footer line under server-generated
3434 documents (error messages, <module>mod_proxy</module> ftp directory
3435 listings, <module>mod_info</module> output, ...). The reason why you
3436 would want to enable such a footer line is that in a chain of proxies,
3437 the user often has no possibility to tell which of the chained servers
3438 actually produced a returned error message.</p>
3440 <p>The <code>Off</code>
3441 setting, which is the default, suppresses the footer line (and is
3442 therefore compatible with the behavior of Apache-1.2 and
3443 below). The <code>On</code> setting simply adds a line with the
3444 server version number and <directive
3445 module="core">ServerName</directive> of the serving virtual host,
3446 and the <code>EMail</code> setting additionally creates a
3447 "mailto:" reference to the <directive
3448 module="core">ServerAdmin</directive> of the referenced
3451 <p>After version 2.0.44, the details of the server version number
3452 presented are controlled by the <directive
3453 module="core">ServerTokens</directive> directive.</p>
3455 <seealso><directive module="core">ServerTokens</directive></seealso>
3456 </directivesynopsis>
3459 <name>ServerTokens</name>
3460 <description>Configures the <code>Server</code> HTTP response
3461 header</description>
3462 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3463 <default>ServerTokens Full</default>
3464 <contextlist><context>server config</context></contextlist>
3467 <p>This directive controls whether <code>Server</code> response
3468 header field which is sent back to clients includes a
3469 description of the generic OS-type of the server as well as
3470 information about compiled-in modules.</p>
3473 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3475 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3476 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3478 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3480 <dd>Server sends (<em>e.g.</em>): <code>Server:
3483 <dt><code>ServerTokens Major</code></dt>
3485 <dd>Server sends (<em>e.g.</em>): <code>Server:
3486 Apache/2</code></dd>
3488 <dt><code>ServerTokens Minor</code></dt>
3490 <dd>Server sends (<em>e.g.</em>): <code>Server:
3491 Apache/2.4</code></dd>
3493 <dt><code>ServerTokens Min[imal]</code></dt>
3495 <dd>Server sends (<em>e.g.</em>): <code>Server:
3496 Apache/2.4.1</code></dd>
3498 <dt><code>ServerTokens OS</code></dt>
3500 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3505 <p>This setting applies to the entire server, and cannot be
3506 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3508 <p>After version 2.0.44, this directive also controls the
3509 information presented by the <directive
3510 module="core">ServerSignature</directive> directive.</p>
3512 <note>Setting <directive>ServerTokens</directive> to less than
3513 <code>minimal</code> is not recommended because it makes it more
3514 difficult to debug interoperational problems. Also note that
3515 disabling the Server: header does nothing at all to make your
3516 server more secure; the idea of "security through obscurity"
3517 is a myth and leads to a false sense of safety.</note>
3520 <seealso><directive module="core">ServerSignature</directive></seealso>
3521 </directivesynopsis>
3524 <name>SetHandler</name>
3525 <description>Forces all matching files to be processed by a
3526 handler</description>
3527 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3528 <contextlist><context>server config</context><context>virtual host</context>
3529 <context>directory</context><context>.htaccess</context>
3531 <override>FileInfo</override>
3532 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3535 <p>When placed into an <code>.htaccess</code> file or a
3536 <directive type="section" module="core">Directory</directive> or
3537 <directive type="section" module="core">Location</directive>
3538 section, this directive forces all matching files to be parsed
3539 through the <a href="../handler.html">handler</a> given by
3540 <var>handler-name</var>. For example, if you had a directory you
3541 wanted to be parsed entirely as imagemap rule files, regardless
3542 of extension, you might put the following into an
3543 <code>.htaccess</code> file in that directory:</p>
3546 SetHandler imap-file
3549 <p>Another example: if you wanted to have the server display a
3550 status report whenever a URL of
3551 <code>http://servername/status</code> was called, you might put
3552 the following into <code>httpd.conf</code>:</p>
3555 <Location /status><br />
3557 SetHandler server-status<br />
3562 <p>You can override an earlier defined <directive>SetHandler</directive>
3563 directive by using the value <code>None</code>.</p>
3564 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3565 normal behaviour such as handling of URLs ending in a slash (/) as
3566 directories or index files is suppressed.</p>
3569 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3571 </directivesynopsis>
3574 <name>SetInputFilter</name>
3575 <description>Sets the filters that will process client requests and POST
3577 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3578 <contextlist><context>server config</context><context>virtual host</context>
3579 <context>directory</context><context>.htaccess</context>
3581 <override>FileInfo</override>
3584 <p>The <directive>SetInputFilter</directive> directive sets the
3585 filter or filters which will process client requests and POST
3586 input when they are received by the server. This is in addition to
3587 any filters defined elsewhere, including the
3588 <directive module="mod_mime">AddInputFilter</directive>
3591 <p>If more than one filter is specified, they must be separated
3592 by semicolons in the order in which they should process the
3595 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3596 </directivesynopsis>
3599 <name>SetOutputFilter</name>
3600 <description>Sets the filters that will process responses from the
3601 server</description>
3602 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3603 <contextlist><context>server config</context><context>virtual host</context>
3604 <context>directory</context><context>.htaccess</context>
3606 <override>FileInfo</override>
3609 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3610 which will process responses from the server before they are
3611 sent to the client. This is in addition to any filters defined
3612 elsewhere, including the
3613 <directive module="mod_mime">AddOutputFilter</directive>
3616 <p>For example, the following configuration will process all files
3617 in the <code>/www/data/</code> directory for server-side
3621 <Directory /www/data/><br />
3623 SetOutputFilter INCLUDES<br />
3628 <p>If more than one filter is specified, they must be separated
3629 by semicolons in the order in which they should process the
3632 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3633 </directivesynopsis>
3636 <name>TimeOut</name>
3637 <description>Amount of time the server will wait for
3638 certain events before failing a request</description>
3639 <syntax>TimeOut <var>seconds</var></syntax>
3640 <default>TimeOut 300</default>
3641 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3644 <p>The <directive>TimeOut</directive> directive defines the length
3645 of time Apache httpd will wait for I/O in various circumstances:</p>
3648 <li>When reading data from the client, the length of time to
3649 wait for a TCP packet to arrive if the read buffer is
3652 <li>When writing data to the client, the length of time to wait
3653 for an acknowledgement of a packet if the send buffer is
3656 <li>In <module>mod_cgi</module>, the length of time to wait for
3657 output from a CGI script.</li>
3659 <li>In <module>mod_ext_filter</module>, the length of time to
3660 wait for output from a filtering process.</li>
3662 <li>In <module>mod_proxy</module>, the default timeout value if
3663 <directive module="mod_proxy">ProxyTimeout</directive> is not
3668 </directivesynopsis>
3671 <name>TraceEnable</name>
3672 <description>Determines the behaviour on <code>TRACE</code>
3673 requests</description>
3674 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3675 <default>TraceEnable on</default>
3676 <contextlist><context>server config</context></contextlist>
3677 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3680 <p>This directive overrides the behavior of <code>TRACE</code> for both
3681 the core server and <module>mod_proxy</module>. The default
3682 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3683 RFC 2616, which disallows any request body to accompany the request.
3684 <code>TraceEnable off</code> causes the core server and
3685 <module>mod_proxy</module> to return a <code>405</code> (Method not
3686 allowed) error to the client.</p>
3688 <p>Finally, for testing and diagnostic purposes only, request
3689 bodies may be allowed using the non-compliant <code>TraceEnable
3690 extended</code> directive. The core (as an origin server) will
3691 restrict the request body to 64k (plus 8k for chunk headers if
3692 <code>Transfer-Encoding: chunked</code> is used). The core will
3693 reflect the full headers and all chunk headers with the response
3694 body. As a proxy server, the request body is not restricted to 64k.</p>
3696 </directivesynopsis>
3699 <name>UnDefine</name>
3700 <description>Undefine the existence of a variable</description>
3701 <syntax>UnDefine <var>parameter-name</var></syntax>
3702 <contextlist><context>server config</context></contextlist>
3705 <p>Undoes the effect of a <directive module="core">Define</directive> or
3706 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3707 <p>This directive can be used to toggle the use of <directive module="core"
3708 type="section">IfDefine</directive> sections without needing to alter
3709 <code>-D</code> arguments in any startup scripts.</p>
3711 </directivesynopsis>
3714 <name>UseCanonicalName</name>
3715 <description>Configures how the server determines its own name and
3717 <syntax>UseCanonicalName On|Off|DNS</syntax>
3718 <default>UseCanonicalName Off</default>
3719 <contextlist><context>server config</context><context>virtual host</context>
3720 <context>directory</context></contextlist>
3723 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3724 URL -- that is, a URL that refers back to the same server. With
3725 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3726 specified in the <directive module="core">ServerName</directive>
3727 directive to construct the canonical name for the server. This name
3728 is used in all self-referential URLs, and for the values of
3729 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3731 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3732 self-referential URLs using the hostname and port supplied by
3733 the client if any are supplied (otherwise it will use the
3734 canonical name, as defined above). These values are the same
3735 that are used to implement <a
3736 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3737 and are available with the same clients. The CGI variables
3738 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3739 constructed from the client supplied values as well.</p>
3741 <p>An example where this may be useful is on an intranet server
3742 where you have users connecting to the machine using short
3743 names such as <code>www</code>. You'll notice that if the users
3744 type a shortname, and a URL which is a directory, such as
3745 <code>http://www/splat</code>, <em>without the trailing
3746 slash</em> then Apache httpd will redirect them to
3747 <code>http://www.domain.com/splat/</code>. If you have
3748 authentication enabled, this will cause the user to have to
3749 authenticate twice (once for <code>www</code> and once again
3750 for <code>www.domain.com</code> -- see <a
3751 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3752 FAQ on this subject for more information</a>). But if
3753 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3754 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3756 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3757 which is intended for use with mass IP-based virtual hosting to
3758 support ancient clients that do not provide a
3759 <code>Host:</code> header. With this option Apache httpd does a
3760 reverse DNS lookup on the server IP address that the client
3761 connected to in order to work out self-referential URLs.</p>
3763 <note type="warning"><title>Warning</title>
3764 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3765 they may be broken by this option. The client is essentially free
3766 to give whatever value they want as a hostname. But if the CGI is
3767 only using <code>SERVER_NAME</code> to construct self-referential URLs
3768 then it should be just fine.</p>
3771 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3772 <seealso><directive module="core">ServerName</directive></seealso>
3773 <seealso><directive module="mpm_common">Listen</directive></seealso>
3774 </directivesynopsis>
3777 <name>UseCanonicalPhysicalPort</name>
3778 <description>Configures how the server determines its own name and
3780 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3781 <default>UseCanonicalPhysicalPort Off</default>
3782 <contextlist><context>server config</context><context>virtual host</context>
3783 <context>directory</context></contextlist>
3786 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3787 URL -- that is, a URL that refers back to the same server. With
3788 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3789 constructing the canonical port for the server to honor
3790 the <directive module="core">UseCanonicalName</directive> directive,
3791 provide the actual physical port number being used by this request
3792 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3793 Apache httpd will not ever use the actual physical port number, instead
3794 relying on all configured information to construct a valid port number.</p>
3796 <note><title>Note</title>
3797 <p>The ordering of when the physical port is used is as follows:<br /><br />
3798 <code>UseCanonicalName On</code></p>
3800 <li>Port provided in <code>Servername</code></li>
3801 <li>Physical port</li>
3802 <li>Default port</li>
3804 <code>UseCanonicalName Off | DNS</code>
3806 <li>Parsed port from <code>Host:</code> header</li>
3807 <li>Physical port</li>
3808 <li>Port provided in <code>Servername</code></li>
3809 <li>Default port</li>
3812 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3813 physical ports are removed from the ordering.</p>
3817 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3818 <seealso><directive module="core">ServerName</directive></seealso>
3819 <seealso><directive module="mpm_common">Listen</directive></seealso>
3820 </directivesynopsis>
3822 <directivesynopsis type="section">
3823 <name>VirtualHost</name>
3824 <description>Contains directives that apply only to a specific
3825 hostname or IP address</description>
3826 <syntax><VirtualHost
3827 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3828 ...> ... </VirtualHost></syntax>
3829 <contextlist><context>server config</context></contextlist>
3832 <p><directive type="section">VirtualHost</directive> and
3833 <code></VirtualHost></code> are used to enclose a group of
3834 directives that will apply only to a particular virtual host. Any
3835 directive that is allowed in a virtual host context may be
3836 used. When the server receives a request for a document on a
3837 particular virtual host, it uses the configuration directives
3838 enclosed in the <directive type="section">VirtualHost</directive>
3839 section. <var>Addr</var> can be:</p>
3842 <li>The IP address of the virtual host;</li>
3844 <li>A fully qualified domain name for the IP address of the
3845 virtual host (not recommended);</li>
3847 <li>The character <code>*</code>, which is used only in combination with
3848 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3850 <li>The string <code>_default_</code>, which is used only
3851 with IP virtual hosting to catch unmatched IP addresses.</li>
3854 <example><title>Example</title>
3855 <VirtualHost 10.1.2.3><br />
3857 ServerAdmin webmaster@host.example.com<br />
3858 DocumentRoot /www/docs/host.example.com<br />
3859 ServerName host.example.com<br />
3860 ErrorLog logs/host.example.com-error_log<br />
3861 TransferLog logs/host.example.com-access_log<br />
3863 </VirtualHost>
3867 <p>IPv6 addresses must be specified in square brackets because
3868 the optional port number could not be determined otherwise. An
3869 IPv6 example is shown below:</p>
3872 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3874 ServerAdmin webmaster@host.example.com<br />
3875 DocumentRoot /www/docs/host.example.com<br />
3876 ServerName host.example.com<br />
3877 ErrorLog logs/host.example.com-error_log<br />
3878 TransferLog logs/host.example.com-access_log<br />
3880 </VirtualHost>
3883 <p>Each Virtual Host must correspond to a different IP address,
3884 different port number or a different host name for the server,
3885 in the former case the server machine must be configured to
3886 accept IP packets for multiple addresses. (If the machine does
3887 not have multiple network interfaces, then this can be
3888 accomplished with the <code>ifconfig alias</code> command -- if
3889 your OS supports it).</p>
3891 <note><title>Note</title>
3892 <p>The use of <directive type="section">VirtualHost</directive> does
3893 <strong>not</strong> affect what addresses Apache httpd listens on. You
3894 may need to ensure that Apache httpd is listening on the correct addresses
3895 using <directive module="mpm_common">Listen</directive>.</p>
3898 <p>When using IP-based virtual hosting, the special name
3899 <code>_default_</code> can be specified in
3900 which case this virtual host will match any IP address that is
3901 not explicitly listed in another virtual host. In the absence
3902 of any <code>_default_</code> virtual host the "main" server config,
3903 consisting of all those definitions outside any VirtualHost
3904 section, is used when no IP-match occurs.</p>
3906 <p>You can specify a <code>:port</code> to change the port that is
3907 matched. If unspecified then it defaults to the same port as the
3908 most recent <directive module="mpm_common">Listen</directive>
3909 statement of the main server. You may also specify <code>:*</code>
3910 to match all ports on that address. (This is recommended when used
3911 with <code>_default_</code>.)</p>
3913 <p>A <directive module="core">ServerName</directive> should be
3914 specified inside each <directive
3915 type="section">VirtualHost</directive> block. If it is absent, the
3916 <directive module="core">ServerName</directive> from the "main"
3917 server configuration will be inherited.</p>
3919 <p>If no matching virtual host is found, then the first listed
3920 virtual host that matches the IP address will be used. As a
3921 consequence, the first listed virtual host is the default virtual
3924 <note type="warning"><title>Security</title>
3925 <p>See the <a href="../misc/security_tips.html">security tips</a>
3926 document for details on why your security could be compromised if the
3927 directory where log files are stored is writable by anyone other
3928 than the user that starts the server.</p>
3931 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3932 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3933 Apache HTTP Server</a></seealso>
3934 <seealso><a href="../bind.html">Setting
3935 which addresses and ports Apache HTTP Server uses</a></seealso>
3936 <seealso><a href="../sections.html">How <Directory>, <Location>
3937 and <Files> sections work</a> for an explanation of how these
3938 different sections are combined when a request is received</seealso>
3939 </directivesynopsis>