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
104 <seealso><directive>Protocol</directive></seealso>
108 <name>AcceptPathInfo</name>
109 <description>Resources accept trailing pathname information</description>
110 <syntax>AcceptPathInfo On|Off|Default</syntax>
111 <default>AcceptPathInfo Default</default>
112 <contextlist><context>server config</context>
113 <context>virtual host</context><context>directory</context>
114 <context>.htaccess</context></contextlist>
115 <override>FileInfo</override>
116 <compatibility>Available in Apache httpd 2.0.30 and later</compatibility>
120 <p>This directive controls whether requests that contain trailing
121 pathname information that follows an actual filename (or
122 non-existent file in an existing directory) will be accepted or
123 rejected. The trailing pathname information can be made
124 available to scripts in the <code>PATH_INFO</code> environment
127 <p>For example, assume the location <code>/test/</code> points to
128 a directory that contains only the single file
129 <code>here.html</code>. Then requests for
130 <code>/test/here.html/more</code> and
131 <code>/test/nothere.html/more</code> both collect
132 <code>/more</code> as <code>PATH_INFO</code>.</p>
134 <p>The three possible arguments for the
135 <directive>AcceptPathInfo</directive> directive are:</p>
137 <dt><code>Off</code></dt><dd>A request will only be accepted if it
138 maps to a literal path that exists. Therefore a request with
139 trailing pathname information after the true filename such as
140 <code>/test/here.html/more</code> in the above example will return
141 a 404 NOT FOUND error.</dd>
143 <dt><code>On</code></dt><dd>A request will be accepted if a
144 leading path component maps to a file that exists. The above
145 example <code>/test/here.html/more</code> will be accepted if
146 <code>/test/here.html</code> maps to a valid file.</dd>
148 <dt><code>Default</code></dt><dd>The treatment of requests with
149 trailing pathname information is determined by the <a
150 href="../handler.html">handler</a> responsible for the request.
151 The core handler for normal files defaults to rejecting
152 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
153 href="mod_cgi.html">cgi-script</a> and <a
154 href="mod_isapi.html">isapi-handler</a>, generally accept
155 <code>PATH_INFO</code> by default.</dd>
158 <p>The primary purpose of the <code>AcceptPathInfo</code>
159 directive is to allow you to override the handler's choice of
160 accepting or rejecting <code>PATH_INFO</code>. This override is required,
161 for example, when you use a <a href="../filter.html">filter</a>, such
162 as <a href="mod_include.html">INCLUDES</a>, to generate content
163 based on <code>PATH_INFO</code>. The core handler would usually reject
164 the request, so you can use the following configuration to enable
168 <Files "mypaths.shtml"><br />
170 Options +Includes<br />
171 SetOutputFilter INCLUDES<br />
172 AcceptPathInfo On<br />
181 <name>AccessFileName</name>
182 <description>Name of the distributed configuration file</description>
183 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
184 <default>AccessFileName .htaccess</default>
185 <contextlist><context>server config</context><context>virtual host</context>
189 <p>While processing a request the server looks for
190 the first existing configuration file from this list of names in
191 every directory of the path to the document, if distributed
192 configuration files are <a href="#allowoverride">enabled for that
193 directory</a>. For example:</p>
199 <p>before returning the document
200 <code>/usr/local/web/index.html</code>, the server will read
201 <code>/.acl</code>, <code>/usr/.acl</code>,
202 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
203 for directives, unless they have been disabled with</p>
206 <Directory /><br />
208 AllowOverride None<br />
213 <seealso><directive module="core">AllowOverride</directive></seealso>
214 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
215 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
219 <name>AddDefaultCharset</name>
220 <description>Default charset parameter to be added when a response
221 content-type is <code>text/plain</code> or <code>text/html</code></description>
222 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
223 <default>AddDefaultCharset Off</default>
224 <contextlist><context>server config</context>
225 <context>virtual host</context><context>directory</context>
226 <context>.htaccess</context></contextlist>
227 <override>FileInfo</override>
230 <p>This directive specifies a default value for the media type
231 charset parameter (the name of a character encoding) to be added
232 to a response if and only if the response's content-type is either
233 <code>text/plain</code> or <code>text/html</code>. This should override
234 any charset specified in the body of the response via a <code>META</code>
235 element, though the exact behavior is often dependent on the user's client
236 configuration. A setting of <code>AddDefaultCharset Off</code>
237 disables this functionality. <code>AddDefaultCharset On</code> enables
238 a default charset of <code>iso-8859-1</code>. Any other value is assumed
239 to be the <var>charset</var> to be used, which should be one of the
240 <a href="http://www.iana.org/assignments/character-sets">IANA registered
241 charset values</a> for use in Internet media types (MIME types).
245 AddDefaultCharset utf-8
248 <p><directive>AddDefaultCharset</directive> should only be used when all
249 of the text resources to which it applies are known to be in that
250 character encoding and it is too inconvenient to label their charset
251 individually. One such example is to add the charset parameter
252 to resources containing generated content, such as legacy CGI
253 scripts, that might be vulnerable to cross-site scripting attacks
254 due to user-provided data being included in the output. Note, however,
255 that a better solution is to just fix (or delete) those scripts, since
256 setting a default charset does not protect users that have enabled
257 the "auto-detect character encoding" feature on their browser.</p>
259 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
263 <name>AllowEncodedSlashes</name>
264 <description>Determines whether encoded path separators in URLs are allowed to
265 be passed through</description>
266 <syntax>AllowEncodedSlashes On|Off</syntax>
267 <default>AllowEncodedSlashes Off</default>
268 <contextlist><context>server config</context><context>virtual host</context>
270 <compatibility>Available in Apache httpd 2.0.46 and later</compatibility>
273 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
274 which contain encoded path separators (<code>%2F</code> for <code>/</code>
275 and additionally <code>%5C</code> for <code>\</code> on according systems)
276 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
278 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
279 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
281 <note><title>Note</title>
282 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
283 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
284 according systems) will be left as such in the otherwise decoded URL
288 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
292 <name>AllowOverride</name>
293 <description>Types of directives that are allowed in
294 <code>.htaccess</code> files</description>
295 <syntax>AllowOverride All|None|<var>directive-type</var>
296 [<var>directive-type</var>] ...</syntax>
297 <default>AllowOverride All</default>
298 <contextlist><context>directory</context></contextlist>
301 <p>When the server finds an <code>.htaccess</code> file (as
302 specified by <directive module="core">AccessFileName</directive>)
303 it needs to know which directives declared in that file can override
304 earlier configuration directives.</p>
306 <note><title>Only available in <Directory> sections</title>
307 <directive>AllowOverride</directive> is valid only in
308 <directive type="section" module="core">Directory</directive>
309 sections specified without regular expressions, not in <directive
310 type="section" module="core">Location</directive>, <directive
311 module="core" type="section">DirectoryMatch</directive> or
312 <directive type="section" module="core">Files</directive> sections.
315 <p>When this directive is set to <code>None</code>, then
316 <a href="#accessfilename">.htaccess</a> files are completely ignored.
317 In this case, the server will not even attempt to read
318 <code>.htaccess</code> files in the filesystem.</p>
320 <p>When this directive is set to <code>All</code>, then any
321 directive which has the .htaccess <a
322 href="directive-dict.html#Context">Context</a> is allowed in
323 <code>.htaccess</code> files.</p>
325 <p>The <var>directive-type</var> can be one of the following
326 groupings of directives.</p>
333 Allow use of the authorization directives (<directive
334 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
335 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
336 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
337 <directive module="mod_authn_core">AuthName</directive>,
338 <directive module="mod_authn_core">AuthType</directive>, <directive
339 module="mod_authn_file">AuthUserFile</directive>, <directive
340 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
345 Allow use of the directives controlling document types
346 (<directive module="core">ErrorDocument</directive>,
347 <directive module="core">ForceType</directive>,
348 <directive module="mod_negotiation">LanguagePriority</directive>,
349 <directive module="core">SetHandler</directive>,
350 <directive module="core">SetInputFilter</directive>,
351 <directive module="core">SetOutputFilter</directive>, and
352 <module>mod_mime</module> Add* and Remove* directives),
353 document meta data (<directive
354 module="mod_headers">Header</directive>, <directive
355 module="mod_headers">RequestHeader</directive>, <directive
356 module="mod_setenvif">SetEnvIf</directive>, <directive
357 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
358 module="mod_setenvif">BrowserMatch</directive>, <directive
359 module="mod_usertrack">CookieExpires</directive>, <directive
360 module="mod_usertrack">CookieDomain</directive>, <directive
361 module="mod_usertrack">CookieStyle</directive>, <directive
362 module="mod_usertrack">CookieTracking</directive>, <directive
363 module="mod_usertrack">CookieName</directive>),
364 <module>mod_rewrite</module> directives <directive
365 module="mod_rewrite">RewriteEngine</directive>, <directive
366 module="mod_rewrite">RewriteOptions</directive>, <directive
367 module="mod_rewrite">RewriteBase</directive>, <directive
368 module="mod_rewrite">RewriteCond</directive>, <directive
369 module="mod_rewrite">RewriteRule</directive>) and
370 <directive module="mod_actions">Action</directive> from
371 <module>mod_actions</module>.
377 Allow use of the directives controlling directory indexing
379 module="mod_autoindex">AddDescription</directive>,
380 <directive module="mod_autoindex">AddIcon</directive>, <directive
381 module="mod_autoindex">AddIconByEncoding</directive>,
382 <directive module="mod_autoindex">AddIconByType</directive>,
383 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
384 module="mod_dir">DirectoryIndex</directive>, <directive
385 module="mod_autoindex">FancyIndexing</directive>, <directive
386 module="mod_autoindex">HeaderName</directive>, <directive
387 module="mod_autoindex">IndexIgnore</directive>, <directive
388 module="mod_autoindex">IndexOptions</directive>, <directive
389 module="mod_autoindex">ReadmeName</directive>,
395 Allow use of the directives controlling host access (<directive
396 module="mod_authz_host">Allow</directive>, <directive
397 module="mod_authz_host">Deny</directive> and <directive
398 module="mod_authz_host">Order</directive>).</dd>
400 <dt>Options[=<var>Option</var>,...]</dt>
403 Allow use of the directives controlling specific directory
404 features (<directive module="core">Options</directive> and
405 <directive module="mod_include">XBitHack</directive>).
406 An equal sign may be given followed by a comma (but no spaces)
407 separated lists of options that may be set using the <directive
408 module="core">Options</directive> command.</dd>
414 AllowOverride AuthConfig Indexes
417 <p>In the example above all directives that are neither in the group
418 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
421 <note><p>For security and performance reasons, do not set
422 <code>AllowOverride</code> to anything other than <code>None</code>
423 in your <code><Directory /></code> block. Instead, find (or
424 create) the <code><Directory></code> block that refers to the
425 directory where you're actually planning to place a
426 <code>.htaccess</code> file.</p>
430 <seealso><directive module="core">AccessFileName</directive></seealso>
431 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
432 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
436 <name>CGIMapExtension</name>
437 <description>Technique for locating the interpreter for CGI
438 scripts</description>
439 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
440 <contextlist><context>directory</context><context>.htaccess</context>
442 <override>FileInfo</override>
443 <compatibility>NetWare only</compatibility>
446 <p>This directive is used to control how Apache httpd finds the
447 interpreter used to run CGI scripts. For example, setting
448 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
449 cause all CGI script files with a <code>.foo</code> extension to
450 be passed to the FOO interpreter.</p>
455 <name>ContentDigest</name>
456 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
457 headers</description>
458 <syntax>ContentDigest On|Off</syntax>
459 <default>ContentDigest Off</default>
460 <contextlist><context>server config</context><context>virtual host</context>
461 <context>directory</context><context>.htaccess</context>
463 <override>Options</override>
464 <status>Experimental</status>
467 <p>This directive enables the generation of
468 <code>Content-MD5</code> headers as defined in RFC1864
469 respectively RFC2616.</p>
471 <p>MD5 is an algorithm for computing a "message digest"
472 (sometimes called "fingerprint") of arbitrary-length data, with
473 a high degree of confidence that any alterations in the data
474 will be reflected in alterations in the message digest.</p>
476 <p>The <code>Content-MD5</code> header provides an end-to-end
477 message integrity check (MIC) of the entity-body. A proxy or
478 client may check this header for detecting accidental
479 modification of the entity-body in transit. Example header:</p>
482 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
485 <p>Note that this can cause performance problems on your server
486 since the message digest is computed on every request (the
487 values are not cached).</p>
489 <p><code>Content-MD5</code> is only sent for documents served
490 by the <module>core</module>, and not by any module. For example,
491 SSI documents, output from CGI scripts, and byte range responses
492 do not have this header.</p>
497 <name>DefaultType</name>
498 <description>This directive has no effect other than to emit warnings
499 if the value is not <code>none</code>. In prior versions, DefaultType
500 would specify a default media type to assign to response content for
501 which no other media type configuration could be found.
503 <syntax>DefaultType <var>media-type|none</var></syntax>
504 <default>DefaultType none</default>
505 <contextlist><context>server config</context><context>virtual host</context>
506 <context>directory</context><context>.htaccess</context>
508 <override>FileInfo</override>
509 <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>
512 <p>This directive has been disabled. For backwards compatibility
513 of configuration files, it may be specified with the value
514 <code>none</code>, meaning no default media type. For example:</p>
520 <p><code>DefaultType None</code> is only available in
521 httpd-2.2.7 and later.</p>
523 <p>Use the mime.types configuration file and the
524 <directive module="mod_mime">AddType</directive> to configure media
525 type assignments via file extensions, or the
526 <directive module="core">ForceType</directive> directive to configure
527 the media type for specific resources. Otherwise, the server will
528 send the response without a Content-Type header field and the
529 recipient may attempt to guess the media type.</p>
535 <description>Define the existence of a variable</description>
536 <syntax>Define <var>parameter-name</var></syntax>
537 <contextlist><context>server config</context></contextlist>
540 <p>Equivalent to passing the <code>-D</code> argument to <program
541 >httpd</program>.</p>
542 <p>This directive can be used to toggle the use of <directive module="core"
543 type="section">IfDefine</directive> sections without needing to alter
544 <code>-D</code> arguments in any startup scripts.</p>
548 <directivesynopsis type="section">
549 <name>Directory</name>
550 <description>Enclose a group of directives that apply only to the
551 named file-system directory and sub-directories</description>
552 <syntax><Directory <var>directory-path</var>>
553 ... </Directory></syntax>
554 <contextlist><context>server config</context><context>virtual host</context>
558 <p><directive type="section">Directory</directive> and
559 <code></Directory></code> are used to enclose a group of
560 directives that will apply only to the named directory and
561 sub-directories of that directory. Any directive that is allowed
562 in a directory context may be used. <var>Directory-path</var> is
563 either the full path to a directory, or a wild-card string using
564 Unix shell-style matching. In a wild-card string, <code>?</code> matches
565 any single character, and <code>*</code> matches any sequences of
566 characters. You may also use <code>[]</code> character ranges. None
567 of the wildcards match a `/' character, so <code><Directory
568 /*/public_html></code> will not match
569 <code>/home/user/public_html</code>, but <code><Directory
570 /home/*/public_html></code> will match. Example:</p>
573 <Directory /usr/local/httpd/htdocs><br />
575 Options Indexes FollowSymLinks<br />
581 <p>Be careful with the <var>directory-path</var> arguments:
582 They have to literally match the filesystem path which Apache httpd uses
583 to access the files. Directives applied to a particular
584 <code><Directory></code> will not apply to files accessed from
585 that same directory via a different path, such as via different symbolic
589 <p><glossary ref="regex">Regular
590 expressions</glossary> can also be used, with the addition of the
591 <code>~</code> character. For example:</p>
594 <Directory ~ "^/www/.*/[0-9]{3}">
597 <p>would match directories in <code>/www/</code> that consisted of
600 <p>If multiple (non-regular expression) <directive
601 type="section">Directory</directive> sections
602 match the directory (or one of its parents) containing a document,
603 then the directives are applied in the order of shortest match
604 first, interspersed with the directives from the <a
605 href="#accessfilename">.htaccess</a> files. For example,
609 <Directory /><br />
611 AllowOverride None<br />
613 </Directory><br />
615 <Directory /home/><br />
617 AllowOverride FileInfo<br />
622 <p>for access to the document <code>/home/web/dir/doc.html</code>
626 <li>Apply directive <code>AllowOverride None</code>
627 (disabling <code>.htaccess</code> files).</li>
629 <li>Apply directive <code>AllowOverride FileInfo</code> (for
630 directory <code>/home</code>).</li>
632 <li>Apply any <code>FileInfo</code> directives in
633 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
634 <code>/home/web/dir/.htaccess</code> in that order.</li>
637 <p>Regular expressions are not considered until after all of the
638 normal sections have been applied. Then all of the regular
639 expressions are tested in the order they appeared in the
640 configuration file. For example, with</p>
643 <Directory ~ abc$><br />
645 # ... directives here ...<br />
650 <p>the regular expression section won't be considered until after
651 all normal <directive type="section">Directory</directive>s and
652 <code>.htaccess</code> files have been applied. Then the regular
653 expression will match on <code>/home/abc/public_html/abc</code> and
654 the corresponding <directive type="section">Directory</directive> will
657 <p><strong>Note that the default access for
658 <code><Directory /></code> is <code>Allow from All</code>.
659 This means that Apache httpd will serve any file mapped from an URL. It is
660 recommended that you change this with a block such
664 <Directory /><br />
666 Order Deny,Allow<br />
672 <p><strong>and then override this for directories you
673 <em>want</em> accessible. See the <a
674 href="../misc/security_tips.html">Security Tips</a> page for more
675 details.</strong></p>
677 <p>The directory sections occur in the <code>httpd.conf</code> file.
678 <directive type="section">Directory</directive> directives
679 cannot nest, and cannot appear in a <directive module="core"
680 type="section">Limit</directive> or <directive module="core"
681 type="section">LimitExcept</directive> section.</p>
683 <seealso><a href="../sections.html">How <Directory>,
684 <Location> and <Files> sections work</a> for an
685 explanation of how these different sections are combined when a
686 request is received</seealso>
689 <directivesynopsis type="section">
690 <name>DirectoryMatch</name>
691 <description>Enclose directives that apply to
692 file-system directories matching a regular expression.</description>
693 <syntax><DirectoryMatch <var>regex</var>>
694 ... </DirectoryMatch></syntax>
695 <contextlist><context>server config</context><context>virtual host</context>
699 <p><directive type="section">DirectoryMatch</directive> and
700 <code></DirectoryMatch></code> are used to enclose a group
701 of directives which will apply only to the named directory,
702 the same as <directive module="core" type="section">Directory</directive>.
703 However, it takes as an argument a
704 <glossary ref="regex">regular expression</glossary>. For example:</p>
707 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
710 <p>would match directories in <code>/www/</code> that consisted of three
713 <note><title>Compatability</title>
714 Prior to 2.3.9, this directive implicitly applied to sub-directories
715 (like <directive module="core" type="section">Directory</directive>) and
716 could not match the end of line symbol ($). In 2.3.9 and later,
717 only directories that match the expression are affected by the enclosed
721 <note><title>Trailing Slash</title>
722 This directive applies to requests for directories that may or may
723 not end in a trailing slash, so expressions that are anchored to the
724 end of line ($) must be written with care.
727 <seealso><directive type="section" module="core">Directory</directive> for
728 a description of how regular expressions are mixed in with normal
729 <directive type="section">Directory</directive>s</seealso>
731 href="../sections.html">How <Directory>, <Location> and
732 <Files> sections work</a> for an explanation of how these different
733 sections are combined when a request is received</seealso>
737 <name>DocumentRoot</name>
738 <description>Directory that forms the main document tree visible
739 from the web</description>
740 <syntax>DocumentRoot <var>directory-path</var></syntax>
741 <default>DocumentRoot /usr/local/apache/htdocs</default>
742 <contextlist><context>server config</context><context>virtual host</context>
746 <p>This directive sets the directory from which <program>httpd</program>
747 will serve files. Unless matched by a directive like <directive
748 module="mod_alias">Alias</directive>, the server appends the
749 path from the requested URL to the document root to make the
750 path to the document. Example:</p>
753 DocumentRoot /usr/web
757 <code>http://www.my.host.com/index.html</code> refers to
758 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
759 not absolute then it is assumed to be relative to the <directive
760 module="core">ServerRoot</directive>.</p>
762 <p>The <directive>DocumentRoot</directive> should be specified without
763 a trailing slash.</p>
765 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
766 Locations</a></seealso>
770 <name>EnableMMAP</name>
771 <description>Use memory-mapping to read files during delivery</description>
772 <syntax>EnableMMAP On|Off</syntax>
773 <default>EnableMMAP On</default>
774 <contextlist><context>server config</context><context>virtual host</context>
775 <context>directory</context><context>.htaccess</context>
777 <override>FileInfo</override>
780 <p>This directive controls whether the <program>httpd</program> may use
781 memory-mapping if it needs to read the contents of a file during
782 delivery. By default, when the handling of a request requires
783 access to the data within a file -- for example, when delivering a
784 server-parsed file using <module>mod_include</module> -- Apache httpd
785 memory-maps the file if the OS supports it.</p>
787 <p>This memory-mapping sometimes yields a performance improvement.
788 But in some environments, it is better to disable the memory-mapping
789 to prevent operational problems:</p>
792 <li>On some multiprocessor systems, memory-mapping can reduce the
793 performance of the <program>httpd</program>.</li>
794 <li>Deleting or truncating a file while <program>httpd</program>
795 has it memory-mapped can cause <program>httpd</program> to
796 crash with a segmentation fault.
800 <p>For server configurations that are vulnerable to these problems,
801 you should disable memory-mapping of delivered files by specifying:</p>
807 <p>For NFS mounted files, this feature may be disabled explicitly for
808 the offending files by specifying:</p>
811 <Directory "/path-to-nfs-files">
821 <name>EnableSendfile</name>
822 <description>Use the kernel sendfile support to deliver files to the client</description>
823 <syntax>EnableSendfile On|Off</syntax>
824 <default>EnableSendfile Off</default>
825 <contextlist><context>server config</context><context>virtual host</context>
826 <context>directory</context><context>.htaccess</context>
828 <override>FileInfo</override>
829 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
830 version 2.3.9.</compatibility>
833 <p>This directive controls whether <program>httpd</program> may use the
834 sendfile support from the kernel to transmit file contents to the client.
835 By default, when the handling of a request requires no access
836 to the data within a file -- for example, when delivering a
837 static file -- Apache httpd uses sendfile to deliver the file contents
838 without ever reading the file if the OS supports it.</p>
840 <p>This sendfile mechanism avoids separate read and send operations,
841 and buffer allocations. But on some platforms or within some
842 filesystems, it is better to disable this feature to avoid
843 operational problems:</p>
846 <li>Some platforms may have broken sendfile support that the build
847 system did not detect, especially if the binaries were built on
848 another box and moved to such a machine with broken sendfile
850 <li>On Linux the use of sendfile triggers TCP-checksum
851 offloading bugs on certain networking cards when using IPv6.</li>
852 <li>On Linux on Itanium, sendfile may be unable to handle files
853 over 2GB in size.</li>
854 <li>With a network-mounted <directive
855 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
856 the kernel may be unable to serve the network file through
860 <p>For server configurations that are not vulnerable to these problems,
861 you may enable this feature by specifying:</p>
867 <p>For network mounted files, this feature may be disabled explicitly
868 for the offending files by specifying:</p>
871 <Directory "/path-to-nfs-files">
877 <p>Please note that the per-directory and .htaccess configuration
878 of <directive>EnableSendfile</directive> is not supported by
879 <module>mod_disk_cache</module>.
880 Only global definition of <directive>EnableSendfile</directive>
881 is taken into account by the module.
887 <name>ErrorDocument</name>
888 <description>What the server will return to the client
889 in case of an error</description>
890 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
891 <contextlist><context>server config</context><context>virtual host</context>
892 <context>directory</context><context>.htaccess</context>
894 <override>FileInfo</override>
895 <compatibility>Quoting syntax for text messages is different in Apache HTTP Server
899 <p>In the event of a problem or error, Apache httpd can be configured
900 to do one of four things,</p>
903 <li>output a simple hardcoded error message</li>
905 <li>output a customized message</li>
907 <li>redirect to a local <var>URL-path</var> to handle the
910 <li>redirect to an external <var>URL</var> to handle the
914 <p>The first option is the default, while options 2-4 are
915 configured using the <directive>ErrorDocument</directive>
916 directive, which is followed by the HTTP response code and a URL
917 or a message. Apache httpd will sometimes offer additional information
918 regarding the problem/error.</p>
920 <p>URLs can begin with a slash (/) for local web-paths (relative
921 to the <directive module="core">DocumentRoot</directive>), or be a
922 full URL which the client can resolve. Alternatively, a message
923 can be provided to be displayed by the browser. Examples:</p>
926 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
927 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
928 ErrorDocument 401 /subscription_info.html<br />
929 ErrorDocument 403 "Sorry can't allow you access today"
932 <p>Additionally, the special value <code>default</code> can be used
933 to specify Apache httpd's simple hardcoded message. While not required
934 under normal circumstances, <code>default</code> will restore
935 Apache httpd's simple hardcoded message for configurations that would
936 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
939 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
940 <Directory /web/docs><br />
942 ErrorDocument 404 default<br />
947 <p>Note that when you specify an <directive>ErrorDocument</directive>
948 that points to a remote URL (ie. anything with a method such as
949 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
950 client to tell it where to find the document, even if the
951 document ends up being on the same server. This has several
952 implications, the most important being that the client will not
953 receive the original error status code, but instead will
954 receive a redirect status code. This in turn can confuse web
955 robots and other clients which try to determine if a URL is
956 valid using the status code. In addition, if you use a remote
957 URL in an <code>ErrorDocument 401</code>, the client will not
958 know to prompt the user for a password since it will not
959 receive the 401 status code. Therefore, <strong>if you use an
960 <code>ErrorDocument 401</code> directive then it must refer to a local
961 document.</strong></p>
963 <p>Microsoft Internet Explorer (MSIE) will by default ignore
964 server-generated error messages when they are "too small" and substitute
965 its own "friendly" error messages. The size threshold varies depending on
966 the type of error, but in general, if you make your error document
967 greater than 512 bytes, then MSIE will show the server-generated
968 error rather than masking it. More information is available in
969 Microsoft Knowledge Base article <a
970 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
973 <p>Although most error messages can be overriden, there are certain
974 circumstances where the internal messages are used regardless of the
975 setting of <directive module="core">ErrorDocument</directive>. In
976 particular, if a malformed request is detected, normal request processing
977 will be immediately halted and the internal error message returned.
978 This is necessary to guard against security problems caused by
981 <p>If you are using mod_proxy, you may wish to enable
982 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
983 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
984 Apache httpd will not generate custom error documents for proxied content.</p>
987 <seealso><a href="../custom-error.html">documentation of
988 customizable responses</a></seealso>
992 <name>ErrorLog</name>
993 <description>Location where the server will log errors</description>
994 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
995 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
996 <contextlist><context>server config</context><context>virtual host</context>
1000 <p>The <directive>ErrorLog</directive> directive sets the name of
1001 the file to which the server will log any errors it encounters. If
1002 the <var>file-path</var> is not absolute then it is assumed to be
1003 relative to the <directive module="core">ServerRoot</directive>.</p>
1005 <example><title>Example</title>
1006 ErrorLog /var/log/httpd/error_log
1009 <p>If the <var>file-path</var>
1010 begins with a pipe character "<code>|</code>" then it is assumed to be a
1011 command to spawn to handle the error log.</p>
1013 <example><title>Example</title>
1014 ErrorLog "|/usr/local/bin/httpd_errors"
1017 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1018 more information.</p>
1020 <p>Using <code>syslog</code> instead of a filename enables logging
1021 via syslogd(8) if the system supports it. The default is to use
1022 syslog facility <code>local7</code>, but you can override this by
1023 using the <code>syslog:<var>facility</var></code> syntax where
1024 <var>facility</var> can be one of the names usually documented in
1027 <example><title>Example</title>
1028 ErrorLog syslog:user
1031 <p>SECURITY: See the <a
1032 href="../misc/security_tips.html#serverroot">security tips</a>
1033 document for details on why your security could be compromised
1034 if the directory where log files are stored is writable by
1035 anyone other than the user that starts the server.</p>
1036 <note type="warning"><title>Note</title>
1037 <p>When entering a file path on non-Unix platforms, care should be taken
1038 to make sure that only forward slashed are used even though the platform
1039 may allow the use of back slashes. In general it is a good idea to always
1040 use forward slashes throughout the configuration files.</p>
1043 <seealso><directive module="core">LogLevel</directive></seealso>
1044 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1045 </directivesynopsis>
1048 <name>ErrorLogFormat</name>
1049 <description>Format specification for error log entries</description>
1050 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1051 <contextlist><context>server config</context><context>virtual host</context>
1053 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1056 <p><directive>ErrorLogFormat</directive> allows to specify what
1057 supplementary information is logged in the error log in addition to the
1058 actual log message.</p>
1060 <example><title>Simple example</title>
1061 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1064 <p>Specifying <code>connection</code> or <code>request</code> as first
1065 paramter allows to specify additional formats, causing additional
1066 information to be logged when the first message is logged for a specific
1067 connection or request, respectivly. This additional information is only
1068 logged once per connection/request. If a connection or request is processed
1069 without causing any log message, the additional information is not logged
1072 <p>It can happen that some format string items do not produce output. For
1073 example, the Referer header is only present if the log message is
1074 associated to a request and the log message happens at a time when the
1075 Referer header has already been read from the client. If no output is
1076 produced, the default behaviour is to delete everything from the preceeding
1077 space character to the next space character. This means the log line is
1078 implicitly divided into fields on non-whitespace to whitespace transitions.
1079 If a format string item does not produce output, the whole field is
1080 ommitted. For example, if the remote address <code>%a</code> in the log
1081 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1082 brackets are not logged either. Space characters can be escaped with a
1083 backslash to prevent them from delimiting a field. The combination '% '
1084 (percent space) is a zero-witdh field delimiter that does not produce any
1087 <p>The above behaviour can be changed by adding modifiers to the format
1088 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1089 respective item does not produce any output. In once-per-connection/request
1090 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1091 item with the plus modifier does not produce any output, the whole line is
1094 <p>A number as modifier can be used to assign a log severity level to a
1095 format item. The item will only be logged if the severity of the log
1096 message is not higher than the specified log severity level. The number can
1097 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1099 <p>Some format string items accept additional parameters in braces.</p>
1101 <table border="1" style="zebra">
1102 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1104 <tr><th>Format String</th> <th>Description</th></tr>
1106 <tr><td><code>%%</code></td>
1107 <td>The percent sign</td></tr>
1109 <tr><td><code>%...a</code></td>
1110 <td>Remote IP-address and port</td></tr>
1112 <tr><td><code>%...A</code></td>
1113 <td>Local IP-address and port</td></tr>
1115 <tr><td><code>%...{name}e</code></td>
1116 <td>Request environment variable <code>name</code></td></tr>
1118 <tr><td><code>%...E</code></td>
1119 <td>APR/OS error status code and string</td></tr>
1121 <tr><td><code>%...F</code></td>
1122 <td>Source file name and line number of the log call</td></tr>
1124 <tr><td><code>%...{name}i</code></td>
1125 <td>Request header <code>name</code></td></tr>
1127 <tr><td><code>%...k</code></td>
1128 <td>Number of keep-alive requests on this connection</td></tr>
1130 <tr><td><code>%...l</code></td>
1131 <td>Loglevel of the message</td></tr>
1133 <tr><td><code>%...L</code></td>
1134 <td>Log ID of the request</td></tr>
1136 <tr><td><code>%...{c}L</code></td>
1137 <td>Log ID of the connection</td></tr>
1139 <tr><td><code>%...{C}L</code></td>
1140 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1142 <tr><td><code>%...m</code></td>
1143 <td>Name of the module logging the message</td></tr>
1145 <tr><td><code>%M</code></td>
1146 <td>The actual log message</td></tr>
1148 <tr><td><code>%...{name}n</code></td>
1149 <td>Request note <code>name</code></td></tr>
1151 <tr><td><code>%...P</code></td>
1152 <td>Process ID of current process</td></tr>
1154 <tr><td><code>%...T</code></td>
1155 <td>Thread ID of current thread</td></tr>
1157 <tr><td><code>%...t</code></td>
1158 <td>The current time</td></tr>
1160 <tr><td><code>%...{u}t</code></td>
1161 <td>The current time including micro-seconds</td></tr>
1163 <tr><td><code>%...{cu}t</code></td>
1164 <td>The current time in compact ISO 8601 format, including
1165 micro-seconds</td></tr>
1167 <tr><td><code>%...v</code></td>
1168 <td>The canonical <directive module="core">ServerName</directive>
1169 of the current server.</td></tr>
1171 <tr><td><code>%...V</code></td>
1172 <td>The server name of the server serving the request according to the
1173 <directive module="core" >UseCanonicalName</directive>
1176 <tr><td><code>\ </code> (backslash space)</td>
1177 <td>Non-field delimiting space</td></tr>
1179 <tr><td><code>% </code> (percent space)</td>
1180 <td>Field delimiter (no output)</td></tr>
1183 <p>The log ID format <code>%L</code> produces a unique id for a connection
1184 or request. This can be used to correlate which log lines belong to the
1185 same connection or request, which request happens on which connection.
1186 A <code>%L</code> format string is also available in
1187 <module>mod_log_config</module>, to allow to correlate access log entries
1188 with error log lines. If <module>mod_unique_id</module> is loaded, its
1189 unique id will be used as log ID for requests.</p>
1191 <example><title>Example (somewhat similar to default format)</title>
1192 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1193 %M% ,\ referer\ %{Referer}i"
1196 <example><title>Example (similar to the 2.2.x format)</title>
1197 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1198 %M% ,\ referer\ %{Referer}i"
1201 <example><title>Advanced example with request/connection log IDs</title>
1202 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1203 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1204 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1205 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1206 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1210 <seealso><directive module="core">ErrorLog</directive></seealso>
1211 <seealso><directive module="core">LogLevel</directive></seealso>
1212 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1213 </directivesynopsis>
1216 <name>ExtendedStatus</name>
1217 <description>Keep track of extended status information for each
1218 request</description>
1219 <syntax>ExtendedStatus On|Off</syntax>
1220 <default>ExtendedStatus Off[*]</default>
1221 <contextlist><context>server config</context></contextlist>
1224 <p>This option tracks additional data per worker about the
1225 currently executing request, and a utilization summary; you
1226 can see these variables during runtime by configuring
1227 <module>mod_status</module>. Note that other modules may
1228 rely on this scoreboard.</p>
1230 <p>This setting applies to the entire server, and cannot be
1231 enabled or disabled on a virtualhost-by-virtualhost basis.
1232 The collection of extended status information can slow down
1233 the server. Also note that this setting cannot be changed
1234 during a graceful restart.</p>
1237 <p>Note that loading <module>mod_status</module> will change
1238 the default behavior to ExtendedStatus On, while other
1239 third party modules may do the same. Such modules rely on
1240 collecting detailed information about the state of all workers.
1241 The default is changed by <module>mod_status</module> beginning
1242 with version 2.3.6; the previous default was always Off.</p>
1247 </directivesynopsis>
1250 <name>FileETag</name>
1251 <description>File attributes used to create the ETag
1252 HTTP response header for static files</description>
1253 <syntax>FileETag <var>component</var> ...</syntax>
1254 <default>FileETag INode MTime Size</default>
1255 <contextlist><context>server config</context><context>virtual host</context>
1256 <context>directory</context><context>.htaccess</context>
1258 <override>FileInfo</override>
1262 The <directive>FileETag</directive> directive configures the file
1263 attributes that are used to create the <code>ETag</code> (entity
1264 tag) response header field when the document is based on a static file.
1265 (The <code>ETag</code> value is used in cache management to save
1266 network bandwidth.) The
1267 <directive>FileETag</directive> directive allows you to choose
1268 which of these -- if any -- should be used. The recognized keywords are:
1272 <dt><strong>INode</strong></dt>
1273 <dd>The file's i-node number will be included in the calculation</dd>
1274 <dt><strong>MTime</strong></dt>
1275 <dd>The date and time the file was last modified will be included</dd>
1276 <dt><strong>Size</strong></dt>
1277 <dd>The number of bytes in the file will be included</dd>
1278 <dt><strong>All</strong></dt>
1279 <dd>All available fields will be used. This is equivalent to:
1280 <example>FileETag INode MTime Size</example></dd>
1281 <dt><strong>None</strong></dt>
1282 <dd>If a document is file-based, no <code>ETag</code> field will be
1283 included in the response</dd>
1286 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1287 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1288 which allow changes to be made to the default setting inherited
1289 from a broader scope. Any keyword appearing without such a prefix
1290 immediately and completely cancels the inherited setting.</p>
1292 <p>If a directory's configuration includes
1293 <code>FileETag INode MTime Size</code>, and a
1294 subdirectory's includes <code>FileETag -INode</code>,
1295 the setting for that subdirectory (which will be inherited by
1296 any sub-subdirectories that don't override it) will be equivalent to
1297 <code>FileETag MTime Size</code>.</p>
1298 <note type="warning"><title>Warning</title>
1299 Do not change the default for directories or locations that have WebDAV
1300 enabled and use <module>mod_dav_fs</module> as a storage provider.
1301 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1302 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1303 These conditional requests will break if the <code>ETag</code> format is
1304 changed via <directive>FileETag</directive>.
1306 <note><title>Server Side Includes</title>
1307 An ETag is not generated for responses parsed by <module>mod_include</module>,
1308 since the response entity can change without a change of the INode, MTime, or Size
1309 of the static file with embedded SSI directives.
1313 </directivesynopsis>
1315 <directivesynopsis type="section">
1317 <description>Contains directives that apply to matched
1318 filenames</description>
1319 <syntax><Files <var>filename</var>> ... </Files></syntax>
1320 <contextlist><context>server config</context><context>virtual host</context>
1321 <context>directory</context><context>.htaccess</context>
1323 <override>All</override>
1326 <p>The <directive type="section">Files</directive> directive
1327 limits the scope of the enclosed directives by filename. It is comparable
1328 to the <directive module="core" type="section">Directory</directive>
1329 and <directive module="core" type="section">Location</directive>
1330 directives. It should be matched with a <code></Files></code>
1331 directive. The directives given within this section will be applied to
1332 any object with a basename (last component of filename) matching the
1333 specified filename. <directive type="section">Files</directive>
1334 sections are processed in the order they appear in the
1335 configuration file, after the <directive module="core"
1336 type="section">Directory</directive> sections and
1337 <code>.htaccess</code> files are read, but before <directive
1338 type="section" module="core">Location</directive> sections. Note
1339 that <directive type="section">Files</directive> can be nested
1340 inside <directive type="section"
1341 module="core">Directory</directive> sections to restrict the
1342 portion of the filesystem they apply to.</p>
1344 <p>The <var>filename</var> argument should include a filename, or
1345 a wild-card string, where <code>?</code> matches any single character,
1346 and <code>*</code> matches any sequences of characters.
1347 <glossary ref="regex">Regular expressions</glossary>
1348 can also be used, with the addition of the
1349 <code>~</code> character. For example:</p>
1352 <Files ~ "\.(gif|jpe?g|png)$">
1355 <p>would match most common Internet graphics formats. <directive
1356 module="core" type="section">FilesMatch</directive> is preferred,
1359 <p>Note that unlike <directive type="section"
1360 module="core">Directory</directive> and <directive type="section"
1361 module="core">Location</directive> sections, <directive
1362 type="section">Files</directive> sections can be used inside
1363 <code>.htaccess</code> files. This allows users to control access to
1364 their own files, at a file-by-file level.</p>
1367 <seealso><a href="../sections.html">How <Directory>, <Location>
1368 and <Files> sections work</a> for an explanation of how these
1369 different sections are combined when a request is received</seealso>
1370 </directivesynopsis>
1372 <directivesynopsis type="section">
1373 <name>FilesMatch</name>
1374 <description>Contains directives that apply to regular-expression matched
1375 filenames</description>
1376 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1377 <contextlist><context>server config</context><context>virtual host</context>
1378 <context>directory</context><context>.htaccess</context>
1380 <override>All</override>
1383 <p>The <directive type="section">FilesMatch</directive> directive
1384 limits the scope of the enclosed directives by filename, just as the
1385 <directive module="core" type="section">Files</directive> directive
1386 does. However, it accepts a <glossary ref="regex">regular
1387 expression</glossary>. For example:</p>
1390 <FilesMatch "\.(gif|jpe?g|png)$">
1393 <p>would match most common Internet graphics formats.</p>
1396 <seealso><a href="../sections.html">How <Directory>, <Location>
1397 and <Files> sections work</a> for an explanation of how these
1398 different sections are combined when a request is received</seealso>
1399 </directivesynopsis>
1402 <name>ForceType</name>
1403 <description>Forces all matching files to be served with the specified
1404 media type in the HTTP Content-Type header field</description>
1405 <syntax>ForceType <var>media-type</var>|None</syntax>
1406 <contextlist><context>directory</context><context>.htaccess</context>
1408 <override>FileInfo</override>
1409 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1412 <p>When placed into an <code>.htaccess</code> file or a
1413 <directive type="section" module="core">Directory</directive>, or
1414 <directive type="section" module="core">Location</directive> or
1415 <directive type="section" module="core">Files</directive>
1416 section, this directive forces all matching files to be served
1417 with the content type identification given by
1418 <var>media-type</var>. For example, if you had a directory full of
1419 GIF files, but did not want to label them all with <code>.gif</code>,
1420 you might want to use:</p>
1426 <p>Note that this directive overrides other indirect media type
1427 associations defined in mime.types or via the
1428 <directive module="mod_mime">AddType</directive>.</p>
1430 <p>You can also override more general
1431 <directive>ForceType</directive> settings
1432 by using the value of <code>None</code>:</p>
1435 # force all files to be image/gif:<br />
1436 <Location /images><br />
1438 ForceType image/gif<br />
1440 </Location><br />
1442 # but normal mime-type associations here:<br />
1443 <Location /images/mixed><br />
1445 ForceType None<br />
1450 <p>This directive primarily overrides the content types generated for
1451 static files served out of the filesystem. For resources other than
1452 static files, where the generator of the response typically specifies
1453 a Content-Type, this directive has no effect.</p>
1456 </directivesynopsis>
1458 <name>GprofDir</name>
1459 <description>Directory to write gmon.out profiling data to. </description>
1460 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1461 <contextlist><context>server config</context><context>virtual host</context>
1465 <p>When the server has been compiled with gprof profiling suppport,
1466 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1467 be written to the specified directory when the process exits. If the
1468 argument ends with a percent symbol ('%'), subdirectories are created
1469 for each process id.</p>
1471 <p>This directive currently only works with the <module>prefork</module>
1474 </directivesynopsis>
1477 <name>HostnameLookups</name>
1478 <description>Enables DNS lookups on client IP addresses</description>
1479 <syntax>HostnameLookups On|Off|Double</syntax>
1480 <default>HostnameLookups Off</default>
1481 <contextlist><context>server config</context><context>virtual host</context>
1482 <context>directory</context></contextlist>
1485 <p>This directive enables DNS lookups so that host names can be
1486 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1487 The value <code>Double</code> refers to doing double-reverse
1488 DNS lookup. That is, after a reverse lookup is performed, a forward
1489 lookup is then performed on that result. At least one of the IP
1490 addresses in the forward lookup must match the original
1491 address. (In "tcpwrappers" terminology this is called
1492 <code>PARANOID</code>.)</p>
1494 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1495 used for controlling access by hostname, a double reverse lookup
1496 will be performed. This is necessary for security. Note that the
1497 result of this double-reverse isn't generally available unless you
1498 set <code>HostnameLookups Double</code>. For example, if only
1499 <code>HostnameLookups On</code> and a request is made to an object
1500 that is protected by hostname restrictions, regardless of whether
1501 the double-reverse fails or not, CGIs will still be passed the
1502 single-reverse result in <code>REMOTE_HOST</code>.</p>
1504 <p>The default is <code>Off</code> in order to save the network
1505 traffic for those sites that don't truly need the reverse
1506 lookups done. It is also better for the end users because they
1507 don't have to suffer the extra latency that a lookup entails.
1508 Heavily loaded sites should leave this directive
1509 <code>Off</code>, since DNS lookups can take considerable
1510 amounts of time. The utility <program>logresolve</program>, compiled by
1511 default to the <code>bin</code> subdirectory of your installation
1512 directory, can be used to look up host names from logged IP addresses
1515 </directivesynopsis>
1517 <directivesynopsis type="section">
1519 <description>Contains directives that apply only if a condition is
1520 satisfied by a request at runtime</description>
1521 <syntax><If <var>expression</var>> ... </If></syntax>
1522 <contextlist><context>server config</context><context>virtual host</context>
1523 <context>directory</context><context>.htaccess</context>
1525 <override>All</override>
1528 <p>The <directive type="section">If</directive> directive
1529 evaluates an expression at runtime, and applies the enclosed
1530 directives if and only if the expression evaluates to true.
1534 <If "$req{Host} = ''">
1537 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1539 <p>You may compare the value of any variable in the request headers
1540 ($req), response headers ($resp) or environment ($env) in your
1543 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1544 operator to compare if the expression is in a given range:</p>
1547 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1552 <seealso><a href="../sections.html">How <Directory>, <Location>,
1553 <Files> sections work</a> for an explanation of how these
1554 different sections are combined when a request is received.
1555 <directive type="section">If</directive> has the same precedence
1556 and usage as <directive type="section">Files</directive></seealso>
1557 </directivesynopsis>
1559 <directivesynopsis type="section">
1560 <name>IfDefine</name>
1561 <description>Encloses directives that will be processed only
1562 if a test is true at startup</description>
1563 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1564 </IfDefine></syntax>
1565 <contextlist><context>server config</context><context>virtual host</context>
1566 <context>directory</context><context>.htaccess</context>
1568 <override>All</override>
1571 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1572 </code> section is used to mark directives that are conditional. The
1573 directives within an <directive type="section">IfDefine</directive>
1574 section are only processed if the <var>test</var> is true. If <var>
1575 test</var> is false, everything between the start and end markers is
1578 <p>The <var>test</var> in the <directive type="section"
1579 >IfDefine</directive> section directive can be one of two forms:</p>
1582 <li><var>parameter-name</var></li>
1584 <li><code>!</code><var>parameter-name</var></li>
1587 <p>In the former case, the directives between the start and end
1588 markers are only processed if the parameter named
1589 <var>parameter-name</var> is defined. The second format reverses
1590 the test, and only processes the directives if
1591 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1593 <p>The <var>parameter-name</var> argument is a define as given on the
1594 <program>httpd</program> command line via <code>-D<var>parameter</var>
1595 </code> at the time the server was started or by the <directive
1596 module="core">Define</directive> directive.</p>
1598 <p><directive type="section">IfDefine</directive> sections are
1599 nest-able, which can be used to implement simple
1600 multiple-parameter tests. Example:</p>
1603 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1606 <IfDefine ReverseProxy><br />
1608 LoadModule proxy_module modules/mod_proxy.so<br />
1609 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1610 <IfDefine UseCache><br />
1612 LoadModule cache_module modules/mod_cache.so<br />
1613 <IfDefine MemCache><br />
1615 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1617 </IfDefine><br />
1618 <IfDefine !MemCache><br />
1620 LoadModule disk_cache_module modules/mod_disk_cache.so<br />
1629 </directivesynopsis>
1631 <directivesynopsis type="section">
1632 <name>IfModule</name>
1633 <description>Encloses directives that are processed conditional on the
1634 presence or absence of a specific module</description>
1635 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1636 </IfModule></syntax>
1637 <contextlist><context>server config</context><context>virtual host</context>
1638 <context>directory</context><context>.htaccess</context>
1640 <override>All</override>
1641 <compatibility>Module identifiers are available in version 2.1 and
1642 later.</compatibility>
1645 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1646 section is used to mark directives that are conditional on the presence of
1647 a specific module. The directives within an <directive type="section"
1648 >IfModule</directive> section are only processed if the <var>test</var>
1649 is true. If <var>test</var> is false, everything between the start and
1650 end markers is ignored.</p>
1652 <p>The <var>test</var> in the <directive type="section"
1653 >IfModule</directive> section directive can be one of two forms:</p>
1656 <li><var>module</var></li>
1658 <li>!<var>module</var></li>
1661 <p>In the former case, the directives between the start and end
1662 markers are only processed if the module named <var>module</var>
1663 is included in Apache httpd -- either compiled in or
1664 dynamically loaded using <directive module="mod_so"
1665 >LoadModule</directive>. The second format reverses the test,
1666 and only processes the directives if <var>module</var> is
1667 <strong>not</strong> included.</p>
1669 <p>The <var>module</var> argument can be either the module identifier or
1670 the file name of the module, at the time it was compiled. For example,
1671 <code>rewrite_module</code> is the identifier and
1672 <code>mod_rewrite.c</code> is the file name. If a module consists of
1673 several source files, use the name of the file containing the string
1674 <code>STANDARD20_MODULE_STUFF</code>.</p>
1676 <p><directive type="section">IfModule</directive> sections are
1677 nest-able, which can be used to implement simple multiple-module
1680 <note>This section should only be used if you need to have one
1681 configuration file that works whether or not a specific module
1682 is available. In normal operation, directives need not be
1683 placed in <directive type="section">IfModule</directive>
1686 </directivesynopsis>
1689 <name>Include</name>
1690 <description>Includes other configuration files from within
1691 the server configuration files</description>
1692 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1693 <contextlist><context>server config</context><context>virtual host</context>
1694 <context>directory</context>
1696 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1697 wildcard matching available in 2.3.6 and later</compatibility>
1700 <p>This directive allows inclusion of other configuration files
1701 from within the server configuration files.</p>
1703 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1704 in the filename or directory parts of the path to include several files
1705 at once, in alphabetical order. In addition, if
1706 <directive>Include</directive> points to a directory, rather than a file,
1707 Apache httpd will read all files in that directory and any subdirectory.
1708 However, including entire directories is not recommended, because it is
1709 easy to accidentally leave temporary files in a directory that can cause
1710 <program>httpd</program> to fail. Instead, we encourage you to use the
1711 wildcard syntax shown below, to include files that match a particular
1712 pattern, such as *.conf, for example.</p>
1714 <p>When a wildcard is specified for a <strong>file</strong> component of
1715 the path, and no file matches the wildcard, the
1716 <directive module="core">Include</directive>
1717 directive will be <strong>silently ignored</strong>. When a wildcard is
1718 specified for a <strong>directory</strong> component of the path, and
1719 no directory matches the wildcard, the
1720 <directive module="core">Include</directive> directive will
1721 <strong>fail with an error</strong> saying the directory cannot be found.
1724 <p>For further control over the behaviour of the server when no files or
1725 directories match, prefix the path with the modifiers <var>optional</var>
1726 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1727 file or directory that does not match will be silently ignored. If
1728 <var>strict</var> is specified, any wildcard file or directory that does
1729 not match at least one file will cause server startup to fail.</p>
1731 <p>When a directory or file component of the path is
1732 specified exactly, and that directory or file does not exist,
1733 <directive module="core">Include</directive> directive will fail with an
1734 error saying the file or directory cannot be found.</p>
1736 <p>The file path specified may be an absolute path, or may be relative
1737 to the <directive module="core">ServerRoot</directive> directory.</p>
1742 Include /usr/local/apache2/conf/ssl.conf<br />
1743 Include /usr/local/apache2/conf/vhosts/*.conf
1746 <p>Or, providing paths relative to your <directive
1747 module="core">ServerRoot</directive> directory:</p>
1750 Include conf/ssl.conf<br />
1751 Include conf/vhosts/*.conf
1754 <p>Wildcards may be included in the directory or file portion of the
1755 path. In the following example, the server will fail to load if no
1756 directories match conf/vhosts/*, but will load successfully if no
1757 files match *.conf.</p>
1760 Include conf/vhosts/*/vhost.conf<br />
1761 Include conf/vhosts/*/*.conf
1764 <p>In this example, the server will fail to load if either
1765 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1768 Include strict conf/vhosts/*/*.conf
1771 <p>In this example, the server load successfully if either conf/vhosts/*
1772 matches no directories, or if *.conf matches no files:</p>
1775 Include optional conf/vhosts/*/*.conf
1780 <seealso><program>apachectl</program></seealso>
1781 </directivesynopsis>
1784 <name>KeepAlive</name>
1785 <description>Enables HTTP persistent connections</description>
1786 <syntax>KeepAlive On|Off</syntax>
1787 <default>KeepAlive On</default>
1788 <contextlist><context>server config</context><context>virtual host</context>
1792 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1793 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1794 which allow multiple requests to be sent over the same TCP
1795 connection. In some cases this has been shown to result in an
1796 almost 50% speedup in latency times for HTML documents with
1797 many images. To enable Keep-Alive connections, set
1798 <code>KeepAlive On</code>.</p>
1800 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1801 used if they are specifically requested by a client. In
1802 addition, a Keep-Alive connection with an HTTP/1.0 client can
1803 only be used when the length of the content is known in
1804 advance. This implies that dynamic content such as CGI output,
1805 SSI pages, and server-generated directory listings will
1806 generally not use Keep-Alive connections to HTTP/1.0 clients.
1807 For HTTP/1.1 clients, persistent connections are the default
1808 unless otherwise specified. If the client requests it, chunked
1809 encoding will be used in order to send content of unknown
1810 length over persistent connections.</p>
1812 <p>When a client uses a Keep-Alive connection it will be counted
1813 as a single "request" for the <directive module="mpm_common"
1814 >MaxConnectionsPerChild</directive> directive, regardless
1815 of how many requests are sent using the connection.</p>
1818 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1819 </directivesynopsis>
1822 <name>KeepAliveTimeout</name>
1823 <description>Amount of time the server will wait for subsequent
1824 requests on a persistent connection</description>
1825 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1826 <default>KeepAliveTimeout 5</default>
1827 <contextlist><context>server config</context><context>virtual host</context>
1829 <compatibility>Specifying a value in milliseconds is available in
1830 Apache httpd 2.3.2 and later</compatibility>
1833 <p>The number of seconds Apache httpd will wait for a subsequent
1834 request before closing the connection. By adding a postfix of ms the
1835 timeout can be also set in milliseconds. Once a request has been
1836 received, the timeout value specified by the
1837 <directive module="core">Timeout</directive> directive applies.</p>
1839 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1840 may cause performance problems in heavily loaded servers. The
1841 higher the timeout, the more server processes will be kept
1842 occupied waiting on connections with idle clients.</p>
1844 <p>In a name-based virtual host context, the value of the first
1845 defined virtual host (the default host) in a set of <directive
1846 module="core">NameVirtualHost</directive> will be used.
1847 The other values will be ignored.</p>
1849 </directivesynopsis>
1851 <directivesynopsis type="section">
1853 <description>Restrict enclosed access controls to only certain HTTP
1854 methods</description>
1855 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1856 </Limit></syntax>
1857 <contextlist><context>directory</context><context>.htaccess</context>
1859 <override>AuthConfig, Limit</override>
1862 <p>Access controls are normally effective for
1863 <strong>all</strong> access methods, and this is the usual
1864 desired behavior. <strong>In the general case, access control
1865 directives should not be placed within a
1866 <directive type="section">Limit</directive> section.</strong></p>
1868 <p>The purpose of the <directive type="section">Limit</directive>
1869 directive is to restrict the effect of the access controls to the
1870 nominated HTTP methods. For all other methods, the access
1871 restrictions that are enclosed in the <directive
1872 type="section">Limit</directive> bracket <strong>will have no
1873 effect</strong>. The following example applies the access control
1874 only to the methods <code>POST</code>, <code>PUT</code>, and
1875 <code>DELETE</code>, leaving all other methods unprotected:</p>
1878 <Limit POST PUT DELETE><br />
1880 Require valid-user<br />
1885 <p>The method names listed can be one or more of: <code>GET</code>,
1886 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1887 <code>CONNECT</code>, <code>OPTIONS</code>,
1888 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1889 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1890 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1891 case-sensitive.</strong> If <code>GET</code> is used it will also
1892 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1893 cannot be limited (see <directive module="core"
1894 >TraceEnable</directive>).</p>
1896 <note type="warning">A <directive type="section"
1897 module="core">LimitExcept</directive> section should always be
1898 used in preference to a <directive type="section">Limit</directive>
1899 section when restricting access, since a <directive type="section"
1900 module="core">LimitExcept</directive> section provides protection
1901 against arbitrary methods.</note>
1903 <p>The <directive type="section">Limit</directive> and
1904 <directive type="section" module="core">LimitExcept</directive>
1905 directives may be nested. In this case, each successive level of
1906 <directive type="section">Limit</directive> or <directive
1907 type="section" module="core">LimitExcept</directive> directives must
1908 further restrict the set of methods to which access controls apply.</p>
1910 <note type="warning">When using
1911 <directive type="section">Limit</directive> or
1912 <directive type="section">LimitExcept</directive> directives with
1913 the <directive module="mod_authz_core">Require</directive> directive,
1914 note that the first <directive module="mod_authz_core">Require</directive>
1915 to succeed authorizes the request, regardless of the presence of other
1916 <directive module="mod_authz_core">Require</directive> directives.</note>
1918 <p>For example, given the following configuration, all users will
1919 be authorized for <code>POST</code> requests, and the
1920 <code>Require group editors</code> directive will be ignored
1924 <LimitExcept GET>
1928 </LimitExcept><br />
1931 Require group editors
1936 </directivesynopsis>
1938 <directivesynopsis type="section">
1939 <name>LimitExcept</name>
1940 <description>Restrict access controls to all HTTP methods
1941 except the named ones</description>
1942 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1943 </LimitExcept></syntax>
1944 <contextlist><context>directory</context><context>.htaccess</context>
1946 <override>AuthConfig, Limit</override>
1949 <p><directive type="section">LimitExcept</directive> and
1950 <code></LimitExcept></code> are used to enclose
1951 a group of access control directives which will then apply to any
1952 HTTP access method <strong>not</strong> listed in the arguments;
1953 i.e., it is the opposite of a <directive type="section"
1954 module="core">Limit</directive> section and can be used to control
1955 both standard and nonstandard/unrecognized methods. See the
1956 documentation for <directive module="core"
1957 type="section">Limit</directive> for more details.</p>
1962 <LimitExcept POST GET><br />
1964 Require valid-user<br />
1966 </LimitExcept>
1970 </directivesynopsis>
1973 <name>LimitInternalRecursion</name>
1974 <description>Determine maximum number of internal redirects and nested
1975 subrequests</description>
1976 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
1977 <default>LimitInternalRecursion 10</default>
1978 <contextlist><context>server config</context><context>virtual host</context>
1980 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
1983 <p>An internal redirect happens, for example, when using the <directive
1984 module="mod_actions">Action</directive> directive, which internally
1985 redirects the original request to a CGI script. A subrequest is Apache httpd's
1986 mechanism to find out what would happen for some URI if it were requested.
1987 For example, <module>mod_dir</module> uses subrequests to look for the
1988 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
1991 <p><directive>LimitInternalRecursion</directive> prevents the server
1992 from crashing when entering an infinite loop of internal redirects or
1993 subrequests. Such loops are usually caused by misconfigurations.</p>
1995 <p>The directive stores two different limits, which are evaluated on
1996 per-request basis. The first <var>number</var> is the maximum number of
1997 internal redirects, that may follow each other. The second <var>number</var>
1998 determines, how deep subrequests may be nested. If you specify only one
1999 <var>number</var>, it will be assigned to both limits.</p>
2001 <example><title>Example</title>
2002 LimitInternalRecursion 5
2005 </directivesynopsis>
2008 <name>LimitRequestBody</name>
2009 <description>Restricts the total size of the HTTP request body sent
2010 from the client</description>
2011 <syntax>LimitRequestBody <var>bytes</var></syntax>
2012 <default>LimitRequestBody 0</default>
2013 <contextlist><context>server config</context><context>virtual host</context>
2014 <context>directory</context><context>.htaccess</context>
2016 <override>All</override>
2019 <p>This directive specifies the number of <var>bytes</var> from 0
2020 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2023 <p>The <directive>LimitRequestBody</directive> directive allows
2024 the user to set a limit on the allowed size of an HTTP request
2025 message body within the context in which the directive is given
2026 (server, per-directory, per-file or per-location). If the client
2027 request exceeds that limit, the server will return an error
2028 response instead of servicing the request. The size of a normal
2029 request message body will vary greatly depending on the nature of
2030 the resource and the methods allowed on that resource. CGI scripts
2031 typically use the message body for retrieving form information.
2032 Implementations of the <code>PUT</code> method will require
2033 a value at least as large as any representation that the server
2034 wishes to accept for that resource.</p>
2036 <p>This directive gives the server administrator greater
2037 control over abnormal client request behavior, which may be
2038 useful for avoiding some forms of denial-of-service
2041 <p>If, for example, you are permitting file upload to a particular
2042 location, and wish to limit the size of the uploaded file to 100K,
2043 you might use the following directive:</p>
2046 LimitRequestBody 102400
2050 </directivesynopsis>
2053 <name>LimitRequestFields</name>
2054 <description>Limits the number of HTTP request header fields that
2055 will be accepted from the client</description>
2056 <syntax>LimitRequestFields <var>number</var></syntax>
2057 <default>LimitRequestFields 100</default>
2058 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2061 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2062 32767. The default value is defined by the compile-time
2063 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2066 <p>The <directive>LimitRequestFields</directive> directive allows
2067 the server administrator to modify the limit on the number of
2068 request header fields allowed in an HTTP request. A server needs
2069 this value to be larger than the number of fields that a normal
2070 client request might include. The number of request header fields
2071 used by a client rarely exceeds 20, but this may vary among
2072 different client implementations, often depending upon the extent
2073 to which a user has configured their browser to support detailed
2074 content negotiation. Optional HTTP extensions are often expressed
2075 using request header fields.</p>
2077 <p>This directive gives the server administrator greater
2078 control over abnormal client request behavior, which may be
2079 useful for avoiding some forms of denial-of-service attacks.
2080 The value should be increased if normal clients see an error
2081 response from the server that indicates too many fields were
2082 sent in the request.</p>
2087 LimitRequestFields 50
2090 <note type="warning"><title>Warning</title>
2091 <p> When name-based virtual hosting is used, the value for this
2092 directive is taken from the default (first-listed) virtual host for the
2093 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2097 </directivesynopsis>
2100 <name>LimitRequestFieldSize</name>
2101 <description>Limits the size of the HTTP request header allowed from the
2102 client</description>
2103 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2104 <default>LimitRequestFieldSize 8190</default>
2105 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2108 <p>This directive specifies the number of <var>bytes</var>
2109 that will be allowed in an HTTP request header.</p>
2111 <p>The <directive>LimitRequestFieldSize</directive> directive
2112 allows the server administrator to reduce or increase the limit
2113 on the allowed size of an HTTP request header field. A server
2114 needs this value to be large enough to hold any one header field
2115 from a normal client request. The size of a normal request header
2116 field will vary greatly among different client implementations,
2117 often depending upon the extent to which a user has configured
2118 their browser to support detailed content negotiation. SPNEGO
2119 authentication headers can be up to 12392 bytes.</p>
2121 <p>This directive gives the server administrator greater
2122 control over abnormal client request behavior, which may be
2123 useful for avoiding some forms of denial-of-service attacks.</p>
2128 LimitRequestFieldSize 4094
2131 <note>Under normal conditions, the value should not be changed from
2134 <note type="warning"><title>Warning</title>
2135 <p> When name-based virtual hosting is used, the value for this
2136 directive is taken from the default (first-listed) virtual host for the
2137 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2141 </directivesynopsis>
2144 <name>LimitRequestLine</name>
2145 <description>Limit the size of the HTTP request line that will be accepted
2146 from the client</description>
2147 <syntax>LimitRequestLine <var>bytes</var></syntax>
2148 <default>LimitRequestLine 8190</default>
2149 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2152 <p>This directive sets the number of <var>bytes</var> that will be
2153 allowed on the HTTP request-line.</p>
2155 <p>The <directive>LimitRequestLine</directive> directive allows
2156 the server administrator to reduce or increase the limit on the allowed size
2157 of a client's HTTP request-line. Since the request-line consists of the
2158 HTTP method, URI, and protocol version, the
2159 <directive>LimitRequestLine</directive> directive places a
2160 restriction on the length of a request-URI allowed for a request
2161 on the server. A server needs this value to be large enough to
2162 hold any of its resource names, including any information that
2163 might be passed in the query part of a <code>GET</code> request.</p>
2165 <p>This directive gives the server administrator greater
2166 control over abnormal client request behavior, which may be
2167 useful for avoiding some forms of denial-of-service attacks.</p>
2172 LimitRequestLine 4094
2175 <note>Under normal conditions, the value should not be changed from
2178 <note type="warning"><title>Warning</title>
2179 <p> When name-based virtual hosting is used, the value for this
2180 directive is taken from the default (first-listed) virtual host for the
2181 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2185 </directivesynopsis>
2188 <name>LimitXMLRequestBody</name>
2189 <description>Limits the size of an XML-based request body</description>
2190 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2191 <default>LimitXMLRequestBody 1000000</default>
2192 <contextlist><context>server config</context><context>virtual host</context>
2193 <context>directory</context><context>.htaccess</context></contextlist>
2194 <override>All</override>
2197 <p>Limit (in bytes) on maximum size of an XML-based request
2198 body. A value of <code>0</code> will disable any checking.</p>
2203 LimitXMLRequestBody 0
2207 </directivesynopsis>
2209 <directivesynopsis type="section">
2210 <name>Location</name>
2211 <description>Applies the enclosed directives only to matching
2213 <syntax><Location
2214 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2215 <contextlist><context>server config</context><context>virtual host</context>
2219 <p>The <directive type="section">Location</directive> directive
2220 limits the scope of the enclosed directives by URL. It is similar to the
2221 <directive type="section" module="core">Directory</directive>
2222 directive, and starts a subsection which is terminated with a
2223 <code></Location></code> directive. <directive
2224 type="section">Location</directive> sections are processed in the
2225 order they appear in the configuration file, after the <directive
2226 type="section" module="core">Directory</directive> sections and
2227 <code>.htaccess</code> files are read, and after the <directive
2228 type="section" module="core">Files</directive> sections.</p>
2230 <p><directive type="section">Location</directive> sections operate
2231 completely outside the filesystem. This has several consequences.
2232 Most importantly, <directive type="section">Location</directive>
2233 directives should not be used to control access to filesystem
2234 locations. Since several different URLs may map to the same
2235 filesystem location, such access controls may by circumvented.</p>
2237 <note><title>When to use <directive
2238 type="section">Location</directive></title>
2240 <p>Use <directive type="section">Location</directive> to apply
2241 directives to content that lives outside the filesystem. For
2242 content that lives in the filesystem, use <directive
2243 type="section" module="core">Directory</directive> and <directive
2244 type="section" module="core">Files</directive>. An exception is
2245 <code><Location /></code>, which is an easy way to
2246 apply a configuration to the entire server.</p>
2249 <p>For all origin (non-proxy) requests, the URL to be matched is a
2250 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2251 port, or query string may be included.</em> For proxy requests, the
2252 URL to be matched is of the form
2253 <code>scheme://servername/path</code>, and you must include the
2256 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2257 any single character, and <code>*</code> matches any sequences of
2258 characters. Neither wildcard character matches a / in the URL-path.</p>
2260 <p><glossary ref="regex">Regular expressions</glossary>
2261 can also be used, with the addition of the <code>~</code>
2262 character. For example:</p>
2265 <Location ~ "/(extra|special)/data">
2268 <p>would match URLs that contained the substring <code>/extra/data</code>
2269 or <code>/special/data</code>. The directive <directive
2270 type="section" module="core">LocationMatch</directive> behaves
2271 identical to the regex version of <directive
2272 type="section">Location</directive>, and is preferred, for the
2273 simple reason that <code>~</code> is hard to distinguish from
2274 <code>-</code> in many fonts.</p>
2276 <p>The <directive type="section">Location</directive>
2277 functionality is especially useful when combined with the
2278 <directive module="core">SetHandler</directive>
2279 directive. For example, to enable status requests, but allow them
2280 only from browsers at <code>example.com</code>, you might use:</p>
2283 <Location /status><br />
2285 SetHandler server-status<br />
2286 Require host example.com<br />
2291 <note><title>Note about / (slash)</title>
2292 <p>The slash character has special meaning depending on where in a
2293 URL it appears. People may be used to its behavior in the filesystem
2294 where multiple adjacent slashes are frequently collapsed to a single
2295 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2296 <code>/home/foo</code>). In URL-space this is not necessarily true.
2297 The <directive type="section" module="core">LocationMatch</directive>
2298 directive and the regex version of <directive type="section"
2299 >Location</directive> require you to explicitly specify multiple
2300 slashes if that is your intention.</p>
2302 <p>For example, <code><LocationMatch ^/abc></code> would match
2303 the request URL <code>/abc</code> but not the request URL <code>
2304 //abc</code>. The (non-regex) <directive type="section"
2305 >Location</directive> directive behaves similarly when used for
2306 proxy requests. But when (non-regex) <directive type="section"
2307 >Location</directive> is used for non-proxy requests it will
2308 implicitly match multiple slashes with a single slash. For example,
2309 if you specify <code><Location /abc/def></code> and the
2310 request is to <code>/abc//def</code> then it will match.</p>
2313 <seealso><a href="../sections.html">How <Directory>, <Location>
2314 and <Files> sections work</a> for an explanation of how these
2315 different sections are combined when a request is received.</seealso>
2316 <seealso><directive module="core">LocationMatch</directive></seealso>
2317 </directivesynopsis>
2319 <directivesynopsis type="section">
2320 <name>LocationMatch</name>
2321 <description>Applies the enclosed directives only to regular-expression
2322 matching URLs</description>
2323 <syntax><LocationMatch
2324 <var>regex</var>> ... </LocationMatch></syntax>
2325 <contextlist><context>server config</context><context>virtual host</context>
2329 <p>The <directive type="section">LocationMatch</directive> directive
2330 limits the scope of the enclosed directives by URL, in an identical manner
2331 to <directive module="core" type="section">Location</directive>. However,
2332 it takes a <glossary ref="regex">regular expression</glossary>
2333 as an argument instead of a simple string. For example:</p>
2336 <LocationMatch "/(extra|special)/data">
2339 <p>would match URLs that contained the substring <code>/extra/data</code>
2340 or <code>/special/data</code>.</p>
2343 <seealso><a href="../sections.html">How <Directory>, <Location>
2344 and <Files> sections work</a> for an explanation of how these
2345 different sections are combined when a request is received</seealso>
2346 </directivesynopsis>
2349 <name>LogLevel</name>
2350 <description>Controls the verbosity of the ErrorLog</description>
2351 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2352 [<var>module</var>:<var>level</var>] ...
2354 <default>LogLevel warn</default>
2355 <contextlist><context>server config</context><context>virtual host</context>
2356 <context>directory</context>
2358 <compatibility>Per-module and per-directory configuration is available in
2359 Apache HTTP Server 2.3.6 and later</compatibility>
2362 <p><directive>LogLevel</directive> adjusts the verbosity of the
2363 messages recorded in the error logs (see <directive
2364 module="core">ErrorLog</directive> directive). The following
2365 <var>level</var>s are available, in order of decreasing
2369 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2372 <th><strong>Level</strong> </th>
2374 <th><strong>Description</strong> </th>
2376 <th><strong>Example</strong> </th>
2380 <td><code>emerg</code> </td>
2382 <td>Emergencies - system is unusable.</td>
2384 <td>"Child cannot open lock file. Exiting"</td>
2388 <td><code>alert</code> </td>
2390 <td>Action must be taken immediately.</td>
2392 <td>"getpwuid: couldn't determine user name from uid"</td>
2396 <td><code>crit</code> </td>
2398 <td>Critical Conditions.</td>
2400 <td>"socket: Failed to get a socket, exiting child"</td>
2404 <td><code>error</code> </td>
2406 <td>Error conditions.</td>
2408 <td>"Premature end of script headers"</td>
2412 <td><code>warn</code> </td>
2414 <td>Warning conditions.</td>
2416 <td>"child process 1234 did not exit, sending another
2421 <td><code>notice</code> </td>
2423 <td>Normal but significant condition.</td>
2425 <td>"httpd: caught SIGBUS, attempting to dump core in
2430 <td><code>info</code> </td>
2432 <td>Informational.</td>
2434 <td>"Server seems busy, (you may need to increase
2435 StartServers, or Min/MaxSpareServers)..."</td>
2439 <td><code>debug</code> </td>
2441 <td>Debug-level messages</td>
2443 <td>"Opening config file ..."</td>
2446 <td><code>trace1</code> </td>
2448 <td>Trace messages</td>
2450 <td>"proxy: FTP: control connection complete"</td>
2453 <td><code>trace2</code> </td>
2455 <td>Trace messages</td>
2457 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2460 <td><code>trace3</code> </td>
2462 <td>Trace messages</td>
2464 <td>"openssl: Handshake: start"</td>
2467 <td><code>trace4</code> </td>
2469 <td>Trace messages</td>
2471 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2474 <td><code>trace5</code> </td>
2476 <td>Trace messages</td>
2478 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2481 <td><code>trace6</code> </td>
2483 <td>Trace messages</td>
2485 <td>"cache lookup FAILED, forcing new map lookup"</td>
2488 <td><code>trace7</code> </td>
2490 <td>Trace messages, dumping large amounts of data</td>
2492 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2495 <td><code>trace8</code> </td>
2497 <td>Trace messages, dumping large amounts of data</td>
2499 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2503 <p>When a particular level is specified, messages from all
2504 other levels of higher significance will be reported as well.
2505 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2506 then messages with log levels of <code>notice</code> and
2507 <code>warn</code> will also be posted.</p>
2509 <p>Using a level of at least <code>crit</code> is
2518 <note><title>Note</title>
2519 <p>When logging to a regular file messages of the level
2520 <code>notice</code> cannot be suppressed and thus are always
2521 logged. However, this doesn't apply when logging is done
2522 using <code>syslog</code>.</p>
2525 <p>Specifying a level without a module name will reset the level
2526 for all modules to that level. Specifying a level with a module
2527 name will set the level for that module only. It is possible to
2528 use the module source file name, the module identifier, or the
2529 module identifier with the trailing <code>_module</code> omitted
2530 as module specification. This means the following three specifications
2534 LogLevel info ssl:warn<br />
2535 LogLevel info mod_ssl.c:warn<br />
2536 LogLevel info ssl_module:warn<br />
2539 <p>It is also possible to change the level per directory:</p>
2543 <Directory /usr/local/apache/htdocs/app><br />
2544 LogLevel debug<br />
2549 Per directory loglevel configuration only affects messages that are
2550 logged after the request has been parsed and that are associated with
2551 the request. Log messages which are associated with the connection or
2552 the server are not affected.
2555 </directivesynopsis>
2558 <name>MaxKeepAliveRequests</name>
2559 <description>Number of requests allowed on a persistent
2560 connection</description>
2561 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2562 <default>MaxKeepAliveRequests 100</default>
2563 <contextlist><context>server config</context><context>virtual host</context>
2567 <p>The <directive>MaxKeepAliveRequests</directive> directive
2568 limits the number of requests allowed per connection when
2569 <directive module="core" >KeepAlive</directive> is on. If it is
2570 set to <code>0</code>, unlimited requests will be allowed. We
2571 recommend that this setting be kept to a high value for maximum
2572 server performance.</p>
2577 MaxKeepAliveRequests 500
2580 </directivesynopsis>
2584 <description>Configures mutex mechanism and lock file directory for all
2585 or specified mutexes</description>
2586 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2587 <default>Mutex default</default>
2588 <contextlist><context>server config</context></contextlist>
2589 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2592 <p>The <directive>Mutex</directive> directive sets the mechanism,
2593 and optionally the lock file location, that httpd and modules use
2594 to serialize access to resources. Specify <code>default</code> as
2595 the first argument to change the settings for all mutexes; specify
2596 a mutex name (see table below) as the first argument to override
2597 defaults only for that mutex.</p>
2599 <p>The <directive>Mutex</directive> directive is typically used in
2600 the following exceptional situations:</p>
2603 <li>change the mutex mechanism when the default mechanism selected
2604 by <glossary>APR</glossary> has a functional or performance
2607 <li>change the directory used by file-based mutexes when the
2608 default directory does not support locking</li>
2611 <note><title>Supported modules</title>
2612 <p>This directive only configures mutexes which have been registered
2613 with the core server using the <code>ap_mutex_register()</code> API.
2614 All modules bundled with httpd support the <directive>Mutex</directive>
2615 directive, but third-party modules may not. Consult the documentation
2616 of the third-party module, which must indicate the mutex name(s) which
2617 can be configured if this directive is supported.</p>
2620 <p>The following mutex <em>mechanisms</em> are available:</p>
2622 <li><code>default | yes</code>
2623 <p>This selects the default locking implementation, as determined by
2624 <glossary>APR</glossary>. The default locking implementation can
2625 be displayed by running <program>httpd</program> with the
2626 <code>-V</code> option.</p></li>
2628 <li><code>none | no</code>
2629 <p>This effectively disables the mutex, and is only allowed for a
2630 mutex if the module indicates that it is a valid choice. Consult the
2631 module documentation for more information.</p></li>
2633 <li><code>posixsem</code>
2634 <p>This is a mutex variant based on a Posix semaphore.</p>
2636 <note type="warning"><title>Warning</title>
2637 <p>The semaphore ownership is not recovered if a thread in the process
2638 holding the mutex segfaults, resulting in a hang of the web server.</p>
2642 <li><code>sysvsem</code>
2643 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2645 <note type="warning"><title>Warning</title>
2646 <p>It is possible to "leak" SysV semaphores if processes crash
2647 before the semaphore is removed.</p>
2650 <note type="warning"><title>Security</title>
2651 <p>The semaphore API allows for a denial of service attack by any
2652 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2653 all CGIs, unless you use something like <program>suexec</program>
2654 or <code>cgiwrapper</code>).</p>
2658 <li><code>sem</code>
2659 <p>This selects the "best" available semaphore implementation, choosing
2660 between Posix and SystemV IPC semaphores, in that order.</p></li>
2662 <li><code>pthread</code>
2663 <p>This is a mutex variant based on cross-process Posix thread
2666 <note type="warning"><title>Warning</title>
2667 <p>On most systems, if a child process terminates abnormally while
2668 holding a mutex that uses this implementation, the server will deadlock
2669 and stop responding to requests. When this occurs, the server will
2670 require a manual restart to recover.</p>
2671 <p>Solaris is a notable exception as it provides a mechanism which
2672 usually allows the mutex to be recovered after a child process
2673 terminates abnormally while holding a mutex.</p>
2674 <p>If your system implements the
2675 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2676 to use the <code>pthread</code> option safely.</p>
2680 <li><code>fcntl:/path/to/mutex</code>
2681 <p>This is a mutex variant where a physical (lock-)file and the
2682 <code>fcntl()</code> function are used as the mutex.</p>
2684 <note type="warning"><title>Warning</title>
2685 <p>When multiple mutexes based on this mechanism are used within
2686 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2687 can be reported for valid mutex operations if <code>fcntl()</code>
2688 is not thread-aware, such as on Solaris.</p>
2692 <li><code>flock:/path/to/mutex</code>
2693 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2694 with the exception that the <code>flock()</code> function is used to
2695 provide file locking.</p></li>
2697 <li><code>file:/path/to/mutex</code>
2698 <p>This selects the "best" available file locking implementation,
2699 choosing between <code>fcntl</code> and <code>flock</code>, in that
2703 <p>Most mechanisms are only available on selected platforms, where the
2704 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2705 which aren't available on all platforms are <em>posixsem</em>,
2706 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2707 <em>flock</em>, and <em>file</em>.</p>
2709 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2710 the path, if provided, is a directory where the lock file will be created.
2711 The default directory is httpd's run-time file directory relative to
2712 <directive module="core">ServerRoot</directive>. Always use a local disk
2713 filesystem for <code>/path/to/mutex</code> and never a directory residing
2714 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2715 type, an optional instance string provided by the module, and unless the
2716 <code>OmitPID</code> keyword is specified, the process id of the httpd
2717 parent process will be appended to to make the file name unique, avoiding
2718 conflicts when multiple httpd instances share a lock file directory. For
2719 example, if the mutex name is <code>mpm-accept</code> and the lock file
2720 directory is <code>/var/httpd/locks</code>, the lock file name for the
2721 httpd instance with parent process id 12345 would be
2722 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2724 <note type="warning"><title>Security</title>
2725 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2726 directory such as <code>/var/tmp</code> because someone could create
2727 a denial of service attack and prevent the server from starting by
2728 creating a lockfile with the same name as the one the server will try
2732 <p>The following table documents the names of mutexes used by httpd
2733 and bundled modules.</p>
2735 <table border="1" style="zebra">
2739 <th>Protected resource</th>
2742 <td><code>mpm-accept</code></td>
2743 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2744 <td>incoming connections, to avoid the thundering herd problem;
2745 for more information, refer to the
2746 <a href="../misc/perf-tuning.html">performance tuning</a>
2750 <td><code>authdigest-client</code></td>
2751 <td><module>mod_auth_digest</module></td>
2752 <td>client list in shared memory</td>
2755 <td><code>authdigest-opaque</code></td>
2756 <td><module>mod_auth_digest</module></td>
2757 <td>counter in shared memory</td>
2760 <td><code>ldap-cache</code></td>
2761 <td><module>mod_ldap</module></td>
2762 <td>LDAP result cache</td>
2765 <td><code>rewrite-map</code></td>
2766 <td><module>mod_rewrite</module></td>
2767 <td>communication with external mapping programs, to avoid
2768 intermixed I/O from multiple requests</td>
2771 <td><code>ssl-cache</code></td>
2772 <td><module>mod_ssl</module></td>
2773 <td>SSL session cache</td>
2776 <td><code>ssl-stapling</code></td>
2777 <td><module>mod_ssl</module></td>
2778 <td>OCSP stapling response cache</td>
2781 <td><code>watchdog-callback</code></td>
2782 <td><module>mod_watchdog</module></td>
2783 <td>callback function of a particular client module</td>
2787 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2788 parent process id from the lock file name.</p>
2790 <p>In the following example, the mutex mechanism for the MPM accept
2791 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2792 with the associated lock file created in directory
2793 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2794 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2797 Mutex default sysvsem<br />
2798 Mutex mpm-accept fcntl:/var/httpd/locks
2801 </directivesynopsis>
2804 <name>NameVirtualHost</name>
2805 <description>Designates an IP address for name-virtual
2806 hosting</description>
2807 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2808 <contextlist><context>server config</context></contextlist>
2812 <p>A single <directive>NameVirtualHost</directive> directive
2813 identifies a set of identical virtual hosts on which the server will
2814 further select from on the basis of the <em>hostname</em>
2815 requested by the client. The <directive>NameVirtualHost</directive>
2816 directive is a required directive if you want to configure
2817 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2819 <p>This directive, and the corresponding <directive >VirtualHost</directive>,
2820 <em>must</em> be qualified with a port number if the server supports both HTTP
2821 and HTTPS connections.</p>
2823 <p>Although <var>addr</var> can be a hostname, it is recommended
2824 that you always use an IP address or a wildcard. A wildcard
2825 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2826 as their argument.</p>
2828 <p>In cases where a firewall or other proxy receives the requests and
2829 forwards them on a different IP address to the server, you must specify the
2830 IP address of the physical interface on the machine which will be
2831 servicing the requests. </p>
2833 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2834 will only select among the first two virtual hosts. Requests received on
2835 port 80 on any other interface will only select among the third and fourth
2836 virtual hosts. In the common case where the interface isn't important
2837 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2841 NameVirtualHost 192.0.2.1:80<br />
2842 NameVirtualHost *:80<br /><br />
2844 <VirtualHost 192.0.2.1:80><br />
2845 ServerName namebased-a.example.com<br />
2846 </VirtualHost><br />
2848 <VirtualHost 192.0.2.1:80><br />
2849 Servername namebased-b.example.com<br />
2850 </VirtualHost><br />
2852 <VirtualHost *:80><br />
2853 ServerName namebased-c.example.com <br />
2854 </VirtualHost><br />
2856 <VirtualHost *:80><br />
2857 ServerName namebased-d.example.com <br />
2858 </VirtualHost><br />
2863 <p>If no matching virtual host is found, then the first listed
2864 virtual host that matches the IP address and port will be used.</p>
2867 <p>IPv6 addresses must be enclosed in square brackets, as shown
2868 in the following example:</p>
2871 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2874 <note><title>Argument to <directive type="section">VirtualHost</directive>
2876 <p>Note that the argument to the <directive
2877 type="section">VirtualHost</directive> directive must
2878 exactly match the argument to the <directive
2879 >NameVirtualHost</directive> directive.</p>
2882 NameVirtualHost 192.0.2.2:80<br />
2883 <VirtualHost 192.0.2.2:80><br />
2885 </VirtualHost><br />
2890 <seealso><a href="../vhosts/">Virtual Hosts
2891 documentation</a></seealso>
2893 </directivesynopsis>
2896 <name>Options</name>
2897 <description>Configures what features are available in a particular
2898 directory</description>
2900 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2901 <default>Options All</default>
2902 <contextlist><context>server config</context><context>virtual host</context>
2903 <context>directory</context><context>.htaccess</context>
2905 <override>Options</override>
2908 <p>The <directive>Options</directive> directive controls which
2909 server features are available in a particular directory.</p>
2911 <p><var>option</var> can be set to <code>None</code>, in which
2912 case none of the extra features are enabled, or one or more of
2916 <dt><code>All</code></dt>
2918 <dd>All options except for <code>MultiViews</code>. This is the default
2921 <dt><code>ExecCGI</code></dt>
2924 Execution of CGI scripts using <module>mod_cgi</module>
2927 <dt><code>FollowSymLinks</code></dt>
2931 The server will follow symbolic links in this directory.
2933 <p>Even though the server follows the symlink it does <em>not</em>
2934 change the pathname used to match against <directive type="section"
2935 module="core">Directory</directive> sections.</p>
2936 <p>Note also, that this option <strong>gets ignored</strong> if set
2937 inside a <directive type="section" module="core">Location</directive>
2939 <p>Omitting this option should not be considered a security restriction,
2940 since symlink testing is subject to race conditions that make it
2944 <dt><code>Includes</code></dt>
2947 Server-side includes provided by <module>mod_include</module>
2950 <dt><code>IncludesNOEXEC</code></dt>
2954 Server-side includes are permitted, but the <code>#exec
2955 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2956 possible to <code>#include virtual</code> CGI scripts from
2957 <directive module="mod_alias">ScriptAlias</directive>ed
2960 <dt><code>Indexes</code></dt>
2963 If a URL which maps to a directory is requested, and there
2964 is no <directive module="mod_dir">DirectoryIndex</directive>
2965 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2966 <module>mod_autoindex</module> will return a formatted listing
2967 of the directory.</dd>
2969 <dt><code>MultiViews</code></dt>
2972 <a href="../content-negotiation.html">Content negotiated</a>
2973 "MultiViews" are allowed using
2974 <module>mod_negotiation</module>.
2975 <note><title>Note</title> <p>This option gets ignored if set
2976 anywhere other than <directive module="core" type="section"
2977 >Directory</directive>, as <module>mod_negotiation</module>
2978 needs real resources to compare against and evaluate from.</p></note>
2981 <dt><code>SymLinksIfOwnerMatch</code></dt>
2983 <dd>The server will only follow symbolic links for which the
2984 target file or directory is owned by the same user id as the
2987 <note><title>Note</title> <p>This option gets ignored if
2988 set inside a <directive module="core"
2989 type="section">Location</directive> section.</p>
2990 <p>This option should not be considered a security restriction,
2991 since symlink testing is subject to race conditions that make it
2992 circumventable.</p></note>
2996 <p>Normally, if multiple <directive>Options</directive> could
2997 apply to a directory, then the most specific one is used and
2998 others are ignored; the options are not merged. (See <a
2999 href="../sections.html#mergin">how sections are merged</a>.)
3000 However if <em>all</em> the options on the
3001 <directive>Options</directive> directive are preceded by a
3002 <code>+</code> or <code>-</code> symbol, the options are
3003 merged. Any options preceded by a <code>+</code> are added to the
3004 options currently in force, and any options preceded by a
3005 <code>-</code> are removed from the options currently in
3008 <note type="warning"><title>Warning</title>
3009 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3010 <code>-</code> with those without is not valid syntax, and is likely
3011 to cause unexpected results.</p>
3014 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3017 <Directory /web/docs><br />
3019 Options Indexes FollowSymLinks<br />
3021 </Directory><br />
3023 <Directory /web/docs/spec><br />
3025 Options Includes<br />
3030 <p>then only <code>Includes</code> will be set for the
3031 <code>/web/docs/spec</code> directory. However if the second
3032 <directive>Options</directive> directive uses the <code>+</code> and
3033 <code>-</code> symbols:</p>
3036 <Directory /web/docs><br />
3038 Options Indexes FollowSymLinks<br />
3040 </Directory><br />
3042 <Directory /web/docs/spec><br />
3044 Options +Includes -Indexes<br />
3049 <p>then the options <code>FollowSymLinks</code> and
3050 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3053 <note><title>Note</title>
3054 <p>Using <code>-IncludesNOEXEC</code> or
3055 <code>-Includes</code> disables server-side includes completely
3056 regardless of the previous setting.</p>
3059 <p>The default in the absence of any other settings is
3060 <code>All</code>.</p>
3062 </directivesynopsis>
3065 <name>Protocol</name>
3066 <description>Protocol for a listening socket</description>
3067 <syntax>Protocol <var>protocol</var></syntax>
3068 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3069 <compatibility>Available in Apache 2.1.5 and later.
3070 On Windows from Apache 2.3.3 and later.</compatibility>
3073 <p>This directive specifies the protocol used for a specific listening socket.
3074 The protocol is used to determine which module should handle a request, and
3075 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3078 <p>You only need to set the protocol if you are running on non-standard ports, otherwise <code>http</code> is assumed for port 80 and <code>https</code> for port 443.</p>
3080 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3086 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3088 <seealso><directive>AcceptFilter</directive></seealso>
3089 <seealso><directive module="mpm_common">Listen</directive></seealso>
3090 </directivesynopsis>
3094 <name>RLimitCPU</name>
3095 <description>Limits the CPU consumption of processes launched
3096 by Apache httpd children</description>
3097 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3098 <default>Unset; uses operating system defaults</default>
3099 <contextlist><context>server config</context><context>virtual host</context>
3100 <context>directory</context><context>.htaccess</context></contextlist>
3101 <override>All</override>
3104 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3105 resource limit for all processes and the second parameter sets
3106 the maximum resource limit. Either parameter can be a number,
3107 or <code>max</code> to indicate to the server that the limit should
3108 be set to the maximum allowed by the operating system
3109 configuration. Raising the maximum resource limit requires that
3110 the server is running as <code>root</code>, or in the initial startup
3113 <p>This applies to processes forked off from Apache httpd children
3114 servicing requests, not the Apache httpd children themselves. This
3115 includes CGI scripts and SSI exec commands, but not any
3116 processes forked off from the Apache httpd parent such as piped
3119 <p>CPU resource limits are expressed in seconds per
3122 <seealso><directive module="core">RLimitMEM</directive></seealso>
3123 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3124 </directivesynopsis>
3127 <name>RLimitMEM</name>
3128 <description>Limits the memory consumption of processes launched
3129 by Apache httpd children</description>
3130 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3131 <default>Unset; uses operating system defaults</default>
3132 <contextlist><context>server config</context><context>virtual host</context>
3133 <context>directory</context><context>.htaccess</context></contextlist>
3134 <override>All</override>
3137 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3138 resource limit for all processes and the second parameter sets
3139 the maximum resource limit. Either parameter can be a number,
3140 or <code>max</code> to indicate to the server that the limit should
3141 be set to the maximum allowed by the operating system
3142 configuration. Raising the maximum resource limit requires that
3143 the server is running as <code>root</code>, or in the initial startup
3146 <p>This applies to processes forked off from Apache httpd children
3147 servicing requests, not the Apache httpd children themselves. This
3148 includes CGI scripts and SSI exec commands, but not any
3149 processes forked off from the Apache httpd parent such as piped
3152 <p>Memory resource limits are expressed in bytes per
3155 <seealso><directive module="core">RLimitCPU</directive></seealso>
3156 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3157 </directivesynopsis>
3160 <name>RLimitNPROC</name>
3161 <description>Limits the number of processes that can be launched by
3162 processes launched by Apache httpd children</description>
3163 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3164 <default>Unset; uses operating system defaults</default>
3165 <contextlist><context>server config</context><context>virtual host</context>
3166 <context>directory</context><context>.htaccess</context></contextlist>
3167 <override>All</override>
3170 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3171 resource limit for all processes and the second parameter sets
3172 the maximum resource limit. Either parameter can be a number,
3173 or <code>max</code> to indicate to the server that the limit
3174 should be set to the maximum allowed by the operating system
3175 configuration. Raising the maximum resource limit requires that
3176 the server is running as <code>root</code>, or in the initial startup
3179 <p>This applies to processes forked off from Apache httpd children
3180 servicing requests, not the Apache httpd children themselves. This
3181 includes CGI scripts and SSI exec commands, but not any
3182 processes forked off from the Apache httpd parent such as piped
3185 <p>Process limits control the number of processes per user.</p>
3187 <note><title>Note</title>
3188 <p>If CGI processes are <strong>not</strong> running
3189 under user ids other than the web server user id, this directive
3190 will limit the number of processes that the server itself can
3191 create. Evidence of this situation will be indicated by
3192 <strong><code>cannot fork</code></strong> messages in the
3193 <code>error_log</code>.</p>
3196 <seealso><directive module="core">RLimitMEM</directive></seealso>
3197 <seealso><directive module="core">RLimitCPU</directive></seealso>
3198 </directivesynopsis>
3201 <name>ScriptInterpreterSource</name>
3202 <description>Technique for locating the interpreter for CGI
3203 scripts</description>
3204 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3205 <default>ScriptInterpreterSource Script</default>
3206 <contextlist><context>server config</context><context>virtual host</context>
3207 <context>directory</context><context>.htaccess</context></contextlist>
3208 <override>FileInfo</override>
3209 <compatibility>Win32 only;
3210 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3211 later</compatibility>
3214 <p>This directive is used to control how Apache httpd finds the
3215 interpreter used to run CGI scripts. The default setting is
3216 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3217 by the shebang line (first line, starting with <code>#!</code>) in the
3218 script. On Win32 systems this line usually looks like:</p>
3221 #!C:/Perl/bin/perl.exe
3224 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3230 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3231 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3232 searched using the script file extension (e.g., <code>.pl</code>) as a
3233 search key. The command defined by the registry subkey
3234 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3235 <code>Shell\Open\Command</code> is used to open the script file. If the
3236 registry keys cannot be found, Apache httpd falls back to the behavior of the
3237 <code>Script</code> option.</p>
3239 <note type="warning"><title>Security</title>
3240 <p>Be careful when using <code>ScriptInterpreterSource
3241 Registry</code> with <directive
3242 module="mod_alias">ScriptAlias</directive>'ed directories, because
3243 Apache httpd will try to execute <strong>every</strong> file within this
3244 directory. The <code>Registry</code> setting may cause undesired
3245 program calls on files which are typically not executed. For
3246 example, the default open command on <code>.htm</code> files on
3247 most Windows systems will execute Microsoft Internet Explorer, so
3248 any HTTP request for an <code>.htm</code> file existing within the
3249 script directory would start the browser in the background on the
3250 server. This is a good way to crash your system within a minute or
3254 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3255 2.0 does the same thing as <code>Registry</code> but uses only the
3256 subkey <code>Shell\ExecCGI\Command</code>. The
3257 <code>ExecCGI</code> key is not a common one. It must be
3258 configured manually in the windows registry and hence prevents
3259 accidental program calls on your system.</p>
3261 </directivesynopsis>
3264 <name>SeeRequestTail</name>
3265 <description>Determine if mod_status displays the first 63 characters
3266 of a request or the last 63, assuming the request itself is greater than
3267 63 chars.</description>
3268 <syntax>SeeRequestTail On|Off</syntax>
3269 <default>SeeRequestTail Off</default>
3270 <contextlist><context>server config</context></contextlist>
3271 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3274 <p>mod_status with <code>ExtendedStatus On</code>
3275 displays the actual request being handled.
3276 For historical purposes, only 63 characters of the request
3277 are actually stored for display purposes. This directive
3278 controls whether the 1st 63 characters are stored (the previous
3279 behavior and the default) or if the last 63 characters are. This
3280 is only applicable, of course, if the length of the request is
3281 64 characters or greater.</p>
3283 <p>If Apache httpd is handling <code
3284 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3285 > mod_status displays as follows:
3290 <th>Off (default)</th>
3291 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3295 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3300 </directivesynopsis>
3303 <name>ServerAdmin</name>
3304 <description>Email address that the server includes in error
3305 messages sent to the client</description>
3306 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3307 <contextlist><context>server config</context><context>virtual host</context>
3311 <p>The <directive>ServerAdmin</directive> sets the contact address
3312 that the server includes in any error messages it returns to the
3313 client. If the <code>httpd</code> doesn't recognize the supplied argument
3315 assumes, that it's an <var>email-address</var> and prepends it with
3316 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3317 actually use an email address, since there are a lot of CGI scripts that
3318 make that assumption. If you want to use an URL, it should point to another
3319 server under your control. Otherwise users may not be able to contact you in
3322 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3325 ServerAdmin www-admin@foo.example.com
3327 <p>as users do not always mention that they are talking about the
3330 </directivesynopsis>
3333 <name>ServerAlias</name>
3334 <description>Alternate names for a host used when matching requests
3335 to name-virtual hosts</description>
3336 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3337 <contextlist><context>virtual host</context></contextlist>
3340 <p>The <directive>ServerAlias</directive> directive sets the
3341 alternate names for a host, for use with <a
3342 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3343 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3346 <VirtualHost *:80><br />
3347 ServerName server.domain.com<br />
3348 ServerAlias server server2.domain.com server2<br />
3349 ServerAlias *.example.com<br />
3350 UseCanonicalName Off<br />
3352 </VirtualHost>
3355 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3356 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3357 </directivesynopsis>
3360 <name>ServerName</name>
3361 <description>Hostname and port that the server uses to identify
3362 itself</description>
3363 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3364 <contextlist><context>server config</context><context>virtual host</context>
3368 <p>The <directive>ServerName</directive> directive sets the
3369 request scheme, hostname and
3370 port that the server uses to identify itself. This is used when
3371 creating redirection URLs.</p>
3373 <p>Additionally, <directive>ServerName</directive> is used (possibly
3374 in conjunction with <directive>ServerAlias</directive>) to uniquely
3375 identify a virtual host, when using <a
3376 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3378 <p>For example, if the name of the
3379 machine hosting the web server is <code>simple.example.com</code>,
3380 but the machine also has the DNS alias <code>www.example.com</code>
3381 and you wish the web server to be so identified, the following
3382 directive should be used:</p>
3385 ServerName www.example.com:80
3388 <p>The <directive>ServerName</directive> directive
3389 may appear anywhere within the definition of a server. However,
3390 each appearance overrides the previous appearance (within that
3393 <p>If no <directive>ServerName</directive> is specified, then the
3394 server attempts to deduce the hostname by performing a reverse
3395 lookup on the IP address. If no port is specified in the
3396 <directive>ServerName</directive>, then the server will use the
3397 port from the incoming request. For optimal reliability and
3398 predictability, you should specify an explicit hostname and port
3399 using the <directive>ServerName</directive> directive.</p>
3401 <p>If you are using <a
3402 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3403 the <directive>ServerName</directive> inside a
3404 <directive type="section" module="core">VirtualHost</directive>
3405 section specifies what hostname must appear in the request's
3406 <code>Host:</code> header to match this virtual host.</p>
3408 <p>Sometimes, the server runs behind a device that processes SSL,
3409 such as a reverse proxy, load balancer or SSL offload
3410 appliance. When this is the case, specify the
3411 <code>https://</code> scheme and the port number to which the
3412 clients connect in the <directive>ServerName</directive> directive
3413 to make sure that the server generates the correct
3414 self-referential URLs.
3417 <p>See the description of the
3418 <directive module="core">UseCanonicalName</directive> and
3419 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3420 settings which determine whether self-referential URLs (e.g., by the
3421 <module>mod_dir</module> module) will refer to the
3422 specified port, or to the port number given in the client's request.
3425 <note type="warning">
3426 <p>Failure to set <directive>ServerName</directive> to a name that
3427 your server can resolve to an IP address will result in a startup
3428 warning. <code>httpd</code> will then use whatever hostname it can
3429 determine, using the system's <code>hostname</code> command. This
3430 will almost never be the hostname you actually want.</p>
3432 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3438 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3439 Apache HTTP Server</a></seealso>
3440 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3441 documentation</a></seealso>
3442 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3443 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3444 <seealso><directive module="core">NameVirtualHost</directive></seealso>
3445 <seealso><directive module="core">ServerAlias</directive></seealso>
3446 </directivesynopsis>
3449 <name>ServerPath</name>
3450 <description>Legacy URL pathname for a name-based virtual host that
3451 is accessed by an incompatible browser</description>
3452 <syntax>ServerPath <var>URL-path</var></syntax>
3453 <contextlist><context>virtual host</context></contextlist>
3456 <p>The <directive>ServerPath</directive> directive sets the legacy
3457 URL pathname for a host, for use with <a
3458 href="../vhosts/">name-based virtual hosts</a>.</p>
3460 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3461 </directivesynopsis>
3464 <name>ServerRoot</name>
3465 <description>Base directory for the server installation</description>
3466 <syntax>ServerRoot <var>directory-path</var></syntax>
3467 <default>ServerRoot /usr/local/apache</default>
3468 <contextlist><context>server config</context></contextlist>
3471 <p>The <directive>ServerRoot</directive> directive sets the
3472 directory in which the server lives. Typically it will contain the
3473 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3474 paths in other configuration directives (such as <directive
3475 module="core">Include</directive> or <directive
3476 module="mod_so">LoadModule</directive>, for example) are taken as
3477 relative to this directory.</p>
3479 <example><title>Example</title>
3480 ServerRoot /home/httpd
3484 <seealso><a href="../invoking.html">the <code>-d</code>
3485 option to <code>httpd</code></a></seealso>
3486 <seealso><a href="../misc/security_tips.html#serverroot">the
3487 security tips</a> for information on how to properly set
3488 permissions on the <directive>ServerRoot</directive></seealso>
3489 </directivesynopsis>
3492 <name>ServerSignature</name>
3493 <description>Configures the footer on server-generated documents</description>
3494 <syntax>ServerSignature On|Off|EMail</syntax>
3495 <default>ServerSignature Off</default>
3496 <contextlist><context>server config</context><context>virtual host</context>
3497 <context>directory</context><context>.htaccess</context>
3499 <override>All</override>
3502 <p>The <directive>ServerSignature</directive> directive allows the
3503 configuration of a trailing footer line under server-generated
3504 documents (error messages, <module>mod_proxy</module> ftp directory
3505 listings, <module>mod_info</module> output, ...). The reason why you
3506 would want to enable such a footer line is that in a chain of proxies,
3507 the user often has no possibility to tell which of the chained servers
3508 actually produced a returned error message.</p>
3510 <p>The <code>Off</code>
3511 setting, which is the default, suppresses the footer line (and is
3512 therefore compatible with the behavior of Apache-1.2 and
3513 below). The <code>On</code> setting simply adds a line with the
3514 server version number and <directive
3515 module="core">ServerName</directive> of the serving virtual host,
3516 and the <code>EMail</code> setting additionally creates a
3517 "mailto:" reference to the <directive
3518 module="core">ServerAdmin</directive> of the referenced
3521 <p>After version 2.0.44, the details of the server version number
3522 presented are controlled by the <directive
3523 module="core">ServerTokens</directive> directive.</p>
3525 <seealso><directive module="core">ServerTokens</directive></seealso>
3526 </directivesynopsis>
3529 <name>ServerTokens</name>
3530 <description>Configures the <code>Server</code> HTTP response
3531 header</description>
3532 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3533 <default>ServerTokens Full</default>
3534 <contextlist><context>server config</context></contextlist>
3537 <p>This directive controls whether <code>Server</code> response
3538 header field which is sent back to clients includes a
3539 description of the generic OS-type of the server as well as
3540 information about compiled-in modules.</p>
3543 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3545 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3546 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3548 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3550 <dd>Server sends (<em>e.g.</em>): <code>Server:
3553 <dt><code>ServerTokens Major</code></dt>
3555 <dd>Server sends (<em>e.g.</em>): <code>Server:
3556 Apache/2</code></dd>
3558 <dt><code>ServerTokens Minor</code></dt>
3560 <dd>Server sends (<em>e.g.</em>): <code>Server:
3561 Apache/2.4</code></dd>
3563 <dt><code>ServerTokens Min[imal]</code></dt>
3565 <dd>Server sends (<em>e.g.</em>): <code>Server:
3566 Apache/2.4.1</code></dd>
3568 <dt><code>ServerTokens OS</code></dt>
3570 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3575 <p>This setting applies to the entire server, and cannot be
3576 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3578 <p>After version 2.0.44, this directive also controls the
3579 information presented by the <directive
3580 module="core">ServerSignature</directive> directive.</p>
3582 <note>Setting <directive>ServerTokens</directive> to less than
3583 <code>minimal</code> is not recommended because it makes it more
3584 difficult to debug interoperational problems. Also note that
3585 disabling the Server: header does nothing at all to make your
3586 server more secure; the idea of "security through obscurity"
3587 is a myth and leads to a false sense of safety.</note>
3590 <seealso><directive module="core">ServerSignature</directive></seealso>
3591 </directivesynopsis>
3594 <name>SetHandler</name>
3595 <description>Forces all matching files to be processed by a
3596 handler</description>
3597 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3598 <contextlist><context>server config</context><context>virtual host</context>
3599 <context>directory</context><context>.htaccess</context>
3601 <override>FileInfo</override>
3602 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3605 <p>When placed into an <code>.htaccess</code> file or a
3606 <directive type="section" module="core">Directory</directive> or
3607 <directive type="section" module="core">Location</directive>
3608 section, this directive forces all matching files to be parsed
3609 through the <a href="../handler.html">handler</a> given by
3610 <var>handler-name</var>. For example, if you had a directory you
3611 wanted to be parsed entirely as imagemap rule files, regardless
3612 of extension, you might put the following into an
3613 <code>.htaccess</code> file in that directory:</p>
3616 SetHandler imap-file
3619 <p>Another example: if you wanted to have the server display a
3620 status report whenever a URL of
3621 <code>http://servername/status</code> was called, you might put
3622 the following into <code>httpd.conf</code>:</p>
3625 <Location /status><br />
3627 SetHandler server-status<br />
3632 <p>You can override an earlier defined <directive>SetHandler</directive>
3633 directive by using the value <code>None</code>.</p>
3634 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3635 normal behaviour such as handling of URLs ending in a slash (/) as
3636 directories or index files is suppressed.</p>
3639 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3641 </directivesynopsis>
3644 <name>SetInputFilter</name>
3645 <description>Sets the filters that will process client requests and POST
3647 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3648 <contextlist><context>server config</context><context>virtual host</context>
3649 <context>directory</context><context>.htaccess</context>
3651 <override>FileInfo</override>
3654 <p>The <directive>SetInputFilter</directive> directive sets the
3655 filter or filters which will process client requests and POST
3656 input when they are received by the server. This is in addition to
3657 any filters defined elsewhere, including the
3658 <directive module="mod_mime">AddInputFilter</directive>
3661 <p>If more than one filter is specified, they must be separated
3662 by semicolons in the order in which they should process the
3665 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3666 </directivesynopsis>
3669 <name>SetOutputFilter</name>
3670 <description>Sets the filters that will process responses from the
3671 server</description>
3672 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3673 <contextlist><context>server config</context><context>virtual host</context>
3674 <context>directory</context><context>.htaccess</context>
3676 <override>FileInfo</override>
3679 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3680 which will process responses from the server before they are
3681 sent to the client. This is in addition to any filters defined
3682 elsewhere, including the
3683 <directive module="mod_mime">AddOutputFilter</directive>
3686 <p>For example, the following configuration will process all files
3687 in the <code>/www/data/</code> directory for server-side
3691 <Directory /www/data/><br />
3693 SetOutputFilter INCLUDES<br />
3698 <p>If more than one filter is specified, they must be separated
3699 by semicolons in the order in which they should process the
3702 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3703 </directivesynopsis>
3706 <name>TimeOut</name>
3707 <description>Amount of time the server will wait for
3708 certain events before failing a request</description>
3709 <syntax>TimeOut <var>seconds</var></syntax>
3710 <default>TimeOut 300</default>
3711 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3714 <p>The <directive>TimeOut</directive> directive defines the length
3715 of time Apache httpd will wait for I/O in various circumstances:</p>
3718 <li>When reading data from the client, the length of time to
3719 wait for a TCP packet to arrive if the read buffer is
3722 <li>When writing data to the client, the length of time to wait
3723 for an acknowledgement of a packet if the send buffer is
3726 <li>In <module>mod_cgi</module>, the length of time to wait for
3727 output from a CGI script.</li>
3729 <li>In <module>mod_ext_filter</module>, the length of time to
3730 wait for output from a filtering process.</li>
3732 <li>In <module>mod_proxy</module>, the default timeout value if
3733 <directive module="mod_proxy">ProxyTimeout</directive> is not
3738 </directivesynopsis>
3741 <name>TraceEnable</name>
3742 <description>Determines the behaviour on <code>TRACE</code>
3743 requests</description>
3744 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3745 <default>TraceEnable on</default>
3746 <contextlist><context>server config</context></contextlist>
3747 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3750 <p>This directive overrides the behavior of <code>TRACE</code> for both
3751 the core server and <module>mod_proxy</module>. The default
3752 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3753 RFC 2616, which disallows any request body to accompany the request.
3754 <code>TraceEnable off</code> causes the core server and
3755 <module>mod_proxy</module> to return a <code>405</code> (Method not
3756 allowed) error to the client.</p>
3758 <p>Finally, for testing and diagnostic purposes only, request
3759 bodies may be allowed using the non-compliant <code>TraceEnable
3760 extended</code> directive. The core (as an origin server) will
3761 restrict the request body to 64k (plus 8k for chunk headers if
3762 <code>Transfer-Encoding: chunked</code> is used). The core will
3763 reflect the full headers and all chunk headers with the response
3764 body. As a proxy server, the request body is not restricted to 64k.</p>
3766 </directivesynopsis>
3769 <name>UnDefine</name>
3770 <description>Undefine the existence of a variable</description>
3771 <syntax>UnDefine <var>parameter-name</var></syntax>
3772 <contextlist><context>server config</context></contextlist>
3775 <p>Undoes the effect of a <directive module="core">Define</directive> or
3776 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3777 <p>This directive can be used to toggle the use of <directive module="core"
3778 type="section">IfDefine</directive> sections without needing to alter
3779 <code>-D</code> arguments in any startup scripts.</p>
3781 </directivesynopsis>
3784 <name>UseCanonicalName</name>
3785 <description>Configures how the server determines its own name and
3787 <syntax>UseCanonicalName On|Off|DNS</syntax>
3788 <default>UseCanonicalName Off</default>
3789 <contextlist><context>server config</context><context>virtual host</context>
3790 <context>directory</context></contextlist>
3793 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3794 URL -- that is, a URL that refers back to the same server. With
3795 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3796 specified in the <directive module="core">ServerName</directive>
3797 directive to construct the canonical name for the server. This name
3798 is used in all self-referential URLs, and for the values of
3799 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3801 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3802 self-referential URLs using the hostname and port supplied by
3803 the client if any are supplied (otherwise it will use the
3804 canonical name, as defined above). These values are the same
3805 that are used to implement <a
3806 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3807 and are available with the same clients. The CGI variables
3808 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3809 constructed from the client supplied values as well.</p>
3811 <p>An example where this may be useful is on an intranet server
3812 where you have users connecting to the machine using short
3813 names such as <code>www</code>. You'll notice that if the users
3814 type a shortname, and a URL which is a directory, such as
3815 <code>http://www/splat</code>, <em>without the trailing
3816 slash</em> then Apache httpd will redirect them to
3817 <code>http://www.domain.com/splat/</code>. If you have
3818 authentication enabled, this will cause the user to have to
3819 authenticate twice (once for <code>www</code> and once again
3820 for <code>www.domain.com</code> -- see <a
3821 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3822 FAQ on this subject for more information</a>). But if
3823 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3824 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3826 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3827 which is intended for use with mass IP-based virtual hosting to
3828 support ancient clients that do not provide a
3829 <code>Host:</code> header. With this option Apache httpd does a
3830 reverse DNS lookup on the server IP address that the client
3831 connected to in order to work out self-referential URLs.</p>
3833 <note type="warning"><title>Warning</title>
3834 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3835 they may be broken by this option. The client is essentially free
3836 to give whatever value they want as a hostname. But if the CGI is
3837 only using <code>SERVER_NAME</code> to construct self-referential URLs
3838 then it should be just fine.</p>
3841 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3842 <seealso><directive module="core">ServerName</directive></seealso>
3843 <seealso><directive module="mpm_common">Listen</directive></seealso>
3844 </directivesynopsis>
3847 <name>UseCanonicalPhysicalPort</name>
3848 <description>Configures how the server determines its own name and
3850 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3851 <default>UseCanonicalPhysicalPort Off</default>
3852 <contextlist><context>server config</context><context>virtual host</context>
3853 <context>directory</context></contextlist>
3856 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3857 URL -- that is, a URL that refers back to the same server. With
3858 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3859 constructing the canonical port for the server to honor
3860 the <directive module="core">UseCanonicalName</directive> directive,
3861 provide the actual physical port number being used by this request
3862 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3863 Apache httpd will not ever use the actual physical port number, instead
3864 relying on all configured information to construct a valid port number.</p>
3866 <note><title>Note</title>
3867 <p>The ordering of when the physical port is used is as follows:<br /><br />
3868 <code>UseCanonicalName On</code></p>
3870 <li>Port provided in <code>Servername</code></li>
3871 <li>Physical port</li>
3872 <li>Default port</li>
3874 <code>UseCanonicalName Off | DNS</code>
3876 <li>Parsed port from <code>Host:</code> header</li>
3877 <li>Physical port</li>
3878 <li>Port provided in <code>Servername</code></li>
3879 <li>Default port</li>
3882 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3883 physical ports are removed from the ordering.</p>
3887 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3888 <seealso><directive module="core">ServerName</directive></seealso>
3889 <seealso><directive module="mpm_common">Listen</directive></seealso>
3890 </directivesynopsis>
3892 <directivesynopsis type="section">
3893 <name>VirtualHost</name>
3894 <description>Contains directives that apply only to a specific
3895 hostname or IP address</description>
3896 <syntax><VirtualHost
3897 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3898 ...> ... </VirtualHost></syntax>
3899 <contextlist><context>server config</context></contextlist>
3902 <p><directive type="section">VirtualHost</directive> and
3903 <code></VirtualHost></code> are used to enclose a group of
3904 directives that will apply only to a particular virtual host. Any
3905 directive that is allowed in a virtual host context may be
3906 used. When the server receives a request for a document on a
3907 particular virtual host, it uses the configuration directives
3908 enclosed in the <directive type="section">VirtualHost</directive>
3909 section. <var>Addr</var> can be:</p>
3912 <li>The IP address of the virtual host;</li>
3914 <li>A fully qualified domain name for the IP address of the
3915 virtual host (not recommended);</li>
3917 <li>The character <code>*</code>, which is used only in combination with
3918 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3920 <li>The string <code>_default_</code>, which is used only
3921 with IP virtual hosting to catch unmatched IP addresses.</li>
3924 <example><title>Example</title>
3925 <VirtualHost 10.1.2.3><br />
3927 ServerAdmin webmaster@host.example.com<br />
3928 DocumentRoot /www/docs/host.example.com<br />
3929 ServerName host.example.com<br />
3930 ErrorLog logs/host.example.com-error_log<br />
3931 TransferLog logs/host.example.com-access_log<br />
3933 </VirtualHost>
3937 <p>IPv6 addresses must be specified in square brackets because
3938 the optional port number could not be determined otherwise. An
3939 IPv6 example is shown below:</p>
3942 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3944 ServerAdmin webmaster@host.example.com<br />
3945 DocumentRoot /www/docs/host.example.com<br />
3946 ServerName host.example.com<br />
3947 ErrorLog logs/host.example.com-error_log<br />
3948 TransferLog logs/host.example.com-access_log<br />
3950 </VirtualHost>
3953 <p>Each Virtual Host must correspond to a different IP address,
3954 different port number or a different host name for the server,
3955 in the former case the server machine must be configured to
3956 accept IP packets for multiple addresses. (If the machine does
3957 not have multiple network interfaces, then this can be
3958 accomplished with the <code>ifconfig alias</code> command -- if
3959 your OS supports it).</p>
3961 <note><title>Note</title>
3962 <p>The use of <directive type="section">VirtualHost</directive> does
3963 <strong>not</strong> affect what addresses Apache httpd listens on. You
3964 may need to ensure that Apache httpd is listening on the correct addresses
3965 using <directive module="mpm_common">Listen</directive>.</p>
3968 <p>When using IP-based virtual hosting, the special name
3969 <code>_default_</code> can be specified in
3970 which case this virtual host will match any IP address that is
3971 not explicitly listed in another virtual host. In the absence
3972 of any <code>_default_</code> virtual host the "main" server config,
3973 consisting of all those definitions outside any VirtualHost
3974 section, is used when no IP-match occurs.</p>
3976 <p>You can specify a <code>:port</code> to change the port that is
3977 matched. If unspecified then it defaults to the same port as the
3978 most recent <directive module="mpm_common">Listen</directive>
3979 statement of the main server. You may also specify <code>:*</code>
3980 to match all ports on that address. (This is recommended when used
3981 with <code>_default_</code>.)</p>
3983 <p>A <directive module="core">ServerName</directive> should be
3984 specified inside each <directive
3985 type="section">VirtualHost</directive> block. If it is absent, the
3986 <directive module="core">ServerName</directive> from the "main"
3987 server configuration will be inherited.</p>
3989 <p>If no matching virtual host is found, then the first listed
3990 virtual host that matches the IP address will be used. As a
3991 consequence, the first listed virtual host is the default virtual
3994 <note type="warning"><title>Security</title>
3995 <p>See the <a href="../misc/security_tips.html">security tips</a>
3996 document for details on why your security could be compromised if the
3997 directory where log files are stored is writable by anyone other
3998 than the user that starts the server.</p>
4001 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4002 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4003 Apache HTTP Server</a></seealso>
4004 <seealso><a href="../bind.html">Setting
4005 which addresses and ports Apache HTTP Server uses</a></seealso>
4006 <seealso><a href="../sections.html">How <Directory>, <Location>
4007 and <Files> sections work</a> for an explanation of how these
4008 different sections are combined when a request is received</seealso>
4009 </directivesynopsis>