2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Core Apache HTTP Server features that are always
27 available</description>
31 <name>AcceptFilter</name>
32 <description>Configures optimizations for a Protocol's Listener Sockets</description>
33 <syntax>AcceptFilter <var>protocol</var> <var>accept_filter</var></syntax>
34 <contextlist><context>server config</context></contextlist>
35 <compatibility>Available in Apache httpd 2.1.5 and later.
36 On Windows from Apache httpd 2.3.3 and later.</compatibility>
39 <p>This directive enables operating system specific optimizations for a
40 listening socket by the <directive>Protocol</directive>type.
41 The basic premise is for the kernel to not send a socket to the server
42 process until either data is received or an entire HTTP Request is buffered.
43 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
44 FreeBSD's Accept Filters</a>, Linux's more primitive
45 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
46 are currently supported.</p>
48 <p>Using <code>none</code> for an argument will disable any accept filters
49 for that protocol. This is useful for protocols that require a server
50 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
51 <example>AcceptFilter nntp none</example>
53 <p>The default protocol names are <code>https</code> for port 443
54 and <code>http</code> for all other ports. To specify another protocol
55 is being used with a listening port, add the <var>protocol</var>
56 argument to the <directive module="mpm_common">Listen</directive>
59 <p>The default values on FreeBSD are:</p>
61 AcceptFilter http httpready <br/>
62 AcceptFilter https dataready
65 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
66 the kernel level. Once an entire request is received, the kernel then
67 sends it to the server. See the
68 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
69 accf_http(9)</a> man page for more details. Since HTTPS requests are
70 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
71 accf_data(9)</a> filter is used.</p>
73 <p>The default values on Linux are:</p>
75 AcceptFilter http data <br/>
76 AcceptFilter https data
79 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
80 requests. Any value besides <code>none</code> will enable
81 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
83 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
84 tcp(7)</a> man page.</p>
86 <p>The default values on Windows are:</p>
88 AcceptFilter http data <br/>
89 AcceptFilter https data
92 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
93 API, and does not support http protocol buffering. There are two values
94 which utilize the Windows AcceptEx() API and will recycle network
95 sockets between connections. <code>data</code> waits until data has
96 been transmitted as documented above, and the initial data buffer and
97 network endpoint addresses are all retrieved from the single AcceptEx()
98 invocation. <code>connect</code> will use the AcceptEx() API, also
99 retrieve the network endpoint addresses, but like <code>none</code>
100 the <code>connect</code> option does not wait for the initial data
103 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
104 and will not recycle sockets between connections. This is useful for
105 network adapters with broken driver support, as well as some virtual
106 network providers such as vpn drivers, or spam, virus or spyware
110 <seealso><directive>Protocol</directive></seealso>
114 <name>AcceptPathInfo</name>
115 <description>Resources accept trailing pathname information</description>
116 <syntax>AcceptPathInfo On|Off|Default</syntax>
117 <default>AcceptPathInfo Default</default>
118 <contextlist><context>server config</context>
119 <context>virtual host</context><context>directory</context>
120 <context>.htaccess</context></contextlist>
121 <override>FileInfo</override>
122 <compatibility>Available in Apache httpd 2.0.30 and later</compatibility>
126 <p>This directive controls whether requests that contain trailing
127 pathname information that follows an actual filename (or
128 non-existent file in an existing directory) will be accepted or
129 rejected. The trailing pathname information can be made
130 available to scripts in the <code>PATH_INFO</code> environment
133 <p>For example, assume the location <code>/test/</code> points to
134 a directory that contains only the single file
135 <code>here.html</code>. Then requests for
136 <code>/test/here.html/more</code> and
137 <code>/test/nothere.html/more</code> both collect
138 <code>/more</code> as <code>PATH_INFO</code>.</p>
140 <p>The three possible arguments for the
141 <directive>AcceptPathInfo</directive> directive are:</p>
143 <dt><code>Off</code></dt><dd>A request will only be accepted if it
144 maps to a literal path that exists. Therefore a request with
145 trailing pathname information after the true filename such as
146 <code>/test/here.html/more</code> in the above example will return
147 a 404 NOT FOUND error.</dd>
149 <dt><code>On</code></dt><dd>A request will be accepted if a
150 leading path component maps to a file that exists. The above
151 example <code>/test/here.html/more</code> will be accepted if
152 <code>/test/here.html</code> maps to a valid file.</dd>
154 <dt><code>Default</code></dt><dd>The treatment of requests with
155 trailing pathname information is determined by the <a
156 href="../handler.html">handler</a> responsible for the request.
157 The core handler for normal files defaults to rejecting
158 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
159 href="mod_cgi.html">cgi-script</a> and <a
160 href="mod_isapi.html">isapi-handler</a>, generally accept
161 <code>PATH_INFO</code> by default.</dd>
164 <p>The primary purpose of the <code>AcceptPathInfo</code>
165 directive is to allow you to override the handler's choice of
166 accepting or rejecting <code>PATH_INFO</code>. This override is required,
167 for example, when you use a <a href="../filter.html">filter</a>, such
168 as <a href="mod_include.html">INCLUDES</a>, to generate content
169 based on <code>PATH_INFO</code>. The core handler would usually reject
170 the request, so you can use the following configuration to enable
174 <Files "mypaths.shtml"><br />
176 Options +Includes<br />
177 SetOutputFilter INCLUDES<br />
178 AcceptPathInfo On<br />
187 <name>AccessFileName</name>
188 <description>Name of the distributed configuration file</description>
189 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
190 <default>AccessFileName .htaccess</default>
191 <contextlist><context>server config</context><context>virtual host</context>
195 <p>While processing a request the server looks for
196 the first existing configuration file from this list of names in
197 every directory of the path to the document, if distributed
198 configuration files are <a href="#allowoverride">enabled for that
199 directory</a>. For example:</p>
205 <p>before returning the document
206 <code>/usr/local/web/index.html</code>, the server will read
207 <code>/.acl</code>, <code>/usr/.acl</code>,
208 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
209 for directives, unless they have been disabled with</p>
212 <Directory /><br />
214 AllowOverride None<br />
219 <seealso><directive module="core">AllowOverride</directive></seealso>
220 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
221 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
225 <name>AddDefaultCharset</name>
226 <description>Default charset parameter to be added when a response
227 content-type is <code>text/plain</code> or <code>text/html</code></description>
228 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
229 <default>AddDefaultCharset Off</default>
230 <contextlist><context>server config</context>
231 <context>virtual host</context><context>directory</context>
232 <context>.htaccess</context></contextlist>
233 <override>FileInfo</override>
236 <p>This directive specifies a default value for the media type
237 charset parameter (the name of a character encoding) to be added
238 to a response if and only if the response's content-type is either
239 <code>text/plain</code> or <code>text/html</code>. This should override
240 any charset specified in the body of the response via a <code>META</code>
241 element, though the exact behavior is often dependent on the user's client
242 configuration. A setting of <code>AddDefaultCharset Off</code>
243 disables this functionality. <code>AddDefaultCharset On</code> enables
244 a default charset of <code>iso-8859-1</code>. Any other value is assumed
245 to be the <var>charset</var> to be used, which should be one of the
246 <a href="http://www.iana.org/assignments/character-sets">IANA registered
247 charset values</a> for use in Internet media types (MIME types).
251 AddDefaultCharset utf-8
254 <p><directive>AddDefaultCharset</directive> should only be used when all
255 of the text resources to which it applies are known to be in that
256 character encoding and it is too inconvenient to label their charset
257 individually. One such example is to add the charset parameter
258 to resources containing generated content, such as legacy CGI
259 scripts, that might be vulnerable to cross-site scripting attacks
260 due to user-provided data being included in the output. Note, however,
261 that a better solution is to just fix (or delete) those scripts, since
262 setting a default charset does not protect users that have enabled
263 the "auto-detect character encoding" feature on their browser.</p>
265 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
269 <name>AllowEncodedSlashes</name>
270 <description>Determines whether encoded path separators in URLs are allowed to
271 be passed through</description>
272 <syntax>AllowEncodedSlashes On|Off</syntax>
273 <default>AllowEncodedSlashes Off</default>
274 <contextlist><context>server config</context><context>virtual host</context>
276 <compatibility>Available in Apache httpd 2.0.46 and later</compatibility>
279 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
280 which contain encoded path separators (<code>%2F</code> for <code>/</code>
281 and additionally <code>%5C</code> for <code>\</code> on according systems)
282 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
284 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
285 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
287 <note><title>Note</title>
288 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
289 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
290 according systems) will be left as such in the otherwise decoded URL
294 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
298 <name>AllowOverride</name>
299 <description>Types of directives that are allowed in
300 <code>.htaccess</code> files</description>
301 <syntax>AllowOverride All|None|<var>directive-type</var>
302 [<var>directive-type</var>] ...</syntax>
303 <default>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</default>
304 <contextlist><context>directory</context></contextlist>
307 <p>When the server finds an <code>.htaccess</code> file (as
308 specified by <directive module="core">AccessFileName</directive>)
309 it needs to know which directives declared in that file can override
310 earlier configuration directives.</p>
312 <note><title>Only available in <Directory> sections</title>
313 <directive>AllowOverride</directive> is valid only in
314 <directive type="section" module="core">Directory</directive>
315 sections specified without regular expressions, not in <directive
316 type="section" module="core">Location</directive>, <directive
317 module="core" type="section">DirectoryMatch</directive> or
318 <directive type="section" module="core">Files</directive> sections.
321 <p>When this directive is set to <code>None</code>, then
322 <a href="#accessfilename">.htaccess</a> files are completely ignored.
323 In this case, the server will not even attempt to read
324 <code>.htaccess</code> files in the filesystem.</p>
326 <p>When this directive is set to <code>All</code>, then any
327 directive which has the .htaccess <a
328 href="directive-dict.html#Context">Context</a> is allowed in
329 <code>.htaccess</code> files.</p>
331 <p>The <var>directive-type</var> can be one of the following
332 groupings of directives.</p>
339 Allow use of the authorization directives (<directive
340 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
341 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
342 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
343 <directive module="mod_authn_core">AuthName</directive>,
344 <directive module="mod_authn_core">AuthType</directive>, <directive
345 module="mod_authn_file">AuthUserFile</directive>, <directive
346 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
351 Allow use of the directives controlling document types
352 (<directive module="core">ErrorDocument</directive>,
353 <directive module="core">ForceType</directive>,
354 <directive module="mod_negotiation">LanguagePriority</directive>,
355 <directive module="core">SetHandler</directive>,
356 <directive module="core">SetInputFilter</directive>,
357 <directive module="core">SetOutputFilter</directive>, and
358 <module>mod_mime</module> Add* and Remove* directives),
359 document meta data (<directive
360 module="mod_headers">Header</directive>, <directive
361 module="mod_headers">RequestHeader</directive>, <directive
362 module="mod_setenvif">SetEnvIf</directive>, <directive
363 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
364 module="mod_setenvif">BrowserMatch</directive>, <directive
365 module="mod_usertrack">CookieExpires</directive>, <directive
366 module="mod_usertrack">CookieDomain</directive>, <directive
367 module="mod_usertrack">CookieStyle</directive>, <directive
368 module="mod_usertrack">CookieTracking</directive>, <directive
369 module="mod_usertrack">CookieName</directive>),
370 <module>mod_rewrite</module> directives <directive
371 module="mod_rewrite">RewriteEngine</directive>, <directive
372 module="mod_rewrite">RewriteOptions</directive>, <directive
373 module="mod_rewrite">RewriteBase</directive>, <directive
374 module="mod_rewrite">RewriteCond</directive>, <directive
375 module="mod_rewrite">RewriteRule</directive>) and
376 <directive module="mod_actions">Action</directive> from
377 <module>mod_actions</module>.
383 Allow use of the directives controlling directory indexing
385 module="mod_autoindex">AddDescription</directive>,
386 <directive module="mod_autoindex">AddIcon</directive>, <directive
387 module="mod_autoindex">AddIconByEncoding</directive>,
388 <directive module="mod_autoindex">AddIconByType</directive>,
389 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
390 module="mod_dir">DirectoryIndex</directive>, <directive
391 module="mod_autoindex">FancyIndexing</directive>, <directive
392 module="mod_autoindex">HeaderName</directive>, <directive
393 module="mod_autoindex">IndexIgnore</directive>, <directive
394 module="mod_autoindex">IndexOptions</directive>, <directive
395 module="mod_autoindex">ReadmeName</directive>,
401 Allow use of the directives controlling host access (<directive
402 module="mod_authz_host">Allow</directive>, <directive
403 module="mod_authz_host">Deny</directive> and <directive
404 module="mod_authz_host">Order</directive>).</dd>
406 <dt>Options[=<var>Option</var>,...]</dt>
409 Allow use of the directives controlling specific directory
410 features (<directive module="core">Options</directive> and
411 <directive module="mod_include">XBitHack</directive>).
412 An equal sign may be given followed by a comma (but no spaces)
413 separated lists of options that may be set using the <directive
414 module="core">Options</directive> command.</dd>
420 AllowOverride AuthConfig Indexes
423 <p>In the example above all directives that are neither in the group
424 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
427 <note><p>For security and performance reasons, do not set
428 <code>AllowOverride</code> to anything other than <code>None</code>
429 in your <code><Directory /></code> block. Instead, find (or
430 create) the <code><Directory></code> block that refers to the
431 directory where you're actually planning to place a
432 <code>.htaccess</code> file.</p>
436 <seealso><directive module="core">AccessFileName</directive></seealso>
437 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
438 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
442 <name>CGIMapExtension</name>
443 <description>Technique for locating the interpreter for CGI
444 scripts</description>
445 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
446 <contextlist><context>directory</context><context>.htaccess</context>
448 <override>FileInfo</override>
449 <compatibility>NetWare only</compatibility>
452 <p>This directive is used to control how Apache httpd finds the
453 interpreter used to run CGI scripts. For example, setting
454 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
455 cause all CGI script files with a <code>.foo</code> extension to
456 be passed to the FOO interpreter.</p>
461 <name>ContentDigest</name>
462 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
463 headers</description>
464 <syntax>ContentDigest On|Off</syntax>
465 <default>ContentDigest Off</default>
466 <contextlist><context>server config</context><context>virtual host</context>
467 <context>directory</context><context>.htaccess</context>
469 <override>Options</override>
470 <status>Experimental</status>
473 <p>This directive enables the generation of
474 <code>Content-MD5</code> headers as defined in RFC1864
475 respectively RFC2616.</p>
477 <p>MD5 is an algorithm for computing a "message digest"
478 (sometimes called "fingerprint") of arbitrary-length data, with
479 a high degree of confidence that any alterations in the data
480 will be reflected in alterations in the message digest.</p>
482 <p>The <code>Content-MD5</code> header provides an end-to-end
483 message integrity check (MIC) of the entity-body. A proxy or
484 client may check this header for detecting accidental
485 modification of the entity-body in transit. Example header:</p>
488 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
491 <p>Note that this can cause performance problems on your server
492 since the message digest is computed on every request (the
493 values are not cached).</p>
495 <p><code>Content-MD5</code> is only sent for documents served
496 by the <module>core</module>, and not by any module. For example,
497 SSI documents, output from CGI scripts, and byte range responses
498 do not have this header.</p>
503 <name>DefaultType</name>
504 <description>This directive has no effect other than to emit warnings
505 if the value is not <code>none</code>. In prior versions, DefaultType
506 would specify a default media type to assign to response content for
507 which no other media type configuration could be found.
509 <syntax>DefaultType <var>media-type|none</var></syntax>
510 <default>DefaultType none</default>
511 <contextlist><context>server config</context><context>virtual host</context>
512 <context>directory</context><context>.htaccess</context>
514 <override>FileInfo</override>
515 <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>
518 <p>This directive has been disabled. For backwards compatibility
519 of configuration files, it may be specified with the value
520 <code>none</code>, meaning no default media type. For example:</p>
526 <p><code>DefaultType None</code> is only available in
527 httpd-2.2.7 and later.</p>
529 <p>Use the mime.types configuration file and the
530 <directive module="mod_mime">AddType</directive> to configure media
531 type assignments via file extensions, or the
532 <directive module="core">ForceType</directive> directive to configure
533 the media type for specific resources. Otherwise, the server will
534 send the response without a Content-Type header field and the
535 recipient may attempt to guess the media type.</p>
541 <description>Define the existence of a variable</description>
542 <syntax>Define <var>parameter-name</var></syntax>
543 <contextlist><context>server config</context></contextlist>
546 <p>Equivalent to passing the <code>-D</code> argument to <program
547 >httpd</program>.</p>
548 <p>This directive can be used to toggle the use of <directive module="core"
549 type="section">IfDefine</directive> sections without needing to alter
550 <code>-D</code> arguments in any startup scripts.</p>
554 <directivesynopsis type="section">
555 <name>Directory</name>
556 <description>Enclose a group of directives that apply only to the
557 named file-system directory, sub-directories, and their contents.</description>
558 <syntax><Directory <var>directory-path</var>>
559 ... </Directory></syntax>
560 <contextlist><context>server config</context><context>virtual host</context>
564 <p><directive type="section">Directory</directive> and
565 <code></Directory></code> are used to enclose a group of
566 directives that will apply only to the named directory,
567 sub-directories of that directory, and the files within the respective
568 directories. Any directive that is allowed
569 in a directory context may be used. <var>Directory-path</var> is
570 either the full path to a directory, or a wild-card string using
571 Unix shell-style matching. In a wild-card string, <code>?</code> matches
572 any single character, and <code>*</code> matches any sequences of
573 characters. You may also use <code>[]</code> character ranges. None
574 of the wildcards match a `/' character, so <code><Directory
575 /*/public_html></code> will not match
576 <code>/home/user/public_html</code>, but <code><Directory
577 /home/*/public_html></code> will match. Example:</p>
580 <Directory /usr/local/httpd/htdocs><br />
582 Options Indexes FollowSymLinks<br />
588 <p>Be careful with the <var>directory-path</var> arguments:
589 They have to literally match the filesystem path which Apache httpd uses
590 to access the files. Directives applied to a particular
591 <code><Directory></code> will not apply to files accessed from
592 that same directory via a different path, such as via different symbolic
596 <p><glossary ref="regex">Regular
597 expressions</glossary> can also be used, with the addition of the
598 <code>~</code> character. For example:</p>
601 <Directory ~ "^/www/.*/[0-9]{3}">
604 <p>would match directories in <code>/www/</code> that consisted of
607 <p>If multiple (non-regular expression) <directive
608 type="section">Directory</directive> sections
609 match the directory (or one of its parents) containing a document,
610 then the directives are applied in the order of shortest match
611 first, interspersed with the directives from the <a
612 href="#accessfilename">.htaccess</a> files. For example,
616 <Directory /><br />
618 AllowOverride None<br />
620 </Directory><br />
622 <Directory /home/><br />
624 AllowOverride FileInfo<br />
629 <p>for access to the document <code>/home/web/dir/doc.html</code>
633 <li>Apply directive <code>AllowOverride None</code>
634 (disabling <code>.htaccess</code> files).</li>
636 <li>Apply directive <code>AllowOverride FileInfo</code> (for
637 directory <code>/home</code>).</li>
639 <li>Apply any <code>FileInfo</code> directives in
640 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
641 <code>/home/web/dir/.htaccess</code> in that order.</li>
644 <p>Regular expressions are not considered until after all of the
645 normal sections have been applied. Then all of the regular
646 expressions are tested in the order they appeared in the
647 configuration file. For example, with</p>
650 <Directory ~ abc$><br />
652 # ... directives here ...<br />
657 <p>the regular expression section won't be considered until after
658 all normal <directive type="section">Directory</directive>s and
659 <code>.htaccess</code> files have been applied. Then the regular
660 expression will match on <code>/home/abc/public_html/abc</code> and
661 the corresponding <directive type="section">Directory</directive> will
664 <p><strong>Note that the default access for
665 <code><Directory /></code> is <code>Allow from All</code>.
666 This means that Apache httpd will serve any file mapped from an URL. It is
667 recommended that you change this with a block such
671 <Directory /><br />
673 Order Deny,Allow<br />
679 <p><strong>and then override this for directories you
680 <em>want</em> accessible. See the <a
681 href="../misc/security_tips.html">Security Tips</a> page for more
682 details.</strong></p>
684 <p>The directory sections occur in the <code>httpd.conf</code> file.
685 <directive type="section">Directory</directive> directives
686 cannot nest, and cannot appear in a <directive module="core"
687 type="section">Limit</directive> or <directive module="core"
688 type="section">LimitExcept</directive> section.</p>
690 <seealso><a href="../sections.html">How <Directory>,
691 <Location> and <Files> sections work</a> for an
692 explanation of how these different sections are combined when a
693 request is received</seealso>
696 <directivesynopsis type="section">
697 <name>DirectoryMatch</name>
698 <description>Enclose directives that apply to
699 the contents of file-system directories matching a regular expression.</description>
700 <syntax><DirectoryMatch <var>regex</var>>
701 ... </DirectoryMatch></syntax>
702 <contextlist><context>server config</context><context>virtual host</context>
706 <p><directive type="section">DirectoryMatch</directive> and
707 <code></DirectoryMatch></code> are used to enclose a group
708 of directives which will apply only to the named directory (and the files within),
709 the same as <directive module="core" type="section">Directory</directive>.
710 However, it takes as an argument a
711 <glossary ref="regex">regular expression</glossary>. For example:</p>
714 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
717 <p>would match directories in <code>/www/</code> that consisted of three
720 <note><title>Compatability</title>
721 Prior to 2.3.9, this directive implicitly applied to sub-directories
722 (like <directive module="core" type="section">Directory</directive>) and
723 could not match the end of line symbol ($). In 2.3.9 and later,
724 only directories that match the expression are affected by the enclosed
728 <note><title>Trailing Slash</title>
729 This directive applies to requests for directories that may or may
730 not end in a trailing slash, so expressions that are anchored to the
731 end of line ($) must be written with care.
734 <seealso><directive type="section" module="core">Directory</directive> for
735 a description of how regular expressions are mixed in with normal
736 <directive type="section">Directory</directive>s</seealso>
738 href="../sections.html">How <Directory>, <Location> and
739 <Files> sections work</a> for an explanation of how these different
740 sections are combined when a request is received</seealso>
744 <name>DocumentRoot</name>
745 <description>Directory that forms the main document tree visible
746 from the web</description>
747 <syntax>DocumentRoot <var>directory-path</var></syntax>
748 <default>DocumentRoot /usr/local/apache/htdocs</default>
749 <contextlist><context>server config</context><context>virtual host</context>
753 <p>This directive sets the directory from which <program>httpd</program>
754 will serve files. Unless matched by a directive like <directive
755 module="mod_alias">Alias</directive>, the server appends the
756 path from the requested URL to the document root to make the
757 path to the document. Example:</p>
760 DocumentRoot /usr/web
764 <code>http://my.example.com/index.html</code> refers to
765 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
766 not absolute then it is assumed to be relative to the <directive
767 module="core">ServerRoot</directive>.</p>
769 <p>The <directive>DocumentRoot</directive> should be specified without
770 a trailing slash.</p>
772 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
773 Locations</a></seealso>
777 <name>EnableMMAP</name>
778 <description>Use memory-mapping to read files during delivery</description>
779 <syntax>EnableMMAP On|Off</syntax>
780 <default>EnableMMAP On</default>
781 <contextlist><context>server config</context><context>virtual host</context>
782 <context>directory</context><context>.htaccess</context>
784 <override>FileInfo</override>
787 <p>This directive controls whether the <program>httpd</program> may use
788 memory-mapping if it needs to read the contents of a file during
789 delivery. By default, when the handling of a request requires
790 access to the data within a file -- for example, when delivering a
791 server-parsed file using <module>mod_include</module> -- Apache httpd
792 memory-maps the file if the OS supports it.</p>
794 <p>This memory-mapping sometimes yields a performance improvement.
795 But in some environments, it is better to disable the memory-mapping
796 to prevent operational problems:</p>
799 <li>On some multiprocessor systems, memory-mapping can reduce the
800 performance of the <program>httpd</program>.</li>
801 <li>Deleting or truncating a file while <program>httpd</program>
802 has it memory-mapped can cause <program>httpd</program> to
803 crash with a segmentation fault.
807 <p>For server configurations that are vulnerable to these problems,
808 you should disable memory-mapping of delivered files by specifying:</p>
814 <p>For NFS mounted files, this feature may be disabled explicitly for
815 the offending files by specifying:</p>
818 <Directory "/path-to-nfs-files">
828 <name>EnableSendfile</name>
829 <description>Use the kernel sendfile support to deliver files to the client</description>
830 <syntax>EnableSendfile On|Off</syntax>
831 <default>EnableSendfile Off</default>
832 <contextlist><context>server config</context><context>virtual host</context>
833 <context>directory</context><context>.htaccess</context>
835 <override>FileInfo</override>
836 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
837 version 2.3.9.</compatibility>
840 <p>This directive controls whether <program>httpd</program> may use the
841 sendfile support from the kernel to transmit file contents to the client.
842 By default, when the handling of a request requires no access
843 to the data within a file -- for example, when delivering a
844 static file -- Apache httpd uses sendfile to deliver the file contents
845 without ever reading the file if the OS supports it.</p>
847 <p>This sendfile mechanism avoids separate read and send operations,
848 and buffer allocations. But on some platforms or within some
849 filesystems, it is better to disable this feature to avoid
850 operational problems:</p>
853 <li>Some platforms may have broken sendfile support that the build
854 system did not detect, especially if the binaries were built on
855 another box and moved to such a machine with broken sendfile
857 <li>On Linux the use of sendfile triggers TCP-checksum
858 offloading bugs on certain networking cards when using IPv6.</li>
859 <li>On Linux on Itanium, sendfile may be unable to handle files
860 over 2GB in size.</li>
861 <li>With a network-mounted <directive
862 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
863 the kernel may be unable to serve the network file through
867 <p>For server configurations that are not vulnerable to these problems,
868 you may enable this feature by specifying:</p>
874 <p>For network mounted files, this feature may be disabled explicitly
875 for the offending files by specifying:</p>
878 <Directory "/path-to-nfs-files">
884 <p>Please note that the per-directory and .htaccess configuration
885 of <directive>EnableSendfile</directive> is not supported by
886 <module>mod_cache_disk</module>.
887 Only global definition of <directive>EnableSendfile</directive>
888 is taken into account by the module.
895 <description>Abort configuration parsing with a custom error message</description>
896 <syntax>Error <var>message</var></syntax>
897 <contextlist><context>server config</context><context>virtual host</context>
898 <context>directory</context><context>.htaccess</context>
900 <compatibility>2.3.9 and later</compatibility>
903 <p>If an error can be detected within the configuration, this
904 directive can be used to generate a custom error message, and halt
905 configuration parsing. The typical use is for reporting required
906 modules which are missing from the configuration.</p>
908 <example><title>Example</title>
909 # ensure that mod_include is loaded<br />
910 <IfModule !include_module><br />
911 Error mod_include is required by mod_foo. Load it with LoadModule.<br />
912 </IfModule><br />
914 # ensure that exactly one of SSL,NOSSL is defined<br />
915 <IfDefine SSL><br />
916 <IfDefine NOSSL><br />
917 Error Both SSL and NOSSL are defined. Define only one of them.<br />
918 </IfDefine><br />
919 </IfDefine><br />
920 <IfDefine !SSL><br />
921 <IfDefine !NOSSL><br />
922 Error Either SSL or NOSSL must be defined.<br />
923 </IfDefine><br />
924 </IfDefine><br />
931 <name>ErrorDocument</name>
932 <description>What the server will return to the client
933 in case of an error</description>
934 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
935 <contextlist><context>server config</context><context>virtual host</context>
936 <context>directory</context><context>.htaccess</context>
938 <override>FileInfo</override>
941 <p>In the event of a problem or error, Apache httpd can be configured
942 to do one of four things,</p>
945 <li>output a simple hardcoded error message</li>
947 <li>output a customized message</li>
949 <li>redirect to a local <var>URL-path</var> to handle the
952 <li>redirect to an external <var>URL</var> to handle the
956 <p>The first option is the default, while options 2-4 are
957 configured using the <directive>ErrorDocument</directive>
958 directive, which is followed by the HTTP response code and a URL
959 or a message. Apache httpd will sometimes offer additional information
960 regarding the problem/error.</p>
962 <p>URLs can begin with a slash (/) for local web-paths (relative
963 to the <directive module="core">DocumentRoot</directive>), or be a
964 full URL which the client can resolve. Alternatively, a message
965 can be provided to be displayed by the browser. Examples:</p>
968 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
969 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
970 ErrorDocument 401 /subscription_info.html<br />
971 ErrorDocument 403 "Sorry can't allow you access today"
974 <p>Additionally, the special value <code>default</code> can be used
975 to specify Apache httpd's simple hardcoded message. While not required
976 under normal circumstances, <code>default</code> will restore
977 Apache httpd's simple hardcoded message for configurations that would
978 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
981 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
982 <Directory /web/docs><br />
984 ErrorDocument 404 default<br />
989 <p>Note that when you specify an <directive>ErrorDocument</directive>
990 that points to a remote URL (ie. anything with a method such as
991 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
992 client to tell it where to find the document, even if the
993 document ends up being on the same server. This has several
994 implications, the most important being that the client will not
995 receive the original error status code, but instead will
996 receive a redirect status code. This in turn can confuse web
997 robots and other clients which try to determine if a URL is
998 valid using the status code. In addition, if you use a remote
999 URL in an <code>ErrorDocument 401</code>, the client will not
1000 know to prompt the user for a password since it will not
1001 receive the 401 status code. Therefore, <strong>if you use an
1002 <code>ErrorDocument 401</code> directive then it must refer to a local
1003 document.</strong></p>
1005 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1006 server-generated error messages when they are "too small" and substitute
1007 its own "friendly" error messages. The size threshold varies depending on
1008 the type of error, but in general, if you make your error document
1009 greater than 512 bytes, then MSIE will show the server-generated
1010 error rather than masking it. More information is available in
1011 Microsoft Knowledge Base article <a
1012 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1015 <p>Although most error messages can be overriden, there are certain
1016 circumstances where the internal messages are used regardless of the
1017 setting of <directive module="core">ErrorDocument</directive>. In
1018 particular, if a malformed request is detected, normal request processing
1019 will be immediately halted and the internal error message returned.
1020 This is necessary to guard against security problems caused by
1023 <p>If you are using mod_proxy, you may wish to enable
1024 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1025 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1026 Apache httpd will not generate custom error documents for proxied content.</p>
1029 <seealso><a href="../custom-error.html">documentation of
1030 customizable responses</a></seealso>
1031 </directivesynopsis>
1034 <name>ErrorLog</name>
1035 <description>Location where the server will log errors</description>
1036 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1037 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1038 <contextlist><context>server config</context><context>virtual host</context>
1042 <p>The <directive>ErrorLog</directive> directive sets the name of
1043 the file to which the server will log any errors it encounters. If
1044 the <var>file-path</var> is not absolute then it is assumed to be
1045 relative to the <directive module="core">ServerRoot</directive>.</p>
1047 <example><title>Example</title>
1048 ErrorLog /var/log/httpd/error_log
1051 <p>If the <var>file-path</var>
1052 begins with a pipe character "<code>|</code>" then it is assumed to be a
1053 command to spawn to handle the error log.</p>
1055 <example><title>Example</title>
1056 ErrorLog "|/usr/local/bin/httpd_errors"
1059 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1060 more information.</p>
1062 <p>Using <code>syslog</code> instead of a filename enables logging
1063 via syslogd(8) if the system supports it. The default is to use
1064 syslog facility <code>local7</code>, but you can override this by
1065 using the <code>syslog:<var>facility</var></code> syntax where
1066 <var>facility</var> can be one of the names usually documented in
1067 syslog(1). The facility is effectively global, and if it is changed
1068 in individual virtual hosts, the final facility specified affects the
1071 <example><title>Example</title>
1072 ErrorLog syslog:user
1075 <p>SECURITY: See the <a
1076 href="../misc/security_tips.html#serverroot">security tips</a>
1077 document for details on why your security could be compromised
1078 if the directory where log files are stored is writable by
1079 anyone other than the user that starts the server.</p>
1080 <note type="warning"><title>Note</title>
1081 <p>When entering a file path on non-Unix platforms, care should be taken
1082 to make sure that only forward slashes are used even though the platform
1083 may allow the use of back slashes. In general it is a good idea to always
1084 use forward slashes throughout the configuration files.</p>
1087 <seealso><directive module="core">LogLevel</directive></seealso>
1088 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1089 </directivesynopsis>
1092 <name>ErrorLogFormat</name>
1093 <description>Format specification for error log entries</description>
1094 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1095 <contextlist><context>server config</context><context>virtual host</context>
1097 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1100 <p><directive>ErrorLogFormat</directive> allows to specify what
1101 supplementary information is logged in the error log in addition to the
1102 actual log message.</p>
1104 <example><title>Simple example</title>
1105 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1108 <p>Specifying <code>connection</code> or <code>request</code> as first
1109 paramter allows to specify additional formats, causing additional
1110 information to be logged when the first message is logged for a specific
1111 connection or request, respectivly. This additional information is only
1112 logged once per connection/request. If a connection or request is processed
1113 without causing any log message, the additional information is not logged
1116 <p>It can happen that some format string items do not produce output. For
1117 example, the Referer header is only present if the log message is
1118 associated to a request and the log message happens at a time when the
1119 Referer header has already been read from the client. If no output is
1120 produced, the default behaviour is to delete everything from the preceeding
1121 space character to the next space character. This means the log line is
1122 implicitly divided into fields on non-whitespace to whitespace transitions.
1123 If a format string item does not produce output, the whole field is
1124 ommitted. For example, if the remote address <code>%a</code> in the log
1125 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1126 brackets are not logged either. Space characters can be escaped with a
1127 backslash to prevent them from delimiting a field. The combination '% '
1128 (percent space) is a zero-witdh field delimiter that does not produce any
1131 <p>The above behaviour can be changed by adding modifiers to the format
1132 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1133 respective item does not produce any output. In once-per-connection/request
1134 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1135 item with the plus modifier does not produce any output, the whole line is
1138 <p>A number as modifier can be used to assign a log severity level to a
1139 format item. The item will only be logged if the severity of the log
1140 message is not higher than the specified log severity level. The number can
1141 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1143 <p>Some format string items accept additional parameters in braces.</p>
1145 <table border="1" style="zebra">
1146 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1148 <tr><th>Format String</th> <th>Description</th></tr>
1150 <tr><td><code>%%</code></td>
1151 <td>The percent sign</td></tr>
1153 <tr><td><code>%...a</code></td>
1154 <td>Remote IP-address and port</td></tr>
1156 <tr><td><code>%...A</code></td>
1157 <td>Local IP-address and port</td></tr>
1159 <tr><td><code>%...{name}e</code></td>
1160 <td>Request environment variable <code>name</code></td></tr>
1162 <tr><td><code>%...E</code></td>
1163 <td>APR/OS error status code and string</td></tr>
1165 <tr><td><code>%...F</code></td>
1166 <td>Source file name and line number of the log call</td></tr>
1168 <tr><td><code>%...{name}i</code></td>
1169 <td>Request header <code>name</code></td></tr>
1171 <tr><td><code>%...k</code></td>
1172 <td>Number of keep-alive requests on this connection</td></tr>
1174 <tr><td><code>%...l</code></td>
1175 <td>Loglevel of the message</td></tr>
1177 <tr><td><code>%...L</code></td>
1178 <td>Log ID of the request</td></tr>
1180 <tr><td><code>%...{c}L</code></td>
1181 <td>Log ID of the connection</td></tr>
1183 <tr><td><code>%...{C}L</code></td>
1184 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1186 <tr><td><code>%...m</code></td>
1187 <td>Name of the module logging the message</td></tr>
1189 <tr><td><code>%M</code></td>
1190 <td>The actual log message</td></tr>
1192 <tr><td><code>%...{name}n</code></td>
1193 <td>Request note <code>name</code></td></tr>
1195 <tr><td><code>%...P</code></td>
1196 <td>Process ID of current process</td></tr>
1198 <tr><td><code>%...T</code></td>
1199 <td>Thread ID of current thread</td></tr>
1201 <tr><td><code>%...t</code></td>
1202 <td>The current time</td></tr>
1204 <tr><td><code>%...{u}t</code></td>
1205 <td>The current time including micro-seconds</td></tr>
1207 <tr><td><code>%...{cu}t</code></td>
1208 <td>The current time in compact ISO 8601 format, including
1209 micro-seconds</td></tr>
1211 <tr><td><code>%...v</code></td>
1212 <td>The canonical <directive module="core">ServerName</directive>
1213 of the current server.</td></tr>
1215 <tr><td><code>%...V</code></td>
1216 <td>The server name of the server serving the request according to the
1217 <directive module="core" >UseCanonicalName</directive>
1220 <tr><td><code>\ </code> (backslash space)</td>
1221 <td>Non-field delimiting space</td></tr>
1223 <tr><td><code>% </code> (percent space)</td>
1224 <td>Field delimiter (no output)</td></tr>
1227 <p>The log ID format <code>%L</code> produces a unique id for a connection
1228 or request. This can be used to correlate which log lines belong to the
1229 same connection or request, which request happens on which connection.
1230 A <code>%L</code> format string is also available in
1231 <module>mod_log_config</module>, to allow to correlate access log entries
1232 with error log lines. If <module>mod_unique_id</module> is loaded, its
1233 unique id will be used as log ID for requests.</p>
1235 <example><title>Example (somewhat similar to default format)</title>
1236 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1237 %M% ,\ referer\ %{Referer}i"
1240 <example><title>Example (similar to the 2.2.x format)</title>
1241 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1242 %M% ,\ referer\ %{Referer}i"
1245 <example><title>Advanced example with request/connection log IDs</title>
1246 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1247 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1248 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1249 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1250 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1254 <seealso><directive module="core">ErrorLog</directive></seealso>
1255 <seealso><directive module="core">LogLevel</directive></seealso>
1256 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1257 </directivesynopsis>
1260 <name>ExtendedStatus</name>
1261 <description>Keep track of extended status information for each
1262 request</description>
1263 <syntax>ExtendedStatus On|Off</syntax>
1264 <default>ExtendedStatus Off[*]</default>
1265 <contextlist><context>server config</context></contextlist>
1268 <p>This option tracks additional data per worker about the
1269 currently executing request, and a utilization summary; you
1270 can see these variables during runtime by configuring
1271 <module>mod_status</module>. Note that other modules may
1272 rely on this scoreboard.</p>
1274 <p>This setting applies to the entire server, and cannot be
1275 enabled or disabled on a virtualhost-by-virtualhost basis.
1276 The collection of extended status information can slow down
1277 the server. Also note that this setting cannot be changed
1278 during a graceful restart.</p>
1281 <p>Note that loading <module>mod_status</module> will change
1282 the default behavior to ExtendedStatus On, while other
1283 third party modules may do the same. Such modules rely on
1284 collecting detailed information about the state of all workers.
1285 The default is changed by <module>mod_status</module> beginning
1286 with version 2.3.6; the previous default was always Off.</p>
1291 </directivesynopsis>
1294 <name>FileETag</name>
1295 <description>File attributes used to create the ETag
1296 HTTP response header for static files</description>
1297 <syntax>FileETag <var>component</var> ...</syntax>
1298 <default>FileETag INode MTime Size</default>
1299 <contextlist><context>server config</context><context>virtual host</context>
1300 <context>directory</context><context>.htaccess</context>
1302 <override>FileInfo</override>
1306 The <directive>FileETag</directive> directive configures the file
1307 attributes that are used to create the <code>ETag</code> (entity
1308 tag) response header field when the document is based on a static file.
1309 (The <code>ETag</code> value is used in cache management to save
1310 network bandwidth.) The
1311 <directive>FileETag</directive> directive allows you to choose
1312 which of these -- if any -- should be used. The recognized keywords are:
1316 <dt><strong>INode</strong></dt>
1317 <dd>The file's i-node number will be included in the calculation</dd>
1318 <dt><strong>MTime</strong></dt>
1319 <dd>The date and time the file was last modified will be included</dd>
1320 <dt><strong>Size</strong></dt>
1321 <dd>The number of bytes in the file will be included</dd>
1322 <dt><strong>All</strong></dt>
1323 <dd>All available fields will be used. This is equivalent to:
1324 <example>FileETag INode MTime Size</example></dd>
1325 <dt><strong>None</strong></dt>
1326 <dd>If a document is file-based, no <code>ETag</code> field will be
1327 included in the response</dd>
1330 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1331 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1332 which allow changes to be made to the default setting inherited
1333 from a broader scope. Any keyword appearing without such a prefix
1334 immediately and completely cancels the inherited setting.</p>
1336 <p>If a directory's configuration includes
1337 <code>FileETag INode MTime Size</code>, and a
1338 subdirectory's includes <code>FileETag -INode</code>,
1339 the setting for that subdirectory (which will be inherited by
1340 any sub-subdirectories that don't override it) will be equivalent to
1341 <code>FileETag MTime Size</code>.</p>
1342 <note type="warning"><title>Warning</title>
1343 Do not change the default for directories or locations that have WebDAV
1344 enabled and use <module>mod_dav_fs</module> as a storage provider.
1345 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1346 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1347 These conditional requests will break if the <code>ETag</code> format is
1348 changed via <directive>FileETag</directive>.
1350 <note><title>Server Side Includes</title>
1351 An ETag is not generated for responses parsed by <module>mod_include</module>,
1352 since the response entity can change without a change of the INode, MTime, or Size
1353 of the static file with embedded SSI directives.
1357 </directivesynopsis>
1359 <directivesynopsis type="section">
1361 <description>Contains directives that apply to matched
1362 filenames</description>
1363 <syntax><Files <var>filename</var>> ... </Files></syntax>
1364 <contextlist><context>server config</context><context>virtual host</context>
1365 <context>directory</context><context>.htaccess</context>
1367 <override>All</override>
1370 <p>The <directive type="section">Files</directive> directive
1371 limits the scope of the enclosed directives by filename. It is comparable
1372 to the <directive module="core" type="section">Directory</directive>
1373 and <directive module="core" type="section">Location</directive>
1374 directives. It should be matched with a <code></Files></code>
1375 directive. The directives given within this section will be applied to
1376 any object with a basename (last component of filename) matching the
1377 specified filename. <directive type="section">Files</directive>
1378 sections are processed in the order they appear in the
1379 configuration file, after the <directive module="core"
1380 type="section">Directory</directive> sections and
1381 <code>.htaccess</code> files are read, but before <directive
1382 type="section" module="core">Location</directive> sections. Note
1383 that <directive type="section">Files</directive> can be nested
1384 inside <directive type="section"
1385 module="core">Directory</directive> sections to restrict the
1386 portion of the filesystem they apply to.</p>
1388 <p>The <var>filename</var> argument should include a filename, or
1389 a wild-card string, where <code>?</code> matches any single character,
1390 and <code>*</code> matches any sequences of characters.
1391 <glossary ref="regex">Regular expressions</glossary>
1392 can also be used, with the addition of the
1393 <code>~</code> character. For example:</p>
1396 <Files ~ "\.(gif|jpe?g|png)$">
1399 <p>would match most common Internet graphics formats. <directive
1400 module="core" type="section">FilesMatch</directive> is preferred,
1403 <p>Note that unlike <directive type="section"
1404 module="core">Directory</directive> and <directive type="section"
1405 module="core">Location</directive> sections, <directive
1406 type="section">Files</directive> sections can be used inside
1407 <code>.htaccess</code> files. This allows users to control access to
1408 their own files, at a file-by-file level.</p>
1411 <seealso><a href="../sections.html">How <Directory>, <Location>
1412 and <Files> sections work</a> for an explanation of how these
1413 different sections are combined when a request is received</seealso>
1414 </directivesynopsis>
1416 <directivesynopsis type="section">
1417 <name>FilesMatch</name>
1418 <description>Contains directives that apply to regular-expression matched
1419 filenames</description>
1420 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1421 <contextlist><context>server config</context><context>virtual host</context>
1422 <context>directory</context><context>.htaccess</context>
1424 <override>All</override>
1427 <p>The <directive type="section">FilesMatch</directive> directive
1428 limits the scope of the enclosed directives by filename, just as the
1429 <directive module="core" type="section">Files</directive> directive
1430 does. However, it accepts a <glossary ref="regex">regular
1431 expression</glossary>. For example:</p>
1434 <FilesMatch "\.(gif|jpe?g|png)$">
1437 <p>would match most common Internet graphics formats.</p>
1440 <seealso><a href="../sections.html">How <Directory>, <Location>
1441 and <Files> sections work</a> for an explanation of how these
1442 different sections are combined when a request is received</seealso>
1443 </directivesynopsis>
1446 <name>ForceType</name>
1447 <description>Forces all matching files to be served with the specified
1448 media type in the HTTP Content-Type header field</description>
1449 <syntax>ForceType <var>media-type</var>|None</syntax>
1450 <contextlist><context>directory</context><context>.htaccess</context>
1452 <override>FileInfo</override>
1453 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1456 <p>When placed into an <code>.htaccess</code> file or a
1457 <directive type="section" module="core">Directory</directive>, or
1458 <directive type="section" module="core">Location</directive> or
1459 <directive type="section" module="core">Files</directive>
1460 section, this directive forces all matching files to be served
1461 with the content type identification given by
1462 <var>media-type</var>. For example, if you had a directory full of
1463 GIF files, but did not want to label them all with <code>.gif</code>,
1464 you might want to use:</p>
1470 <p>Note that this directive overrides other indirect media type
1471 associations defined in mime.types or via the
1472 <directive module="mod_mime">AddType</directive>.</p>
1474 <p>You can also override more general
1475 <directive>ForceType</directive> settings
1476 by using the value of <code>None</code>:</p>
1479 # force all files to be image/gif:<br />
1480 <Location /images><br />
1482 ForceType image/gif<br />
1484 </Location><br />
1486 # but normal mime-type associations here:<br />
1487 <Location /images/mixed><br />
1489 ForceType None<br />
1494 <p>This directive primarily overrides the content types generated for
1495 static files served out of the filesystem. For resources other than
1496 static files, where the generator of the response typically specifies
1497 a Content-Type, this directive has no effect.</p>
1500 </directivesynopsis>
1502 <name>GprofDir</name>
1503 <description>Directory to write gmon.out profiling data to. </description>
1504 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1505 <contextlist><context>server config</context><context>virtual host</context>
1509 <p>When the server has been compiled with gprof profiling suppport,
1510 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1511 be written to the specified directory when the process exits. If the
1512 argument ends with a percent symbol ('%'), subdirectories are created
1513 for each process id.</p>
1515 <p>This directive currently only works with the <module>prefork</module>
1518 </directivesynopsis>
1521 <name>HostnameLookups</name>
1522 <description>Enables DNS lookups on client IP addresses</description>
1523 <syntax>HostnameLookups On|Off|Double</syntax>
1524 <default>HostnameLookups Off</default>
1525 <contextlist><context>server config</context><context>virtual host</context>
1526 <context>directory</context></contextlist>
1529 <p>This directive enables DNS lookups so that host names can be
1530 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1531 The value <code>Double</code> refers to doing double-reverse
1532 DNS lookup. That is, after a reverse lookup is performed, a forward
1533 lookup is then performed on that result. At least one of the IP
1534 addresses in the forward lookup must match the original
1535 address. (In "tcpwrappers" terminology this is called
1536 <code>PARANOID</code>.)</p>
1538 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1539 used for controlling access by hostname, a double reverse lookup
1540 will be performed. This is necessary for security. Note that the
1541 result of this double-reverse isn't generally available unless you
1542 set <code>HostnameLookups Double</code>. For example, if only
1543 <code>HostnameLookups On</code> and a request is made to an object
1544 that is protected by hostname restrictions, regardless of whether
1545 the double-reverse fails or not, CGIs will still be passed the
1546 single-reverse result in <code>REMOTE_HOST</code>.</p>
1548 <p>The default is <code>Off</code> in order to save the network
1549 traffic for those sites that don't truly need the reverse
1550 lookups done. It is also better for the end users because they
1551 don't have to suffer the extra latency that a lookup entails.
1552 Heavily loaded sites should leave this directive
1553 <code>Off</code>, since DNS lookups can take considerable
1554 amounts of time. The utility <program>logresolve</program>, compiled by
1555 default to the <code>bin</code> subdirectory of your installation
1556 directory, can be used to look up host names from logged IP addresses
1559 </directivesynopsis>
1561 <directivesynopsis type="section">
1563 <description>Contains directives that apply only if a condition is
1564 satisfied by a request at runtime</description>
1565 <syntax><If <var>expression</var>> ... </If></syntax>
1566 <contextlist><context>server config</context><context>virtual host</context>
1567 <context>directory</context><context>.htaccess</context>
1569 <override>All</override>
1572 <p>The <directive type="section">If</directive> directive
1573 evaluates an expression at runtime, and applies the enclosed
1574 directives if and only if the expression evaluates to true.
1578 <If "$req{Host} = ''">
1581 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1583 <p>You may compare the value of any variable in the request headers
1584 ($req), response headers ($resp) or environment ($env) in your
1587 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1588 operator to compare if the expression is in a given range:</p>
1591 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1596 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1597 for a complete reference and more examples.</seealso>
1598 <seealso><a href="../sections.html">How <Directory>, <Location>,
1599 <Files> sections work</a> for an explanation of how these
1600 different sections are combined when a request is received.
1601 <directive type="section">If</directive> has the same precedence
1602 and usage as <directive type="section">Files</directive></seealso>
1603 </directivesynopsis>
1605 <directivesynopsis type="section">
1606 <name>IfDefine</name>
1607 <description>Encloses directives that will be processed only
1608 if a test is true at startup</description>
1609 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1610 </IfDefine></syntax>
1611 <contextlist><context>server config</context><context>virtual host</context>
1612 <context>directory</context><context>.htaccess</context>
1614 <override>All</override>
1617 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1618 </code> section is used to mark directives that are conditional. The
1619 directives within an <directive type="section">IfDefine</directive>
1620 section are only processed if the <var>test</var> is true. If <var>
1621 test</var> is false, everything between the start and end markers is
1624 <p>The <var>test</var> in the <directive type="section"
1625 >IfDefine</directive> section directive can be one of two forms:</p>
1628 <li><var>parameter-name</var></li>
1630 <li><code>!</code><var>parameter-name</var></li>
1633 <p>In the former case, the directives between the start and end
1634 markers are only processed if the parameter named
1635 <var>parameter-name</var> is defined. The second format reverses
1636 the test, and only processes the directives if
1637 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1639 <p>The <var>parameter-name</var> argument is a define as given on the
1640 <program>httpd</program> command line via <code>-D<var>parameter</var>
1641 </code> at the time the server was started or by the <directive
1642 module="core">Define</directive> directive.</p>
1644 <p><directive type="section">IfDefine</directive> sections are
1645 nest-able, which can be used to implement simple
1646 multiple-parameter tests. Example:</p>
1649 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1652 <IfDefine ReverseProxy><br />
1654 LoadModule proxy_module modules/mod_proxy.so<br />
1655 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1656 <IfDefine UseCache><br />
1658 LoadModule cache_module modules/mod_cache.so<br />
1659 <IfDefine MemCache><br />
1661 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1663 </IfDefine><br />
1664 <IfDefine !MemCache><br />
1666 LoadModule cache_disk_module modules/mod_cache_disk.so<br />
1675 </directivesynopsis>
1677 <directivesynopsis type="section">
1678 <name>IfModule</name>
1679 <description>Encloses directives that are processed conditional on the
1680 presence or absence of a specific module</description>
1681 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1682 </IfModule></syntax>
1683 <contextlist><context>server config</context><context>virtual host</context>
1684 <context>directory</context><context>.htaccess</context>
1686 <override>All</override>
1687 <compatibility>Module identifiers are available in version 2.1 and
1688 later.</compatibility>
1691 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1692 section is used to mark directives that are conditional on the presence of
1693 a specific module. The directives within an <directive type="section"
1694 >IfModule</directive> section are only processed if the <var>test</var>
1695 is true. If <var>test</var> is false, everything between the start and
1696 end markers is ignored.</p>
1698 <p>The <var>test</var> in the <directive type="section"
1699 >IfModule</directive> section directive can be one of two forms:</p>
1702 <li><var>module</var></li>
1704 <li>!<var>module</var></li>
1707 <p>In the former case, the directives between the start and end
1708 markers are only processed if the module named <var>module</var>
1709 is included in Apache httpd -- either compiled in or
1710 dynamically loaded using <directive module="mod_so"
1711 >LoadModule</directive>. The second format reverses the test,
1712 and only processes the directives if <var>module</var> is
1713 <strong>not</strong> included.</p>
1715 <p>The <var>module</var> argument can be either the module identifier or
1716 the file name of the module, at the time it was compiled. For example,
1717 <code>rewrite_module</code> is the identifier and
1718 <code>mod_rewrite.c</code> is the file name. If a module consists of
1719 several source files, use the name of the file containing the string
1720 <code>STANDARD20_MODULE_STUFF</code>.</p>
1722 <p><directive type="section">IfModule</directive> sections are
1723 nest-able, which can be used to implement simple multiple-module
1726 <note>This section should only be used if you need to have one
1727 configuration file that works whether or not a specific module
1728 is available. In normal operation, directives need not be
1729 placed in <directive type="section">IfModule</directive>
1732 </directivesynopsis>
1735 <name>Include</name>
1736 <description>Includes other configuration files from within
1737 the server configuration files</description>
1738 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1739 <contextlist><context>server config</context><context>virtual host</context>
1740 <context>directory</context>
1742 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1743 wildcard matching available in 2.3.6 and later</compatibility>
1746 <p>This directive allows inclusion of other configuration files
1747 from within the server configuration files.</p>
1749 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1750 in the filename or directory parts of the path to include several files
1751 at once, in alphabetical order. In addition, if
1752 <directive>Include</directive> points to a directory, rather than a file,
1753 Apache httpd will read all files in that directory and any subdirectory.
1754 However, including entire directories is not recommended, because it is
1755 easy to accidentally leave temporary files in a directory that can cause
1756 <program>httpd</program> to fail. Instead, we encourage you to use the
1757 wildcard syntax shown below, to include files that match a particular
1758 pattern, such as *.conf, for example.</p>
1760 <p>When a wildcard is specified for a <strong>file</strong> component of
1761 the path, and no file matches the wildcard, the
1762 <directive module="core">Include</directive>
1763 directive will be <strong>silently ignored</strong>. When a wildcard is
1764 specified for a <strong>directory</strong> component of the path, and
1765 no directory matches the wildcard, the
1766 <directive module="core">Include</directive> directive will
1767 <strong>fail with an error</strong> saying the directory cannot be found.
1770 <p>For further control over the behaviour of the server when no files or
1771 directories match, prefix the path with the modifiers <var>optional</var>
1772 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1773 file or directory that does not match will be silently ignored. If
1774 <var>strict</var> is specified, any wildcard file or directory that does
1775 not match at least one file will cause server startup to fail.</p>
1777 <p>When a directory or file component of the path is
1778 specified exactly, and that directory or file does not exist,
1779 <directive module="core">Include</directive> directive will fail with an
1780 error saying the file or directory cannot be found.</p>
1782 <p>The file path specified may be an absolute path, or may be relative
1783 to the <directive module="core">ServerRoot</directive> directory.</p>
1788 Include /usr/local/apache2/conf/ssl.conf<br />
1789 Include /usr/local/apache2/conf/vhosts/*.conf
1792 <p>Or, providing paths relative to your <directive
1793 module="core">ServerRoot</directive> directory:</p>
1796 Include conf/ssl.conf<br />
1797 Include conf/vhosts/*.conf
1800 <p>Wildcards may be included in the directory or file portion of the
1801 path. In the following example, the server will fail to load if no
1802 directories match conf/vhosts/*, but will load successfully if no
1803 files match *.conf.</p>
1806 Include conf/vhosts/*/vhost.conf<br />
1807 Include conf/vhosts/*/*.conf
1810 <p>In this example, the server will fail to load if either
1811 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1814 Include strict conf/vhosts/*/*.conf
1817 <p>In this example, the server load successfully if either conf/vhosts/*
1818 matches no directories, or if *.conf matches no files:</p>
1821 Include optional conf/vhosts/*/*.conf
1826 <seealso><program>apachectl</program></seealso>
1827 </directivesynopsis>
1830 <name>KeepAlive</name>
1831 <description>Enables HTTP persistent connections</description>
1832 <syntax>KeepAlive On|Off</syntax>
1833 <default>KeepAlive On</default>
1834 <contextlist><context>server config</context><context>virtual host</context>
1838 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1839 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1840 which allow multiple requests to be sent over the same TCP
1841 connection. In some cases this has been shown to result in an
1842 almost 50% speedup in latency times for HTML documents with
1843 many images. To enable Keep-Alive connections, set
1844 <code>KeepAlive On</code>.</p>
1846 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1847 used if they are specifically requested by a client. In
1848 addition, a Keep-Alive connection with an HTTP/1.0 client can
1849 only be used when the length of the content is known in
1850 advance. This implies that dynamic content such as CGI output,
1851 SSI pages, and server-generated directory listings will
1852 generally not use Keep-Alive connections to HTTP/1.0 clients.
1853 For HTTP/1.1 clients, persistent connections are the default
1854 unless otherwise specified. If the client requests it, chunked
1855 encoding will be used in order to send content of unknown
1856 length over persistent connections.</p>
1858 <p>When a client uses a Keep-Alive connection it will be counted
1859 as a single "request" for the <directive module="mpm_common"
1860 >MaxConnectionsPerChild</directive> directive, regardless
1861 of how many requests are sent using the connection.</p>
1864 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1865 </directivesynopsis>
1868 <name>KeepAliveTimeout</name>
1869 <description>Amount of time the server will wait for subsequent
1870 requests on a persistent connection</description>
1871 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1872 <default>KeepAliveTimeout 5</default>
1873 <contextlist><context>server config</context><context>virtual host</context>
1875 <compatibility>Specifying a value in milliseconds is available in
1876 Apache httpd 2.3.2 and later</compatibility>
1879 <p>The number of seconds Apache httpd will wait for a subsequent
1880 request before closing the connection. By adding a postfix of ms the
1881 timeout can be also set in milliseconds. Once a request has been
1882 received, the timeout value specified by the
1883 <directive module="core">Timeout</directive> directive applies.</p>
1885 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1886 may cause performance problems in heavily loaded servers. The
1887 higher the timeout, the more server processes will be kept
1888 occupied waiting on connections with idle clients.</p>
1890 <p>In a name-based virtual host context, the value of the first
1891 defined virtual host (the default host) in a set of <directive
1892 module="core">NameVirtualHost</directive> will be used.
1893 The other values will be ignored.</p>
1895 </directivesynopsis>
1897 <directivesynopsis type="section">
1899 <description>Restrict enclosed access controls to only certain HTTP
1900 methods</description>
1901 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1902 </Limit></syntax>
1903 <contextlist><context>directory</context><context>.htaccess</context>
1905 <override>AuthConfig, Limit</override>
1908 <p>Access controls are normally effective for
1909 <strong>all</strong> access methods, and this is the usual
1910 desired behavior. <strong>In the general case, access control
1911 directives should not be placed within a
1912 <directive type="section">Limit</directive> section.</strong></p>
1914 <p>The purpose of the <directive type="section">Limit</directive>
1915 directive is to restrict the effect of the access controls to the
1916 nominated HTTP methods. For all other methods, the access
1917 restrictions that are enclosed in the <directive
1918 type="section">Limit</directive> bracket <strong>will have no
1919 effect</strong>. The following example applies the access control
1920 only to the methods <code>POST</code>, <code>PUT</code>, and
1921 <code>DELETE</code>, leaving all other methods unprotected:</p>
1924 <Limit POST PUT DELETE><br />
1926 Require valid-user<br />
1931 <p>The method names listed can be one or more of: <code>GET</code>,
1932 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1933 <code>CONNECT</code>, <code>OPTIONS</code>,
1934 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1935 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1936 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1937 case-sensitive.</strong> If <code>GET</code> is used it will also
1938 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1939 cannot be limited (see <directive module="core"
1940 >TraceEnable</directive>).</p>
1942 <note type="warning">A <directive type="section"
1943 module="core">LimitExcept</directive> section should always be
1944 used in preference to a <directive type="section">Limit</directive>
1945 section when restricting access, since a <directive type="section"
1946 module="core">LimitExcept</directive> section provides protection
1947 against arbitrary methods.</note>
1949 <p>The <directive type="section">Limit</directive> and
1950 <directive type="section" module="core">LimitExcept</directive>
1951 directives may be nested. In this case, each successive level of
1952 <directive type="section">Limit</directive> or <directive
1953 type="section" module="core">LimitExcept</directive> directives must
1954 further restrict the set of methods to which access controls apply.</p>
1956 <note type="warning">When using
1957 <directive type="section">Limit</directive> or
1958 <directive type="section">LimitExcept</directive> directives with
1959 the <directive module="mod_authz_core">Require</directive> directive,
1960 note that the first <directive module="mod_authz_core">Require</directive>
1961 to succeed authorizes the request, regardless of the presence of other
1962 <directive module="mod_authz_core">Require</directive> directives.</note>
1964 <p>For example, given the following configuration, all users will
1965 be authorized for <code>POST</code> requests, and the
1966 <code>Require group editors</code> directive will be ignored
1970 <LimitExcept GET>
1974 </LimitExcept><br />
1977 Require group editors
1982 </directivesynopsis>
1984 <directivesynopsis type="section">
1985 <name>LimitExcept</name>
1986 <description>Restrict access controls to all HTTP methods
1987 except the named ones</description>
1988 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1989 </LimitExcept></syntax>
1990 <contextlist><context>directory</context><context>.htaccess</context>
1992 <override>AuthConfig, Limit</override>
1995 <p><directive type="section">LimitExcept</directive> and
1996 <code></LimitExcept></code> are used to enclose
1997 a group of access control directives which will then apply to any
1998 HTTP access method <strong>not</strong> listed in the arguments;
1999 i.e., it is the opposite of a <directive type="section"
2000 module="core">Limit</directive> section and can be used to control
2001 both standard and nonstandard/unrecognized methods. See the
2002 documentation for <directive module="core"
2003 type="section">Limit</directive> for more details.</p>
2008 <LimitExcept POST GET><br />
2010 Require valid-user<br />
2012 </LimitExcept>
2016 </directivesynopsis>
2019 <name>LimitInternalRecursion</name>
2020 <description>Determine maximum number of internal redirects and nested
2021 subrequests</description>
2022 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2023 <default>LimitInternalRecursion 10</default>
2024 <contextlist><context>server config</context><context>virtual host</context>
2026 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
2029 <p>An internal redirect happens, for example, when using the <directive
2030 module="mod_actions">Action</directive> directive, which internally
2031 redirects the original request to a CGI script. A subrequest is Apache httpd's
2032 mechanism to find out what would happen for some URI if it were requested.
2033 For example, <module>mod_dir</module> uses subrequests to look for the
2034 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2037 <p><directive>LimitInternalRecursion</directive> prevents the server
2038 from crashing when entering an infinite loop of internal redirects or
2039 subrequests. Such loops are usually caused by misconfigurations.</p>
2041 <p>The directive stores two different limits, which are evaluated on
2042 per-request basis. The first <var>number</var> is the maximum number of
2043 internal redirects, that may follow each other. The second <var>number</var>
2044 determines, how deep subrequests may be nested. If you specify only one
2045 <var>number</var>, it will be assigned to both limits.</p>
2047 <example><title>Example</title>
2048 LimitInternalRecursion 5
2051 </directivesynopsis>
2054 <name>LimitRequestBody</name>
2055 <description>Restricts the total size of the HTTP request body sent
2056 from the client</description>
2057 <syntax>LimitRequestBody <var>bytes</var></syntax>
2058 <default>LimitRequestBody 0</default>
2059 <contextlist><context>server config</context><context>virtual host</context>
2060 <context>directory</context><context>.htaccess</context>
2062 <override>All</override>
2065 <p>This directive specifies the number of <var>bytes</var> from 0
2066 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2067 request body. See the note below for the limited applicability
2068 to proxy requests.</p>
2070 <p>The <directive>LimitRequestBody</directive> directive allows
2071 the user to set a limit on the allowed size of an HTTP request
2072 message body within the context in which the directive is given
2073 (server, per-directory, per-file or per-location). If the client
2074 request exceeds that limit, the server will return an error
2075 response instead of servicing the request. The size of a normal
2076 request message body will vary greatly depending on the nature of
2077 the resource and the methods allowed on that resource. CGI scripts
2078 typically use the message body for retrieving form information.
2079 Implementations of the <code>PUT</code> method will require
2080 a value at least as large as any representation that the server
2081 wishes to accept for that resource.</p>
2083 <p>This directive gives the server administrator greater
2084 control over abnormal client request behavior, which may be
2085 useful for avoiding some forms of denial-of-service
2088 <p>If, for example, you are permitting file upload to a particular
2089 location, and wish to limit the size of the uploaded file to 100K,
2090 you might use the following directive:</p>
2093 LimitRequestBody 102400
2096 <note><p>For a full description of how this directive is interpreted by
2097 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2101 </directivesynopsis>
2104 <name>LimitRequestFields</name>
2105 <description>Limits the number of HTTP request header fields that
2106 will be accepted from the client</description>
2107 <syntax>LimitRequestFields <var>number</var></syntax>
2108 <default>LimitRequestFields 100</default>
2109 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2112 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2113 32767. The default value is defined by the compile-time
2114 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2117 <p>The <directive>LimitRequestFields</directive> directive allows
2118 the server administrator to modify the limit on the number of
2119 request header fields allowed in an HTTP request. A server needs
2120 this value to be larger than the number of fields that a normal
2121 client request might include. The number of request header fields
2122 used by a client rarely exceeds 20, but this may vary among
2123 different client implementations, often depending upon the extent
2124 to which a user has configured their browser to support detailed
2125 content negotiation. Optional HTTP extensions are often expressed
2126 using request header fields.</p>
2128 <p>This directive gives the server administrator greater
2129 control over abnormal client request behavior, which may be
2130 useful for avoiding some forms of denial-of-service attacks.
2131 The value should be increased if normal clients see an error
2132 response from the server that indicates too many fields were
2133 sent in the request.</p>
2138 LimitRequestFields 50
2141 <note type="warning"><title>Warning</title>
2142 <p> When name-based virtual hosting is used, the value for this
2143 directive is taken from the default (first-listed) virtual host for the
2144 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2148 </directivesynopsis>
2151 <name>LimitRequestFieldSize</name>
2152 <description>Limits the size of the HTTP request header allowed from the
2153 client</description>
2154 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2155 <default>LimitRequestFieldSize 8190</default>
2156 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2159 <p>This directive specifies the number of <var>bytes</var>
2160 that will be allowed in an HTTP request header.</p>
2162 <p>The <directive>LimitRequestFieldSize</directive> directive
2163 allows the server administrator to reduce or increase the limit
2164 on the allowed size of an HTTP request header field. A server
2165 needs this value to be large enough to hold any one header field
2166 from a normal client request. The size of a normal request header
2167 field will vary greatly among different client implementations,
2168 often depending upon the extent to which a user has configured
2169 their browser to support detailed content negotiation. SPNEGO
2170 authentication headers can be up to 12392 bytes.</p>
2172 <p>This directive gives the server administrator greater
2173 control over abnormal client request behavior, which may be
2174 useful for avoiding some forms of denial-of-service attacks.</p>
2179 LimitRequestFieldSize 4094
2182 <note>Under normal conditions, the value should not be changed from
2185 <note type="warning"><title>Warning</title>
2186 <p> When name-based virtual hosting is used, the value for this
2187 directive is taken from the default (first-listed) virtual host for the
2188 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2192 </directivesynopsis>
2195 <name>LimitRequestLine</name>
2196 <description>Limit the size of the HTTP request line that will be accepted
2197 from the client</description>
2198 <syntax>LimitRequestLine <var>bytes</var></syntax>
2199 <default>LimitRequestLine 8190</default>
2200 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2203 <p>This directive sets the number of <var>bytes</var> that will be
2204 allowed on the HTTP request-line.</p>
2206 <p>The <directive>LimitRequestLine</directive> directive allows
2207 the server administrator to reduce or increase the limit on the allowed size
2208 of a client's HTTP request-line. Since the request-line consists of the
2209 HTTP method, URI, and protocol version, the
2210 <directive>LimitRequestLine</directive> directive places a
2211 restriction on the length of a request-URI allowed for a request
2212 on the server. A server needs this value to be large enough to
2213 hold any of its resource names, including any information that
2214 might be passed in the query part of a <code>GET</code> request.</p>
2216 <p>This directive gives the server administrator greater
2217 control over abnormal client request behavior, which may be
2218 useful for avoiding some forms of denial-of-service attacks.</p>
2223 LimitRequestLine 4094
2226 <note>Under normal conditions, the value should not be changed from
2229 <note type="warning"><title>Warning</title>
2230 <p> When name-based virtual hosting is used, the value for this
2231 directive is taken from the default (first-listed) virtual host for the
2232 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2236 </directivesynopsis>
2239 <name>LimitXMLRequestBody</name>
2240 <description>Limits the size of an XML-based request body</description>
2241 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2242 <default>LimitXMLRequestBody 1000000</default>
2243 <contextlist><context>server config</context><context>virtual host</context>
2244 <context>directory</context><context>.htaccess</context></contextlist>
2245 <override>All</override>
2248 <p>Limit (in bytes) on maximum size of an XML-based request
2249 body. A value of <code>0</code> will disable any checking.</p>
2254 LimitXMLRequestBody 0
2258 </directivesynopsis>
2260 <directivesynopsis type="section">
2261 <name>Location</name>
2262 <description>Applies the enclosed directives only to matching
2264 <syntax><Location
2265 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2266 <contextlist><context>server config</context><context>virtual host</context>
2270 <p>The <directive type="section">Location</directive> directive
2271 limits the scope of the enclosed directives by URL. It is similar to the
2272 <directive type="section" module="core">Directory</directive>
2273 directive, and starts a subsection which is terminated with a
2274 <code></Location></code> directive. <directive
2275 type="section">Location</directive> sections are processed in the
2276 order they appear in the configuration file, after the <directive
2277 type="section" module="core">Directory</directive> sections and
2278 <code>.htaccess</code> files are read, and after the <directive
2279 type="section" module="core">Files</directive> sections.</p>
2281 <p><directive type="section">Location</directive> sections operate
2282 completely outside the filesystem. This has several consequences.
2283 Most importantly, <directive type="section">Location</directive>
2284 directives should not be used to control access to filesystem
2285 locations. Since several different URLs may map to the same
2286 filesystem location, such access controls may by circumvented.</p>
2288 <p>The enclosed directives will be applied to the request if the path component
2289 of the URL meets <em>any</em> of the following criteria:
2292 <li>The specified location matches exactly the path component of the URL.
2294 <li>The specified location, which ends in a forward slash, is a prefix
2295 of the path component of the URL (treated as a context root).
2297 <li>The specified location, with the addition of a trailing slash, is a
2298 prefix of the path component of the URL (also treated as a context root).
2302 In the example below, where no trailing slash is used, requests to
2303 /private1, /private1/ and /private1/file.txt will have the enclosed
2304 directives applied, but /private1other would not.
2307 <Location /private1>
2311 In the example below, where a trailing slash is used, requests to
2312 /private2/ and /private2/file.txt will have the enclosed
2313 directives applied, but /private2 and /private2other would not.
2316 <Location /private2<em>/</em>>
2320 <note><title>When to use <directive
2321 type="section">Location</directive></title>
2323 <p>Use <directive type="section">Location</directive> to apply
2324 directives to content that lives outside the filesystem. For
2325 content that lives in the filesystem, use <directive
2326 type="section" module="core">Directory</directive> and <directive
2327 type="section" module="core">Files</directive>. An exception is
2328 <code><Location /></code>, which is an easy way to
2329 apply a configuration to the entire server.</p>
2332 <p>For all origin (non-proxy) requests, the URL to be matched is a
2333 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2334 port, or query string may be included.</em> For proxy requests, the
2335 URL to be matched is of the form
2336 <code>scheme://servername/path</code>, and you must include the
2339 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2340 any single character, and <code>*</code> matches any sequences of
2341 characters. Neither wildcard character matches a / in the URL-path.</p>
2343 <p><glossary ref="regex">Regular expressions</glossary>
2344 can also be used, with the addition of the <code>~</code>
2345 character. For example:</p>
2348 <Location ~ "/(extra|special)/data">
2351 <p>would match URLs that contained the substring <code>/extra/data</code>
2352 or <code>/special/data</code>. The directive <directive
2353 type="section" module="core">LocationMatch</directive> behaves
2354 identical to the regex version of <directive
2355 type="section">Location</directive>, and is preferred, for the
2356 simple reason that <code>~</code> is hard to distinguish from
2357 <code>-</code> in many fonts.</p>
2359 <p>The <directive type="section">Location</directive>
2360 functionality is especially useful when combined with the
2361 <directive module="core">SetHandler</directive>
2362 directive. For example, to enable status requests, but allow them
2363 only from browsers at <code>example.com</code>, you might use:</p>
2366 <Location /status><br />
2368 SetHandler server-status<br />
2369 Require host example.com<br />
2374 <note><title>Note about / (slash)</title>
2375 <p>The slash character has special meaning depending on where in a
2376 URL it appears. People may be used to its behavior in the filesystem
2377 where multiple adjacent slashes are frequently collapsed to a single
2378 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2379 <code>/home/foo</code>). In URL-space this is not necessarily true.
2380 The <directive type="section" module="core">LocationMatch</directive>
2381 directive and the regex version of <directive type="section"
2382 >Location</directive> require you to explicitly specify multiple
2383 slashes if that is your intention.</p>
2385 <p>For example, <code><LocationMatch ^/abc></code> would match
2386 the request URL <code>/abc</code> but not the request URL <code>
2387 //abc</code>. The (non-regex) <directive type="section"
2388 >Location</directive> directive behaves similarly when used for
2389 proxy requests. But when (non-regex) <directive type="section"
2390 >Location</directive> is used for non-proxy requests it will
2391 implicitly match multiple slashes with a single slash. For example,
2392 if you specify <code><Location /abc/def></code> and the
2393 request is to <code>/abc//def</code> then it will match.</p>
2396 <seealso><a href="../sections.html">How <Directory>, <Location>
2397 and <Files> sections work</a> for an explanation of how these
2398 different sections are combined when a request is received.</seealso>
2399 <seealso><directive module="core">LocationMatch</directive></seealso>
2400 </directivesynopsis>
2402 <directivesynopsis type="section">
2403 <name>LocationMatch</name>
2404 <description>Applies the enclosed directives only to regular-expression
2405 matching URLs</description>
2406 <syntax><LocationMatch
2407 <var>regex</var>> ... </LocationMatch></syntax>
2408 <contextlist><context>server config</context><context>virtual host</context>
2412 <p>The <directive type="section">LocationMatch</directive> directive
2413 limits the scope of the enclosed directives by URL, in an identical manner
2414 to <directive module="core" type="section">Location</directive>. However,
2415 it takes a <glossary ref="regex">regular expression</glossary>
2416 as an argument instead of a simple string. For example:</p>
2419 <LocationMatch "/(extra|special)/data">
2422 <p>would match URLs that contained the substring <code>/extra/data</code>
2423 or <code>/special/data</code>.</p>
2426 <seealso><a href="../sections.html">How <Directory>, <Location>
2427 and <Files> sections work</a> for an explanation of how these
2428 different sections are combined when a request is received</seealso>
2429 </directivesynopsis>
2432 <name>LogLevel</name>
2433 <description>Controls the verbosity of the ErrorLog</description>
2434 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2435 [<var>module</var>:<var>level</var>] ...
2437 <default>LogLevel warn</default>
2438 <contextlist><context>server config</context><context>virtual host</context>
2439 <context>directory</context>
2441 <compatibility>Per-module and per-directory configuration is available in
2442 Apache HTTP Server 2.3.6 and later</compatibility>
2445 <p><directive>LogLevel</directive> adjusts the verbosity of the
2446 messages recorded in the error logs (see <directive
2447 module="core">ErrorLog</directive> directive). The following
2448 <var>level</var>s are available, in order of decreasing
2452 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2455 <th><strong>Level</strong> </th>
2457 <th><strong>Description</strong> </th>
2459 <th><strong>Example</strong> </th>
2463 <td><code>emerg</code> </td>
2465 <td>Emergencies - system is unusable.</td>
2467 <td>"Child cannot open lock file. Exiting"</td>
2471 <td><code>alert</code> </td>
2473 <td>Action must be taken immediately.</td>
2475 <td>"getpwuid: couldn't determine user name from uid"</td>
2479 <td><code>crit</code> </td>
2481 <td>Critical Conditions.</td>
2483 <td>"socket: Failed to get a socket, exiting child"</td>
2487 <td><code>error</code> </td>
2489 <td>Error conditions.</td>
2491 <td>"Premature end of script headers"</td>
2495 <td><code>warn</code> </td>
2497 <td>Warning conditions.</td>
2499 <td>"child process 1234 did not exit, sending another
2504 <td><code>notice</code> </td>
2506 <td>Normal but significant condition.</td>
2508 <td>"httpd: caught SIGBUS, attempting to dump core in
2513 <td><code>info</code> </td>
2515 <td>Informational.</td>
2517 <td>"Server seems busy, (you may need to increase
2518 StartServers, or Min/MaxSpareServers)..."</td>
2522 <td><code>debug</code> </td>
2524 <td>Debug-level messages</td>
2526 <td>"Opening config file ..."</td>
2529 <td><code>trace1</code> </td>
2531 <td>Trace messages</td>
2533 <td>"proxy: FTP: control connection complete"</td>
2536 <td><code>trace2</code> </td>
2538 <td>Trace messages</td>
2540 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2543 <td><code>trace3</code> </td>
2545 <td>Trace messages</td>
2547 <td>"openssl: Handshake: start"</td>
2550 <td><code>trace4</code> </td>
2552 <td>Trace messages</td>
2554 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2557 <td><code>trace5</code> </td>
2559 <td>Trace messages</td>
2561 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2564 <td><code>trace6</code> </td>
2566 <td>Trace messages</td>
2568 <td>"cache lookup FAILED, forcing new map lookup"</td>
2571 <td><code>trace7</code> </td>
2573 <td>Trace messages, dumping large amounts of data</td>
2575 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2578 <td><code>trace8</code> </td>
2580 <td>Trace messages, dumping large amounts of data</td>
2582 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2586 <p>When a particular level is specified, messages from all
2587 other levels of higher significance will be reported as well.
2588 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2589 then messages with log levels of <code>notice</code> and
2590 <code>warn</code> will also be posted.</p>
2592 <p>Using a level of at least <code>crit</code> is
2601 <note><title>Note</title>
2602 <p>When logging to a regular file messages of the level
2603 <code>notice</code> cannot be suppressed and thus are always
2604 logged. However, this doesn't apply when logging is done
2605 using <code>syslog</code>.</p>
2608 <p>Specifying a level without a module name will reset the level
2609 for all modules to that level. Specifying a level with a module
2610 name will set the level for that module only. It is possible to
2611 use the module source file name, the module identifier, or the
2612 module identifier with the trailing <code>_module</code> omitted
2613 as module specification. This means the following three specifications
2617 LogLevel info ssl:warn<br />
2618 LogLevel info mod_ssl.c:warn<br />
2619 LogLevel info ssl_module:warn<br />
2622 <p>It is also possible to change the level per directory:</p>
2626 <Directory /usr/local/apache/htdocs/app><br />
2627 LogLevel debug<br />
2632 Per directory loglevel configuration only affects messages that are
2633 logged after the request has been parsed and that are associated with
2634 the request. Log messages which are associated with the connection or
2635 the server are not affected.
2638 </directivesynopsis>
2641 <name>MaxKeepAliveRequests</name>
2642 <description>Number of requests allowed on a persistent
2643 connection</description>
2644 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2645 <default>MaxKeepAliveRequests 100</default>
2646 <contextlist><context>server config</context><context>virtual host</context>
2650 <p>The <directive>MaxKeepAliveRequests</directive> directive
2651 limits the number of requests allowed per connection when
2652 <directive module="core" >KeepAlive</directive> is on. If it is
2653 set to <code>0</code>, unlimited requests will be allowed. We
2654 recommend that this setting be kept to a high value for maximum
2655 server performance.</p>
2660 MaxKeepAliveRequests 500
2663 </directivesynopsis>
2667 <description>Configures mutex mechanism and lock file directory for all
2668 or specified mutexes</description>
2669 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2670 <default>Mutex default</default>
2671 <contextlist><context>server config</context></contextlist>
2672 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2675 <p>The <directive>Mutex</directive> directive sets the mechanism,
2676 and optionally the lock file location, that httpd and modules use
2677 to serialize access to resources. Specify <code>default</code> as
2678 the first argument to change the settings for all mutexes; specify
2679 a mutex name (see table below) as the first argument to override
2680 defaults only for that mutex.</p>
2682 <p>The <directive>Mutex</directive> directive is typically used in
2683 the following exceptional situations:</p>
2686 <li>change the mutex mechanism when the default mechanism selected
2687 by <glossary>APR</glossary> has a functional or performance
2690 <li>change the directory used by file-based mutexes when the
2691 default directory does not support locking</li>
2694 <note><title>Supported modules</title>
2695 <p>This directive only configures mutexes which have been registered
2696 with the core server using the <code>ap_mutex_register()</code> API.
2697 All modules bundled with httpd support the <directive>Mutex</directive>
2698 directive, but third-party modules may not. Consult the documentation
2699 of the third-party module, which must indicate the mutex name(s) which
2700 can be configured if this directive is supported.</p>
2703 <p>The following mutex <em>mechanisms</em> are available:</p>
2705 <li><code>default | yes</code>
2706 <p>This selects the default locking implementation, as determined by
2707 <glossary>APR</glossary>. The default locking implementation can
2708 be displayed by running <program>httpd</program> with the
2709 <code>-V</code> option.</p></li>
2711 <li><code>none | no</code>
2712 <p>This effectively disables the mutex, and is only allowed for a
2713 mutex if the module indicates that it is a valid choice. Consult the
2714 module documentation for more information.</p></li>
2716 <li><code>posixsem</code>
2717 <p>This is a mutex variant based on a Posix semaphore.</p>
2719 <note type="warning"><title>Warning</title>
2720 <p>The semaphore ownership is not recovered if a thread in the process
2721 holding the mutex segfaults, resulting in a hang of the web server.</p>
2725 <li><code>sysvsem</code>
2726 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2728 <note type="warning"><title>Warning</title>
2729 <p>It is possible to "leak" SysV semaphores if processes crash
2730 before the semaphore is removed.</p>
2733 <note type="warning"><title>Security</title>
2734 <p>The semaphore API allows for a denial of service attack by any
2735 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2736 all CGIs, unless you use something like <program>suexec</program>
2737 or <code>cgiwrapper</code>).</p>
2741 <li><code>sem</code>
2742 <p>This selects the "best" available semaphore implementation, choosing
2743 between Posix and SystemV IPC semaphores, in that order.</p></li>
2745 <li><code>pthread</code>
2746 <p>This is a mutex variant based on cross-process Posix thread
2749 <note type="warning"><title>Warning</title>
2750 <p>On most systems, if a child process terminates abnormally while
2751 holding a mutex that uses this implementation, the server will deadlock
2752 and stop responding to requests. When this occurs, the server will
2753 require a manual restart to recover.</p>
2754 <p>Solaris is a notable exception as it provides a mechanism which
2755 usually allows the mutex to be recovered after a child process
2756 terminates abnormally while holding a mutex.</p>
2757 <p>If your system implements the
2758 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2759 to use the <code>pthread</code> option safely.</p>
2763 <li><code>fcntl:/path/to/mutex</code>
2764 <p>This is a mutex variant where a physical (lock-)file and the
2765 <code>fcntl()</code> function are used as the mutex.</p>
2767 <note type="warning"><title>Warning</title>
2768 <p>When multiple mutexes based on this mechanism are used within
2769 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2770 can be reported for valid mutex operations if <code>fcntl()</code>
2771 is not thread-aware, such as on Solaris.</p>
2775 <li><code>flock:/path/to/mutex</code>
2776 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2777 with the exception that the <code>flock()</code> function is used to
2778 provide file locking.</p></li>
2780 <li><code>file:/path/to/mutex</code>
2781 <p>This selects the "best" available file locking implementation,
2782 choosing between <code>fcntl</code> and <code>flock</code>, in that
2786 <p>Most mechanisms are only available on selected platforms, where the
2787 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2788 which aren't available on all platforms are <em>posixsem</em>,
2789 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2790 <em>flock</em>, and <em>file</em>.</p>
2792 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2793 the path, if provided, is a directory where the lock file will be created.
2794 The default directory is httpd's run-time file directory relative to
2795 <directive module="core">ServerRoot</directive>. Always use a local disk
2796 filesystem for <code>/path/to/mutex</code> and never a directory residing
2797 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2798 type, an optional instance string provided by the module, and unless the
2799 <code>OmitPID</code> keyword is specified, the process id of the httpd
2800 parent process will be appended to to make the file name unique, avoiding
2801 conflicts when multiple httpd instances share a lock file directory. For
2802 example, if the mutex name is <code>mpm-accept</code> and the lock file
2803 directory is <code>/var/httpd/locks</code>, the lock file name for the
2804 httpd instance with parent process id 12345 would be
2805 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2807 <note type="warning"><title>Security</title>
2808 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2809 directory such as <code>/var/tmp</code> because someone could create
2810 a denial of service attack and prevent the server from starting by
2811 creating a lockfile with the same name as the one the server will try
2815 <p>The following table documents the names of mutexes used by httpd
2816 and bundled modules.</p>
2818 <table border="1" style="zebra">
2822 <th>Protected resource</th>
2825 <td><code>mpm-accept</code></td>
2826 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2827 <td>incoming connections, to avoid the thundering herd problem;
2828 for more information, refer to the
2829 <a href="../misc/perf-tuning.html">performance tuning</a>
2833 <td><code>authdigest-client</code></td>
2834 <td><module>mod_auth_digest</module></td>
2835 <td>client list in shared memory</td>
2838 <td><code>authdigest-opaque</code></td>
2839 <td><module>mod_auth_digest</module></td>
2840 <td>counter in shared memory</td>
2843 <td><code>ldap-cache</code></td>
2844 <td><module>mod_ldap</module></td>
2845 <td>LDAP result cache</td>
2848 <td><code>rewrite-map</code></td>
2849 <td><module>mod_rewrite</module></td>
2850 <td>communication with external mapping programs, to avoid
2851 intermixed I/O from multiple requests</td>
2854 <td><code>ssl-cache</code></td>
2855 <td><module>mod_ssl</module></td>
2856 <td>SSL session cache</td>
2859 <td><code>ssl-stapling</code></td>
2860 <td><module>mod_ssl</module></td>
2861 <td>OCSP stapling response cache</td>
2864 <td><code>watchdog-callback</code></td>
2865 <td><module>mod_watchdog</module></td>
2866 <td>callback function of a particular client module</td>
2870 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2871 parent process id from the lock file name.</p>
2873 <p>In the following example, the mutex mechanism for the MPM accept
2874 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2875 with the associated lock file created in directory
2876 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2877 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2880 Mutex default sysvsem<br />
2881 Mutex mpm-accept fcntl:/var/httpd/locks
2884 </directivesynopsis>
2887 <name>NameVirtualHost</name>
2888 <description>Designates an IP address for name-virtual
2889 hosting</description>
2890 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2891 <contextlist><context>server config</context></contextlist>
2895 <p>A single <directive>NameVirtualHost</directive> directive
2896 identifies a set of identical virtual hosts on which the server will
2897 further select from on the basis of the <em>hostname</em>
2898 requested by the client. The <directive>NameVirtualHost</directive>
2899 directive is a required directive if you want to configure
2900 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2902 <p>This directive, and the corresponding <directive >VirtualHost</directive>,
2903 <em>must</em> be qualified with a port number if the server supports both HTTP
2904 and HTTPS connections.</p>
2906 <p>Although <var>addr</var> can be a hostname, it is recommended
2907 that you always use an IP address or a wildcard. A wildcard
2908 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2909 as their argument.</p>
2911 <p>In cases where a firewall or other proxy receives the requests and
2912 forwards them on a different IP address to the server, you must specify the
2913 IP address of the physical interface on the machine which will be
2914 servicing the requests. </p>
2916 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2917 will only select among the first two virtual hosts. Requests received on
2918 port 80 on any other interface will only select among the third and fourth
2919 virtual hosts. In the common case where the interface isn't important
2920 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2924 NameVirtualHost 192.0.2.1:80<br />
2925 NameVirtualHost *:80<br /><br />
2927 <VirtualHost 192.0.2.1:80><br />
2928 ServerName namebased-a.example.com<br />
2929 </VirtualHost><br />
2931 <VirtualHost 192.0.2.1:80><br />
2932 Servername namebased-b.example.com<br />
2933 </VirtualHost><br />
2935 <VirtualHost *:80><br />
2936 ServerName namebased-c.example.com <br />
2937 </VirtualHost><br />
2939 <VirtualHost *:80><br />
2940 ServerName namebased-d.example.com <br />
2941 </VirtualHost><br />
2946 <p>If no matching virtual host is found, then the first listed
2947 virtual host that matches the IP address and port will be used.</p>
2950 <p>IPv6 addresses must be enclosed in square brackets, as shown
2951 in the following example:</p>
2954 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2957 <note><title>Argument to <directive type="section">VirtualHost</directive>
2959 <p>Note that the argument to the <directive
2960 type="section">VirtualHost</directive> directive must
2961 exactly match the argument to the <directive
2962 >NameVirtualHost</directive> directive.</p>
2965 NameVirtualHost 192.0.2.2:80<br />
2966 <VirtualHost 192.0.2.2:80><br />
2968 </VirtualHost><br />
2973 <seealso><a href="../vhosts/">Virtual Hosts
2974 documentation</a></seealso>
2976 </directivesynopsis>
2979 <name>Options</name>
2980 <description>Configures what features are available in a particular
2981 directory</description>
2983 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2984 <default>Options All</default>
2985 <contextlist><context>server config</context><context>virtual host</context>
2986 <context>directory</context><context>.htaccess</context>
2988 <override>Options</override>
2991 <p>The <directive>Options</directive> directive controls which
2992 server features are available in a particular directory.</p>
2994 <p><var>option</var> can be set to <code>None</code>, in which
2995 case none of the extra features are enabled, or one or more of
2999 <dt><code>All</code></dt>
3001 <dd>All options except for <code>MultiViews</code>. This is the default
3004 <dt><code>ExecCGI</code></dt>
3007 Execution of CGI scripts using <module>mod_cgi</module>
3010 <dt><code>FollowSymLinks</code></dt>
3014 The server will follow symbolic links in this directory.
3016 <p>Even though the server follows the symlink it does <em>not</em>
3017 change the pathname used to match against <directive type="section"
3018 module="core">Directory</directive> sections.</p>
3019 <p>Note also, that this option <strong>gets ignored</strong> if set
3020 inside a <directive type="section" module="core">Location</directive>
3022 <p>Omitting this option should not be considered a security restriction,
3023 since symlink testing is subject to race conditions that make it
3027 <dt><code>Includes</code></dt>
3030 Server-side includes provided by <module>mod_include</module>
3033 <dt><code>IncludesNOEXEC</code></dt>
3037 Server-side includes are permitted, but the <code>#exec
3038 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3039 possible to <code>#include virtual</code> CGI scripts from
3040 <directive module="mod_alias">ScriptAlias</directive>ed
3043 <dt><code>Indexes</code></dt>
3046 If a URL which maps to a directory is requested, and there
3047 is no <directive module="mod_dir">DirectoryIndex</directive>
3048 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3049 <module>mod_autoindex</module> will return a formatted listing
3050 of the directory.</dd>
3052 <dt><code>MultiViews</code></dt>
3055 <a href="../content-negotiation.html">Content negotiated</a>
3056 "MultiViews" are allowed using
3057 <module>mod_negotiation</module>.
3058 <note><title>Note</title> <p>This option gets ignored if set
3059 anywhere other than <directive module="core" type="section"
3060 >Directory</directive>, as <module>mod_negotiation</module>
3061 needs real resources to compare against and evaluate from.</p></note>
3064 <dt><code>SymLinksIfOwnerMatch</code></dt>
3066 <dd>The server will only follow symbolic links for which the
3067 target file or directory is owned by the same user id as the
3070 <note><title>Note</title> <p>This option gets ignored if
3071 set inside a <directive module="core"
3072 type="section">Location</directive> section.</p>
3073 <p>This option should not be considered a security restriction,
3074 since symlink testing is subject to race conditions that make it
3075 circumventable.</p></note>
3079 <p>Normally, if multiple <directive>Options</directive> could
3080 apply to a directory, then the most specific one is used and
3081 others are ignored; the options are not merged. (See <a
3082 href="../sections.html#mergin">how sections are merged</a>.)
3083 However if <em>all</em> the options on the
3084 <directive>Options</directive> directive are preceded by a
3085 <code>+</code> or <code>-</code> symbol, the options are
3086 merged. Any options preceded by a <code>+</code> are added to the
3087 options currently in force, and any options preceded by a
3088 <code>-</code> are removed from the options currently in
3091 <note type="warning"><title>Warning</title>
3092 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3093 <code>-</code> with those without is not valid syntax, and is likely
3094 to cause unexpected results.</p>
3097 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3100 <Directory /web/docs><br />
3102 Options Indexes FollowSymLinks<br />
3104 </Directory><br />
3106 <Directory /web/docs/spec><br />
3108 Options Includes<br />
3113 <p>then only <code>Includes</code> will be set for the
3114 <code>/web/docs/spec</code> directory. However if the second
3115 <directive>Options</directive> directive uses the <code>+</code> and
3116 <code>-</code> symbols:</p>
3119 <Directory /web/docs><br />
3121 Options Indexes FollowSymLinks<br />
3123 </Directory><br />
3125 <Directory /web/docs/spec><br />
3127 Options +Includes -Indexes<br />
3132 <p>then the options <code>FollowSymLinks</code> and
3133 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3136 <note><title>Note</title>
3137 <p>Using <code>-IncludesNOEXEC</code> or
3138 <code>-Includes</code> disables server-side includes completely
3139 regardless of the previous setting.</p>
3142 <p>The default in the absence of any other settings is
3143 <code>All</code>.</p>
3145 </directivesynopsis>
3148 <name>Protocol</name>
3149 <description>Protocol for a listening socket</description>
3150 <syntax>Protocol <var>protocol</var></syntax>
3151 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3152 <compatibility>Available in Apache 2.1.5 and later.
3153 On Windows from Apache 2.3.3 and later.</compatibility>
3156 <p>This directive specifies the protocol used for a specific listening socket.
3157 The protocol is used to determine which module should handle a request, and
3158 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3161 <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>
3163 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3169 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3171 <seealso><directive>AcceptFilter</directive></seealso>
3172 <seealso><directive module="mpm_common">Listen</directive></seealso>
3173 </directivesynopsis>
3177 <name>RLimitCPU</name>
3178 <description>Limits the CPU consumption of processes launched
3179 by Apache httpd children</description>
3180 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3181 <default>Unset; uses operating system defaults</default>
3182 <contextlist><context>server config</context><context>virtual host</context>
3183 <context>directory</context><context>.htaccess</context></contextlist>
3184 <override>All</override>
3187 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3188 resource limit for all processes and the second parameter sets
3189 the maximum resource limit. Either parameter can be a number,
3190 or <code>max</code> to indicate to the server that the limit should
3191 be set to the maximum allowed by the operating system
3192 configuration. Raising the maximum resource limit requires that
3193 the server is running as <code>root</code>, or in the initial startup
3196 <p>This applies to processes forked off from Apache httpd children
3197 servicing requests, not the Apache httpd children themselves. This
3198 includes CGI scripts and SSI exec commands, but not any
3199 processes forked off from the Apache httpd parent such as piped
3202 <p>CPU resource limits are expressed in seconds per
3205 <seealso><directive module="core">RLimitMEM</directive></seealso>
3206 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3207 </directivesynopsis>
3210 <name>RLimitMEM</name>
3211 <description>Limits the memory consumption of processes launched
3212 by Apache httpd children</description>
3213 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3214 <default>Unset; uses operating system defaults</default>
3215 <contextlist><context>server config</context><context>virtual host</context>
3216 <context>directory</context><context>.htaccess</context></contextlist>
3217 <override>All</override>
3220 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3221 resource limit for all processes and the second parameter sets
3222 the maximum resource limit. Either parameter can be a number,
3223 or <code>max</code> to indicate to the server that the limit should
3224 be set to the maximum allowed by the operating system
3225 configuration. Raising the maximum resource limit requires that
3226 the server is running as <code>root</code>, or in the initial startup
3229 <p>This applies to processes forked off from Apache httpd children
3230 servicing requests, not the Apache httpd children themselves. This
3231 includes CGI scripts and SSI exec commands, but not any
3232 processes forked off from the Apache httpd parent such as piped
3235 <p>Memory resource limits are expressed in bytes per
3238 <seealso><directive module="core">RLimitCPU</directive></seealso>
3239 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3240 </directivesynopsis>
3243 <name>RLimitNPROC</name>
3244 <description>Limits the number of processes that can be launched by
3245 processes launched by Apache httpd children</description>
3246 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3247 <default>Unset; uses operating system defaults</default>
3248 <contextlist><context>server config</context><context>virtual host</context>
3249 <context>directory</context><context>.htaccess</context></contextlist>
3250 <override>All</override>
3253 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3254 resource limit for all processes and the second parameter sets
3255 the maximum resource limit. Either parameter can be a number,
3256 or <code>max</code> to indicate to the server that the limit
3257 should be set to the maximum allowed by the operating system
3258 configuration. Raising the maximum resource limit requires that
3259 the server is running as <code>root</code>, or in the initial startup
3262 <p>This applies to processes forked off from Apache httpd children
3263 servicing requests, not the Apache httpd children themselves. This
3264 includes CGI scripts and SSI exec commands, but not any
3265 processes forked off from the Apache httpd parent such as piped
3268 <p>Process limits control the number of processes per user.</p>
3270 <note><title>Note</title>
3271 <p>If CGI processes are <strong>not</strong> running
3272 under user ids other than the web server user id, this directive
3273 will limit the number of processes that the server itself can
3274 create. Evidence of this situation will be indicated by
3275 <strong><code>cannot fork</code></strong> messages in the
3276 <code>error_log</code>.</p>
3279 <seealso><directive module="core">RLimitMEM</directive></seealso>
3280 <seealso><directive module="core">RLimitCPU</directive></seealso>
3281 </directivesynopsis>
3284 <name>ScriptInterpreterSource</name>
3285 <description>Technique for locating the interpreter for CGI
3286 scripts</description>
3287 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3288 <default>ScriptInterpreterSource Script</default>
3289 <contextlist><context>server config</context><context>virtual host</context>
3290 <context>directory</context><context>.htaccess</context></contextlist>
3291 <override>FileInfo</override>
3292 <compatibility>Win32 only;
3293 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3294 later</compatibility>
3297 <p>This directive is used to control how Apache httpd finds the
3298 interpreter used to run CGI scripts. The default setting is
3299 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3300 by the shebang line (first line, starting with <code>#!</code>) in the
3301 script. On Win32 systems this line usually looks like:</p>
3304 #!C:/Perl/bin/perl.exe
3307 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3313 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3314 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3315 searched using the script file extension (e.g., <code>.pl</code>) as a
3316 search key. The command defined by the registry subkey
3317 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3318 <code>Shell\Open\Command</code> is used to open the script file. If the
3319 registry keys cannot be found, Apache httpd falls back to the behavior of the
3320 <code>Script</code> option.</p>
3322 <note type="warning"><title>Security</title>
3323 <p>Be careful when using <code>ScriptInterpreterSource
3324 Registry</code> with <directive
3325 module="mod_alias">ScriptAlias</directive>'ed directories, because
3326 Apache httpd will try to execute <strong>every</strong> file within this
3327 directory. The <code>Registry</code> setting may cause undesired
3328 program calls on files which are typically not executed. For
3329 example, the default open command on <code>.htm</code> files on
3330 most Windows systems will execute Microsoft Internet Explorer, so
3331 any HTTP request for an <code>.htm</code> file existing within the
3332 script directory would start the browser in the background on the
3333 server. This is a good way to crash your system within a minute or
3337 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3338 2.0 does the same thing as <code>Registry</code> but uses only the
3339 subkey <code>Shell\ExecCGI\Command</code>. The
3340 <code>ExecCGI</code> key is not a common one. It must be
3341 configured manually in the windows registry and hence prevents
3342 accidental program calls on your system.</p>
3344 </directivesynopsis>
3347 <name>SeeRequestTail</name>
3348 <description>Determine if mod_status displays the first 63 characters
3349 of a request or the last 63, assuming the request itself is greater than
3350 63 chars.</description>
3351 <syntax>SeeRequestTail On|Off</syntax>
3352 <default>SeeRequestTail Off</default>
3353 <contextlist><context>server config</context></contextlist>
3354 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3357 <p>mod_status with <code>ExtendedStatus On</code>
3358 displays the actual request being handled.
3359 For historical purposes, only 63 characters of the request
3360 are actually stored for display purposes. This directive
3361 controls whether the 1st 63 characters are stored (the previous
3362 behavior and the default) or if the last 63 characters are. This
3363 is only applicable, of course, if the length of the request is
3364 64 characters or greater.</p>
3366 <p>If Apache httpd is handling <code
3367 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3368 > mod_status displays as follows:
3373 <th>Off (default)</th>
3374 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3378 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3383 </directivesynopsis>
3386 <name>ServerAdmin</name>
3387 <description>Email address that the server includes in error
3388 messages sent to the client</description>
3389 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3390 <contextlist><context>server config</context><context>virtual host</context>
3394 <p>The <directive>ServerAdmin</directive> sets the contact address
3395 that the server includes in any error messages it returns to the
3396 client. If the <code>httpd</code> doesn't recognize the supplied argument
3398 assumes, that it's an <var>email-address</var> and prepends it with
3399 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3400 actually use an email address, since there are a lot of CGI scripts that
3401 make that assumption. If you want to use an URL, it should point to another
3402 server under your control. Otherwise users may not be able to contact you in
3405 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3408 ServerAdmin www-admin@foo.example.com
3410 <p>as users do not always mention that they are talking about the
3413 </directivesynopsis>
3416 <name>ServerAlias</name>
3417 <description>Alternate names for a host used when matching requests
3418 to name-virtual hosts</description>
3419 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3420 <contextlist><context>virtual host</context></contextlist>
3423 <p>The <directive>ServerAlias</directive> directive sets the
3424 alternate names for a host, for use with <a
3425 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3426 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3429 <VirtualHost *:80><br />
3430 ServerName server.example.com<br />
3431 ServerAlias server server2.example.com server2<br />
3432 ServerAlias *.example.com<br />
3433 UseCanonicalName Off<br />
3435 </VirtualHost>
3438 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3439 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3440 </directivesynopsis>
3443 <name>ServerName</name>
3444 <description>Hostname and port that the server uses to identify
3445 itself</description>
3446 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3447 <contextlist><context>server config</context><context>virtual host</context>
3451 <p>The <directive>ServerName</directive> directive sets the
3452 request scheme, hostname and
3453 port that the server uses to identify itself. This is used when
3454 creating redirection URLs.</p>
3456 <p>Additionally, <directive>ServerName</directive> is used (possibly
3457 in conjunction with <directive>ServerAlias</directive>) to uniquely
3458 identify a virtual host, when using <a
3459 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3461 <p>For example, if the name of the
3462 machine hosting the web server is <code>simple.example.com</code>,
3463 but the machine also has the DNS alias <code>www.example.com</code>
3464 and you wish the web server to be so identified, the following
3465 directive should be used:</p>
3468 ServerName www.example.com:80
3471 <p>The <directive>ServerName</directive> directive
3472 may appear anywhere within the definition of a server. However,
3473 each appearance overrides the previous appearance (within that
3476 <p>If no <directive>ServerName</directive> is specified, then the
3477 server attempts to deduce the hostname by performing a reverse
3478 lookup on the IP address. If no port is specified in the
3479 <directive>ServerName</directive>, then the server will use the
3480 port from the incoming request. For optimal reliability and
3481 predictability, you should specify an explicit hostname and port
3482 using the <directive>ServerName</directive> directive.</p>
3484 <p>If you are using <a
3485 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3486 the <directive>ServerName</directive> inside a
3487 <directive type="section" module="core">VirtualHost</directive>
3488 section specifies what hostname must appear in the request's
3489 <code>Host:</code> header to match this virtual host.</p>
3491 <p>Sometimes, the server runs behind a device that processes SSL,
3492 such as a reverse proxy, load balancer or SSL offload
3493 appliance. When this is the case, specify the
3494 <code>https://</code> scheme and the port number to which the
3495 clients connect in the <directive>ServerName</directive> directive
3496 to make sure that the server generates the correct
3497 self-referential URLs.
3500 <p>See the description of the
3501 <directive module="core">UseCanonicalName</directive> and
3502 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3503 settings which determine whether self-referential URLs (e.g., by the
3504 <module>mod_dir</module> module) will refer to the
3505 specified port, or to the port number given in the client's request.
3508 <note type="warning">
3509 <p>Failure to set <directive>ServerName</directive> to a name that
3510 your server can resolve to an IP address will result in a startup
3511 warning. <code>httpd</code> will then use whatever hostname it can
3512 determine, using the system's <code>hostname</code> command. This
3513 will almost never be the hostname you actually want.</p>
3515 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3521 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3522 Apache HTTP Server</a></seealso>
3523 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3524 documentation</a></seealso>
3525 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3526 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3527 <seealso><directive module="core">NameVirtualHost</directive></seealso>
3528 <seealso><directive module="core">ServerAlias</directive></seealso>
3529 </directivesynopsis>
3532 <name>ServerPath</name>
3533 <description>Legacy URL pathname for a name-based virtual host that
3534 is accessed by an incompatible browser</description>
3535 <syntax>ServerPath <var>URL-path</var></syntax>
3536 <contextlist><context>virtual host</context></contextlist>
3539 <p>The <directive>ServerPath</directive> directive sets the legacy
3540 URL pathname for a host, for use with <a
3541 href="../vhosts/">name-based virtual hosts</a>.</p>
3543 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3544 </directivesynopsis>
3547 <name>ServerRoot</name>
3548 <description>Base directory for the server installation</description>
3549 <syntax>ServerRoot <var>directory-path</var></syntax>
3550 <default>ServerRoot /usr/local/apache</default>
3551 <contextlist><context>server config</context></contextlist>
3554 <p>The <directive>ServerRoot</directive> directive sets the
3555 directory in which the server lives. Typically it will contain the
3556 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3557 paths in other configuration directives (such as <directive
3558 module="core">Include</directive> or <directive
3559 module="mod_so">LoadModule</directive>, for example) are taken as
3560 relative to this directory.</p>
3562 <example><title>Example</title>
3563 ServerRoot /home/httpd
3567 <seealso><a href="../invoking.html">the <code>-d</code>
3568 option to <code>httpd</code></a></seealso>
3569 <seealso><a href="../misc/security_tips.html#serverroot">the
3570 security tips</a> for information on how to properly set
3571 permissions on the <directive>ServerRoot</directive></seealso>
3572 </directivesynopsis>
3575 <name>ServerSignature</name>
3576 <description>Configures the footer on server-generated documents</description>
3577 <syntax>ServerSignature On|Off|EMail</syntax>
3578 <default>ServerSignature Off</default>
3579 <contextlist><context>server config</context><context>virtual host</context>
3580 <context>directory</context><context>.htaccess</context>
3582 <override>All</override>
3585 <p>The <directive>ServerSignature</directive> directive allows the
3586 configuration of a trailing footer line under server-generated
3587 documents (error messages, <module>mod_proxy</module> ftp directory
3588 listings, <module>mod_info</module> output, ...). The reason why you
3589 would want to enable such a footer line is that in a chain of proxies,
3590 the user often has no possibility to tell which of the chained servers
3591 actually produced a returned error message.</p>
3593 <p>The <code>Off</code>
3594 setting, which is the default, suppresses the footer line (and is
3595 therefore compatible with the behavior of Apache-1.2 and
3596 below). The <code>On</code> setting simply adds a line with the
3597 server version number and <directive
3598 module="core">ServerName</directive> of the serving virtual host,
3599 and the <code>EMail</code> setting additionally creates a
3600 "mailto:" reference to the <directive
3601 module="core">ServerAdmin</directive> of the referenced
3604 <p>After version 2.0.44, the details of the server version number
3605 presented are controlled by the <directive
3606 module="core">ServerTokens</directive> directive.</p>
3608 <seealso><directive module="core">ServerTokens</directive></seealso>
3609 </directivesynopsis>
3612 <name>ServerTokens</name>
3613 <description>Configures the <code>Server</code> HTTP response
3614 header</description>
3615 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3616 <default>ServerTokens Full</default>
3617 <contextlist><context>server config</context></contextlist>
3620 <p>This directive controls whether <code>Server</code> response
3621 header field which is sent back to clients includes a
3622 description of the generic OS-type of the server as well as
3623 information about compiled-in modules.</p>
3626 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3628 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3629 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3631 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3633 <dd>Server sends (<em>e.g.</em>): <code>Server:
3636 <dt><code>ServerTokens Major</code></dt>
3638 <dd>Server sends (<em>e.g.</em>): <code>Server:
3639 Apache/2</code></dd>
3641 <dt><code>ServerTokens Minor</code></dt>
3643 <dd>Server sends (<em>e.g.</em>): <code>Server:
3644 Apache/2.4</code></dd>
3646 <dt><code>ServerTokens Min[imal]</code></dt>
3648 <dd>Server sends (<em>e.g.</em>): <code>Server:
3649 Apache/2.4.1</code></dd>
3651 <dt><code>ServerTokens OS</code></dt>
3653 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3658 <p>This setting applies to the entire server, and cannot be
3659 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3661 <p>After version 2.0.44, this directive also controls the
3662 information presented by the <directive
3663 module="core">ServerSignature</directive> directive.</p>
3665 <note>Setting <directive>ServerTokens</directive> to less than
3666 <code>minimal</code> is not recommended because it makes it more
3667 difficult to debug interoperational problems. Also note that
3668 disabling the Server: header does nothing at all to make your
3669 server more secure; the idea of "security through obscurity"
3670 is a myth and leads to a false sense of safety.</note>
3673 <seealso><directive module="core">ServerSignature</directive></seealso>
3674 </directivesynopsis>
3677 <name>SetHandler</name>
3678 <description>Forces all matching files to be processed by a
3679 handler</description>
3680 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3681 <contextlist><context>server config</context><context>virtual host</context>
3682 <context>directory</context><context>.htaccess</context>
3684 <override>FileInfo</override>
3685 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3688 <p>When placed into an <code>.htaccess</code> file or a
3689 <directive type="section" module="core">Directory</directive> or
3690 <directive type="section" module="core">Location</directive>
3691 section, this directive forces all matching files to be parsed
3692 through the <a href="../handler.html">handler</a> given by
3693 <var>handler-name</var>. For example, if you had a directory you
3694 wanted to be parsed entirely as imagemap rule files, regardless
3695 of extension, you might put the following into an
3696 <code>.htaccess</code> file in that directory:</p>
3699 SetHandler imap-file
3702 <p>Another example: if you wanted to have the server display a
3703 status report whenever a URL of
3704 <code>http://servername/status</code> was called, you might put
3705 the following into <code>httpd.conf</code>:</p>
3708 <Location /status><br />
3710 SetHandler server-status<br />
3715 <p>You can override an earlier defined <directive>SetHandler</directive>
3716 directive by using the value <code>None</code>.</p>
3717 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3718 normal behaviour such as handling of URLs ending in a slash (/) as
3719 directories or index files is suppressed.</p>
3722 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3724 </directivesynopsis>
3727 <name>SetInputFilter</name>
3728 <description>Sets the filters that will process client requests and POST
3730 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3731 <contextlist><context>server config</context><context>virtual host</context>
3732 <context>directory</context><context>.htaccess</context>
3734 <override>FileInfo</override>
3737 <p>The <directive>SetInputFilter</directive> directive sets the
3738 filter or filters which will process client requests and POST
3739 input when they are received by the server. This is in addition to
3740 any filters defined elsewhere, including the
3741 <directive module="mod_mime">AddInputFilter</directive>
3744 <p>If more than one filter is specified, they must be separated
3745 by semicolons in the order in which they should process the
3748 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3749 </directivesynopsis>
3752 <name>SetOutputFilter</name>
3753 <description>Sets the filters that will process responses from the
3754 server</description>
3755 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3756 <contextlist><context>server config</context><context>virtual host</context>
3757 <context>directory</context><context>.htaccess</context>
3759 <override>FileInfo</override>
3762 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3763 which will process responses from the server before they are
3764 sent to the client. This is in addition to any filters defined
3765 elsewhere, including the
3766 <directive module="mod_mime">AddOutputFilter</directive>
3769 <p>For example, the following configuration will process all files
3770 in the <code>/www/data/</code> directory for server-side
3774 <Directory /www/data/><br />
3776 SetOutputFilter INCLUDES<br />
3781 <p>If more than one filter is specified, they must be separated
3782 by semicolons in the order in which they should process the
3785 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3786 </directivesynopsis>
3789 <name>TimeOut</name>
3790 <description>Amount of time the server will wait for
3791 certain events before failing a request</description>
3792 <syntax>TimeOut <var>seconds</var></syntax>
3793 <default>TimeOut 300</default>
3794 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3797 <p>The <directive>TimeOut</directive> directive defines the length
3798 of time Apache httpd will wait for I/O in various circumstances:</p>
3801 <li>When reading data from the client, the length of time to
3802 wait for a TCP packet to arrive if the read buffer is
3805 <li>When writing data to the client, the length of time to wait
3806 for an acknowledgement of a packet if the send buffer is
3809 <li>In <module>mod_cgi</module>, the length of time to wait for
3810 output from a CGI script.</li>
3812 <li>In <module>mod_ext_filter</module>, the length of time to
3813 wait for output from a filtering process.</li>
3815 <li>In <module>mod_proxy</module>, the default timeout value if
3816 <directive module="mod_proxy">ProxyTimeout</directive> is not
3821 </directivesynopsis>
3824 <name>TraceEnable</name>
3825 <description>Determines the behaviour on <code>TRACE</code> requests</description>
3826 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3827 <default>TraceEnable on</default>
3828 <contextlist><context>server config</context></contextlist>
3829 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3832 <p>This directive overrides the behavior of <code>TRACE</code> for both
3833 the core server and <module>mod_proxy</module>. The default
3834 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3835 RFC 2616, which disallows any request body to accompany the request.
3836 <code>TraceEnable off</code> causes the core server and
3837 <module>mod_proxy</module> to return a <code>405</code> (Method not
3838 allowed) error to the client.</p>
3840 <p>Finally, for testing and diagnostic purposes only, request
3841 bodies may be allowed using the non-compliant <code>TraceEnable
3842 extended</code> directive. The core (as an origin server) will
3843 restrict the request body to 64k (plus 8k for chunk headers if
3844 <code>Transfer-Encoding: chunked</code> is used). The core will
3845 reflect the full headers and all chunk headers with the response
3846 body. As a proxy server, the request body is not restricted to 64k.</p>
3848 </directivesynopsis>
3851 <name>UnDefine</name>
3852 <description>Undefine the existence of a variable</description>
3853 <syntax>UnDefine <var>parameter-name</var></syntax>
3854 <contextlist><context>server config</context></contextlist>
3857 <p>Undoes the effect of a <directive module="core">Define</directive> or
3858 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3859 <p>This directive can be used to toggle the use of <directive module="core"
3860 type="section">IfDefine</directive> sections without needing to alter
3861 <code>-D</code> arguments in any startup scripts.</p>
3863 </directivesynopsis>
3866 <name>UseCanonicalName</name>
3867 <description>Configures how the server determines its own name and
3869 <syntax>UseCanonicalName On|Off|DNS</syntax>
3870 <default>UseCanonicalName Off</default>
3871 <contextlist><context>server config</context><context>virtual host</context>
3872 <context>directory</context></contextlist>
3875 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3876 URL -- that is, a URL that refers back to the same server. With
3877 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3878 specified in the <directive module="core">ServerName</directive>
3879 directive to construct the canonical name for the server. This name
3880 is used in all self-referential URLs, and for the values of
3881 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3883 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3884 self-referential URLs using the hostname and port supplied by
3885 the client if any are supplied (otherwise it will use the
3886 canonical name, as defined above). These values are the same
3887 that are used to implement <a
3888 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3889 and are available with the same clients. The CGI variables
3890 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3891 constructed from the client supplied values as well.</p>
3893 <p>An example where this may be useful is on an intranet server
3894 where you have users connecting to the machine using short
3895 names such as <code>www</code>. You'll notice that if the users
3896 type a shortname, and a URL which is a directory, such as
3897 <code>http://www/splat</code>, <em>without the trailing
3898 slash</em> then Apache httpd will redirect them to
3899 <code>http://www.example.com/splat/</code>. If you have
3900 authentication enabled, this will cause the user to have to
3901 authenticate twice (once for <code>www</code> and once again
3902 for <code>www.example.com</code> -- see <a
3903 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3904 FAQ on this subject for more information</a>). But if
3905 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3906 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3908 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3909 which is intended for use with mass IP-based virtual hosting to
3910 support ancient clients that do not provide a
3911 <code>Host:</code> header. With this option Apache httpd does a
3912 reverse DNS lookup on the server IP address that the client
3913 connected to in order to work out self-referential URLs.</p>
3915 <note type="warning"><title>Warning</title>
3916 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3917 they may be broken by this option. The client is essentially free
3918 to give whatever value they want as a hostname. But if the CGI is
3919 only using <code>SERVER_NAME</code> to construct self-referential URLs
3920 then it should be just fine.</p>
3923 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3924 <seealso><directive module="core">ServerName</directive></seealso>
3925 <seealso><directive module="mpm_common">Listen</directive></seealso>
3926 </directivesynopsis>
3929 <name>UseCanonicalPhysicalPort</name>
3930 <description>Configures how the server determines its own name and
3932 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3933 <default>UseCanonicalPhysicalPort Off</default>
3934 <contextlist><context>server config</context><context>virtual host</context>
3935 <context>directory</context></contextlist>
3938 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3939 URL -- that is, a URL that refers back to the same server. With
3940 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3941 constructing the canonical port for the server to honor
3942 the <directive module="core">UseCanonicalName</directive> directive,
3943 provide the actual physical port number being used by this request
3944 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3945 Apache httpd will not ever use the actual physical port number, instead
3946 relying on all configured information to construct a valid port number.</p>
3948 <note><title>Note</title>
3949 <p>The ordering of when the physical port is used is as follows:<br /><br />
3950 <code>UseCanonicalName On</code></p>
3952 <li>Port provided in <code>Servername</code></li>
3953 <li>Physical port</li>
3954 <li>Default port</li>
3956 <code>UseCanonicalName Off | DNS</code>
3958 <li>Parsed port from <code>Host:</code> header</li>
3959 <li>Physical port</li>
3960 <li>Port provided in <code>Servername</code></li>
3961 <li>Default port</li>
3964 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3965 physical ports are removed from the ordering.</p>
3969 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3970 <seealso><directive module="core">ServerName</directive></seealso>
3971 <seealso><directive module="mpm_common">Listen</directive></seealso>
3972 </directivesynopsis>
3974 <directivesynopsis type="section">
3975 <name>VirtualHost</name>
3976 <description>Contains directives that apply only to a specific
3977 hostname or IP address</description>
3978 <syntax><VirtualHost
3979 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3980 ...> ... </VirtualHost></syntax>
3981 <contextlist><context>server config</context></contextlist>
3984 <p><directive type="section">VirtualHost</directive> and
3985 <code></VirtualHost></code> are used to enclose a group of
3986 directives that will apply only to a particular virtual host. Any
3987 directive that is allowed in a virtual host context may be
3988 used. When the server receives a request for a document on a
3989 particular virtual host, it uses the configuration directives
3990 enclosed in the <directive type="section">VirtualHost</directive>
3991 section. <var>Addr</var> can be:</p>
3994 <li>The IP address of the virtual host;</li>
3996 <li>A fully qualified domain name for the IP address of the
3997 virtual host (not recommended);</li>
3999 <li>The character <code>*</code>, which is used only in combination with
4000 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
4002 <li>The string <code>_default_</code>, which is used only
4003 with IP virtual hosting to catch unmatched IP addresses.</li>
4006 <example><title>Example</title>
4007 <VirtualHost 10.1.2.3><br />
4009 ServerAdmin webmaster@host.example.com<br />
4010 DocumentRoot /www/docs/host.example.com<br />
4011 ServerName host.example.com<br />
4012 ErrorLog logs/host.example.com-error_log<br />
4013 TransferLog logs/host.example.com-access_log<br />
4015 </VirtualHost>
4019 <p>IPv6 addresses must be specified in square brackets because
4020 the optional port number could not be determined otherwise. An
4021 IPv6 example is shown below:</p>
4024 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
4026 ServerAdmin webmaster@host.example.com<br />
4027 DocumentRoot /www/docs/host.example.com<br />
4028 ServerName host.example.com<br />
4029 ErrorLog logs/host.example.com-error_log<br />
4030 TransferLog logs/host.example.com-access_log<br />
4032 </VirtualHost>
4035 <p>Each Virtual Host must correspond to a different IP address,
4036 different port number or a different host name for the server,
4037 in the former case the server machine must be configured to
4038 accept IP packets for multiple addresses. (If the machine does
4039 not have multiple network interfaces, then this can be
4040 accomplished with the <code>ifconfig alias</code> command -- if
4041 your OS supports it).</p>
4043 <note><title>Note</title>
4044 <p>The use of <directive type="section">VirtualHost</directive> does
4045 <strong>not</strong> affect what addresses Apache httpd listens on. You
4046 may need to ensure that Apache httpd is listening on the correct addresses
4047 using <directive module="mpm_common">Listen</directive>.</p>
4050 <p>When using IP-based virtual hosting, the special name
4051 <code>_default_</code> can be specified in
4052 which case this virtual host will match any IP address that is
4053 not explicitly listed in another virtual host. In the absence
4054 of any <code>_default_</code> virtual host the "main" server config,
4055 consisting of all those definitions outside any VirtualHost
4056 section, is used when no IP-match occurs.</p>
4058 <p>You can specify a <code>:port</code> to change the port that is
4059 matched. If unspecified then it defaults to the same port as the
4060 most recent <directive module="mpm_common">Listen</directive>
4061 statement of the main server. You may also specify <code>:*</code>
4062 to match all ports on that address. (This is recommended when used
4063 with <code>_default_</code>.)</p>
4065 <p>A <directive module="core">ServerName</directive> should be
4066 specified inside each <directive
4067 type="section">VirtualHost</directive> block. If it is absent, the
4068 <directive module="core">ServerName</directive> from the "main"
4069 server configuration will be inherited.</p>
4071 <p>If no matching virtual host is found, then the first listed
4072 virtual host that matches the IP address will be used. As a
4073 consequence, the first listed virtual host is the default virtual
4076 <note type="warning"><title>Security</title>
4077 <p>See the <a href="../misc/security_tips.html">security tips</a>
4078 document for details on why your security could be compromised if the
4079 directory where log files are stored is writable by anyone other
4080 than the user that starts the server.</p>
4083 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4084 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4085 Apache HTTP Server</a></seealso>
4086 <seealso><a href="../bind.html">Setting
4087 which addresses and ports Apache HTTP Server uses</a></seealso>
4088 <seealso><a href="../sections.html">How <Directory>, <Location>
4089 and <Files> sections work</a> for an explanation of how these
4090 different sections are combined when a request is received</seealso>
4091 </directivesynopsis>