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 a variable</description>
542 <syntax>Define <var>parameter-name</var> [<var>parameter-value</var>]</syntax>
543 <contextlist><context>server config</context><context>virtual host</context>
544 <context>directory</context></contextlist>
547 <p>In its one parameter form, <directive>Define</directive> is equivalent
548 to passing the <code>-D</code> argument to <program>httpd</program>. It
549 can be used to toggle the use of
550 <directive module="core" type="section">IfDefine</directive> sections
551 without needing to alter <code>-D</code> arguments in any startup
554 <p>In addition to that, if the second parameter is given, a config variable
555 is set to this value. The variable can be used in the configuration using
556 the <code>${VAR}</code> syntax. The variable is always globally defined
557 and not limited to the scope of the surrounding config section.</p>
560 <IfDefine TEST><br/>
561 Define servername test.example.com<br/>
562 </IfDefine><br/>
563 <IfDefine !TEST><br/>
564 Define servername www.example.com<br/>
565 Define SSL<br/>
566 </IfDefine><br/>
569 <p>Variable names may not contain colon ":" characters, to avoid clashes
570 with <directive module="mod_rewrite">RewriteMap</directive>'s syntax.</p>
574 <directivesynopsis type="section">
575 <name>Directory</name>
576 <description>Enclose a group of directives that apply only to the
577 named file-system directory, sub-directories, and their contents.</description>
578 <syntax><Directory <var>directory-path</var>>
579 ... </Directory></syntax>
580 <contextlist><context>server config</context><context>virtual host</context>
584 <p><directive type="section">Directory</directive> and
585 <code></Directory></code> are used to enclose a group of
586 directives that will apply only to the named directory,
587 sub-directories of that directory, and the files within the respective
588 directories. Any directive that is allowed
589 in a directory context may be used. <var>Directory-path</var> is
590 either the full path to a directory, or a wild-card string using
591 Unix shell-style matching. In a wild-card string, <code>?</code> matches
592 any single character, and <code>*</code> matches any sequences of
593 characters. You may also use <code>[]</code> character ranges. None
594 of the wildcards match a `/' character, so <code><Directory
595 /*/public_html></code> will not match
596 <code>/home/user/public_html</code>, but <code><Directory
597 /home/*/public_html></code> will match. Example:</p>
600 <Directory /usr/local/httpd/htdocs><br />
602 Options Indexes FollowSymLinks<br />
608 <p>Be careful with the <var>directory-path</var> arguments:
609 They have to literally match the filesystem path which Apache httpd uses
610 to access the files. Directives applied to a particular
611 <code><Directory></code> will not apply to files accessed from
612 that same directory via a different path, such as via different symbolic
616 <p><glossary ref="regex">Regular
617 expressions</glossary> can also be used, with the addition of the
618 <code>~</code> character. For example:</p>
621 <Directory ~ "^/www/.*/[0-9]{3}">
624 <p>would match directories in <code>/www/</code> that consisted of
627 <p>If multiple (non-regular expression) <directive
628 type="section">Directory</directive> sections
629 match the directory (or one of its parents) containing a document,
630 then the directives are applied in the order of shortest match
631 first, interspersed with the directives from the <a
632 href="#accessfilename">.htaccess</a> files. For example,
636 <Directory /><br />
638 AllowOverride None<br />
640 </Directory><br />
642 <Directory /home><br />
644 AllowOverride FileInfo<br />
649 <p>for access to the document <code>/home/web/dir/doc.html</code>
653 <li>Apply directive <code>AllowOverride None</code>
654 (disabling <code>.htaccess</code> files).</li>
656 <li>Apply directive <code>AllowOverride FileInfo</code> (for
657 directory <code>/home</code>).</li>
659 <li>Apply any <code>FileInfo</code> directives in
660 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
661 <code>/home/web/dir/.htaccess</code> in that order.</li>
664 <p>Regular expressions are not considered until after all of the
665 normal sections have been applied. Then all of the regular
666 expressions are tested in the order they appeared in the
667 configuration file. For example, with</p>
670 <Directory ~ abc$><br />
672 # ... directives here ...<br />
677 <p>the regular expression section won't be considered until after
678 all normal <directive type="section">Directory</directive>s and
679 <code>.htaccess</code> files have been applied. Then the regular
680 expression will match on <code>/home/abc/public_html/abc</code> and
681 the corresponding <directive type="section">Directory</directive> will
684 <p><strong>Note that the default access for
685 <code><Directory /></code> is to permit all access.
686 This means that Apache httpd will serve any file mapped from an URL. It is
687 recommended that you change this with a block such
691 <Directory /><br />
693 Require all denied<br />
698 <p><strong>and then override this for directories you
699 <em>want</em> accessible. See the <a
700 href="../misc/security_tips.html">Security Tips</a> page for more
701 details.</strong></p>
703 <p>The directory sections occur in the <code>httpd.conf</code> file.
704 <directive type="section">Directory</directive> directives
705 cannot nest, and cannot appear in a <directive module="core"
706 type="section">Limit</directive> or <directive module="core"
707 type="section">LimitExcept</directive> section.</p>
709 <seealso><a href="../sections.html">How <Directory>,
710 <Location> and <Files> sections work</a> for an
711 explanation of how these different sections are combined when a
712 request is received</seealso>
715 <directivesynopsis type="section">
716 <name>DirectoryMatch</name>
717 <description>Enclose directives that apply to
718 the contents of file-system directories matching a regular expression.</description>
719 <syntax><DirectoryMatch <var>regex</var>>
720 ... </DirectoryMatch></syntax>
721 <contextlist><context>server config</context><context>virtual host</context>
725 <p><directive type="section">DirectoryMatch</directive> and
726 <code></DirectoryMatch></code> are used to enclose a group
727 of directives which will apply only to the named directory (and the files within),
728 the same as <directive module="core" type="section">Directory</directive>.
729 However, it takes as an argument a
730 <glossary ref="regex">regular expression</glossary>. For example:</p>
733 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
736 <p>would match directories in <code>/www/</code> that consisted of three
739 <note><title>Compatability</title>
740 Prior to 2.3.9, this directive implicitly applied to sub-directories
741 (like <directive module="core" type="section">Directory</directive>) and
742 could not match the end of line symbol ($). In 2.3.9 and later,
743 only directories that match the expression are affected by the enclosed
747 <note><title>Trailing Slash</title>
748 This directive applies to requests for directories that may or may
749 not end in a trailing slash, so expressions that are anchored to the
750 end of line ($) must be written with care.
753 <seealso><directive type="section" module="core">Directory</directive> for
754 a description of how regular expressions are mixed in with normal
755 <directive type="section">Directory</directive>s</seealso>
757 href="../sections.html">How <Directory>, <Location> and
758 <Files> sections work</a> for an explanation of how these different
759 sections are combined when a request is received</seealso>
763 <name>DocumentRoot</name>
764 <description>Directory that forms the main document tree visible
765 from the web</description>
766 <syntax>DocumentRoot <var>directory-path</var></syntax>
767 <default>DocumentRoot /usr/local/apache/htdocs</default>
768 <contextlist><context>server config</context><context>virtual host</context>
772 <p>This directive sets the directory from which <program>httpd</program>
773 will serve files. Unless matched by a directive like <directive
774 module="mod_alias">Alias</directive>, the server appends the
775 path from the requested URL to the document root to make the
776 path to the document. Example:</p>
779 DocumentRoot /usr/web
783 <code>http://my.example.com/index.html</code> refers to
784 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
785 not absolute then it is assumed to be relative to the <directive
786 module="core">ServerRoot</directive>.</p>
788 <p>The <directive>DocumentRoot</directive> should be specified without
789 a trailing slash.</p>
791 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
792 Locations</a></seealso>
796 <name>EnableMMAP</name>
797 <description>Use memory-mapping to read files during delivery</description>
798 <syntax>EnableMMAP On|Off</syntax>
799 <default>EnableMMAP On</default>
800 <contextlist><context>server config</context><context>virtual host</context>
801 <context>directory</context><context>.htaccess</context>
803 <override>FileInfo</override>
806 <p>This directive controls whether the <program>httpd</program> may use
807 memory-mapping if it needs to read the contents of a file during
808 delivery. By default, when the handling of a request requires
809 access to the data within a file -- for example, when delivering a
810 server-parsed file using <module>mod_include</module> -- Apache httpd
811 memory-maps the file if the OS supports it.</p>
813 <p>This memory-mapping sometimes yields a performance improvement.
814 But in some environments, it is better to disable the memory-mapping
815 to prevent operational problems:</p>
818 <li>On some multiprocessor systems, memory-mapping can reduce the
819 performance of the <program>httpd</program>.</li>
820 <li>Deleting or truncating a file while <program>httpd</program>
821 has it memory-mapped can cause <program>httpd</program> to
822 crash with a segmentation fault.
826 <p>For server configurations that are vulnerable to these problems,
827 you should disable memory-mapping of delivered files by specifying:</p>
833 <p>For NFS mounted files, this feature may be disabled explicitly for
834 the offending files by specifying:</p>
837 <Directory "/path-to-nfs-files">
847 <name>EnableSendfile</name>
848 <description>Use the kernel sendfile support to deliver files to the client</description>
849 <syntax>EnableSendfile On|Off</syntax>
850 <default>EnableSendfile Off</default>
851 <contextlist><context>server config</context><context>virtual host</context>
852 <context>directory</context><context>.htaccess</context>
854 <override>FileInfo</override>
855 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
856 version 2.3.9.</compatibility>
859 <p>This directive controls whether <program>httpd</program> may use the
860 sendfile support from the kernel to transmit file contents to the client.
861 By default, when the handling of a request requires no access
862 to the data within a file -- for example, when delivering a
863 static file -- Apache httpd uses sendfile to deliver the file contents
864 without ever reading the file if the OS supports it.</p>
866 <p>This sendfile mechanism avoids separate read and send operations,
867 and buffer allocations. But on some platforms or within some
868 filesystems, it is better to disable this feature to avoid
869 operational problems:</p>
872 <li>Some platforms may have broken sendfile support that the build
873 system did not detect, especially if the binaries were built on
874 another box and moved to such a machine with broken sendfile
876 <li>On Linux the use of sendfile triggers TCP-checksum
877 offloading bugs on certain networking cards when using IPv6.</li>
878 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
879 files over 2GB in size.</li>
880 <li>With a network-mounted <directive
881 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
882 the kernel may be unable to serve the network file through
886 <p>For server configurations that are not vulnerable to these problems,
887 you may enable this feature by specifying:</p>
893 <p>For network mounted files, this feature may be disabled explicitly
894 for the offending files by specifying:</p>
897 <Directory "/path-to-nfs-files">
903 <p>Please note that the per-directory and .htaccess configuration
904 of <directive>EnableSendfile</directive> is not supported by
905 <module>mod_cache_disk</module>.
906 Only global definition of <directive>EnableSendfile</directive>
907 is taken into account by the module.
914 <description>Abort configuration parsing with a custom error message</description>
915 <syntax>Error <var>message</var></syntax>
916 <contextlist><context>server config</context><context>virtual host</context>
917 <context>directory</context><context>.htaccess</context>
919 <compatibility>2.3.9 and later</compatibility>
922 <p>If an error can be detected within the configuration, this
923 directive can be used to generate a custom error message, and halt
924 configuration parsing. The typical use is for reporting required
925 modules which are missing from the configuration.</p>
927 <example><title>Example</title>
928 # ensure that mod_include is loaded<br />
929 <IfModule !include_module><br />
930 Error mod_include is required by mod_foo. Load it with LoadModule.<br />
931 </IfModule><br />
933 # ensure that exactly one of SSL,NOSSL is defined<br />
934 <IfDefine SSL><br />
935 <IfDefine NOSSL><br />
936 Error Both SSL and NOSSL are defined. Define only one of them.<br />
937 </IfDefine><br />
938 </IfDefine><br />
939 <IfDefine !SSL><br />
940 <IfDefine !NOSSL><br />
941 Error Either SSL or NOSSL must be defined.<br />
942 </IfDefine><br />
943 </IfDefine><br />
950 <name>ErrorDocument</name>
951 <description>What the server will return to the client
952 in case of an error</description>
953 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
954 <contextlist><context>server config</context><context>virtual host</context>
955 <context>directory</context><context>.htaccess</context>
957 <override>FileInfo</override>
960 <p>In the event of a problem or error, Apache httpd can be configured
961 to do one of four things,</p>
964 <li>output a simple hardcoded error message</li>
966 <li>output a customized message</li>
968 <li>redirect to a local <var>URL-path</var> to handle the
971 <li>redirect to an external <var>URL</var> to handle the
975 <p>The first option is the default, while options 2-4 are
976 configured using the <directive>ErrorDocument</directive>
977 directive, which is followed by the HTTP response code and a URL
978 or a message. Apache httpd will sometimes offer additional information
979 regarding the problem/error.</p>
981 <p>URLs can begin with a slash (/) for local web-paths (relative
982 to the <directive module="core">DocumentRoot</directive>), or be a
983 full URL which the client can resolve. Alternatively, a message
984 can be provided to be displayed by the browser. Examples:</p>
987 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
988 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
989 ErrorDocument 401 /subscription_info.html<br />
990 ErrorDocument 403 "Sorry can't allow you access today"
993 <p>Additionally, the special value <code>default</code> can be used
994 to specify Apache httpd's simple hardcoded message. While not required
995 under normal circumstances, <code>default</code> will restore
996 Apache httpd's simple hardcoded message for configurations that would
997 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
1000 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
1001 <Directory /web/docs><br />
1003 ErrorDocument 404 default<br />
1008 <p>Note that when you specify an <directive>ErrorDocument</directive>
1009 that points to a remote URL (ie. anything with a method such as
1010 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1011 client to tell it where to find the document, even if the
1012 document ends up being on the same server. This has several
1013 implications, the most important being that the client will not
1014 receive the original error status code, but instead will
1015 receive a redirect status code. This in turn can confuse web
1016 robots and other clients which try to determine if a URL is
1017 valid using the status code. In addition, if you use a remote
1018 URL in an <code>ErrorDocument 401</code>, the client will not
1019 know to prompt the user for a password since it will not
1020 receive the 401 status code. Therefore, <strong>if you use an
1021 <code>ErrorDocument 401</code> directive then it must refer to a local
1022 document.</strong></p>
1024 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1025 server-generated error messages when they are "too small" and substitute
1026 its own "friendly" error messages. The size threshold varies depending on
1027 the type of error, but in general, if you make your error document
1028 greater than 512 bytes, then MSIE will show the server-generated
1029 error rather than masking it. More information is available in
1030 Microsoft Knowledge Base article <a
1031 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1034 <p>Although most error messages can be overriden, there are certain
1035 circumstances where the internal messages are used regardless of the
1036 setting of <directive module="core">ErrorDocument</directive>. In
1037 particular, if a malformed request is detected, normal request processing
1038 will be immediately halted and the internal error message returned.
1039 This is necessary to guard against security problems caused by
1042 <p>If you are using mod_proxy, you may wish to enable
1043 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1044 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1045 Apache httpd will not generate custom error documents for proxied content.</p>
1048 <seealso><a href="../custom-error.html">documentation of
1049 customizable responses</a></seealso>
1050 </directivesynopsis>
1053 <name>ErrorLog</name>
1054 <description>Location where the server will log errors</description>
1055 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1056 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1057 <contextlist><context>server config</context><context>virtual host</context>
1061 <p>The <directive>ErrorLog</directive> directive sets the name of
1062 the file to which the server will log any errors it encounters. If
1063 the <var>file-path</var> is not absolute then it is assumed to be
1064 relative to the <directive module="core">ServerRoot</directive>.</p>
1066 <example><title>Example</title>
1067 ErrorLog /var/log/httpd/error_log
1070 <p>If the <var>file-path</var>
1071 begins with a pipe character "<code>|</code>" then it is assumed to be a
1072 command to spawn to handle the error log.</p>
1074 <example><title>Example</title>
1075 ErrorLog "|/usr/local/bin/httpd_errors"
1078 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1079 more information.</p>
1081 <p>Using <code>syslog</code> instead of a filename enables logging
1082 via syslogd(8) if the system supports it. The default is to use
1083 syslog facility <code>local7</code>, but you can override this by
1084 using the <code>syslog:<var>facility</var></code> syntax where
1085 <var>facility</var> can be one of the names usually documented in
1086 syslog(1). The facility is effectively global, and if it is changed
1087 in individual virtual hosts, the final facility specified affects the
1090 <example><title>Example</title>
1091 ErrorLog syslog:user
1094 <p>SECURITY: See the <a
1095 href="../misc/security_tips.html#serverroot">security tips</a>
1096 document for details on why your security could be compromised
1097 if the directory where log files are stored is writable by
1098 anyone other than the user that starts the server.</p>
1099 <note type="warning"><title>Note</title>
1100 <p>When entering a file path on non-Unix platforms, care should be taken
1101 to make sure that only forward slashes are used even though the platform
1102 may allow the use of back slashes. In general it is a good idea to always
1103 use forward slashes throughout the configuration files.</p>
1106 <seealso><directive module="core">LogLevel</directive></seealso>
1107 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1108 </directivesynopsis>
1111 <name>ErrorLogFormat</name>
1112 <description>Format specification for error log entries</description>
1113 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1114 <contextlist><context>server config</context><context>virtual host</context>
1116 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1119 <p><directive>ErrorLogFormat</directive> allows to specify what
1120 supplementary information is logged in the error log in addition to the
1121 actual log message.</p>
1123 <example><title>Simple example</title>
1124 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1127 <p>Specifying <code>connection</code> or <code>request</code> as first
1128 parameter allows to specify additional formats, causing additional
1129 information to be logged when the first message is logged for a specific
1130 connection or request, respectivly. This additional information is only
1131 logged once per connection/request. If a connection or request is processed
1132 without causing any log message, the additional information is not logged
1135 <p>It can happen that some format string items do not produce output. For
1136 example, the Referer header is only present if the log message is
1137 associated to a request and the log message happens at a time when the
1138 Referer header has already been read from the client. If no output is
1139 produced, the default behaviour is to delete everything from the preceeding
1140 space character to the next space character. This means the log line is
1141 implicitly divided into fields on non-whitespace to whitespace transitions.
1142 If a format string item does not produce output, the whole field is
1143 ommitted. For example, if the remote address <code>%a</code> in the log
1144 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1145 brackets are not logged either. Space characters can be escaped with a
1146 backslash to prevent them from delimiting a field. The combination '% '
1147 (percent space) is a zero-witdh field delimiter that does not produce any
1150 <p>The above behaviour can be changed by adding modifiers to the format
1151 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1152 respective item does not produce any output. In once-per-connection/request
1153 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1154 item with the plus modifier does not produce any output, the whole line is
1157 <p>A number as modifier can be used to assign a log severity level to a
1158 format item. The item will only be logged if the severity of the log
1159 message is not higher than the specified log severity level. The number can
1160 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1162 <p>Some format string items accept additional parameters in braces.</p>
1164 <table border="1" style="zebra">
1165 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1167 <tr><th>Format String</th> <th>Description</th></tr>
1169 <tr><td><code>%%</code></td>
1170 <td>The percent sign</td></tr>
1172 <tr><td><code>%...a</code></td>
1173 <td>Remote IP-address and port</td></tr>
1175 <tr><td><code>%...A</code></td>
1176 <td>Local IP-address and port</td></tr>
1178 <tr><td><code>%...{name}e</code></td>
1179 <td>Request environment variable <code>name</code></td></tr>
1181 <tr><td><code>%...E</code></td>
1182 <td>APR/OS error status code and string</td></tr>
1184 <tr><td><code>%...F</code></td>
1185 <td>Source file name and line number of the log call</td></tr>
1187 <tr><td><code>%...{name}i</code></td>
1188 <td>Request header <code>name</code></td></tr>
1190 <tr><td><code>%...k</code></td>
1191 <td>Number of keep-alive requests on this connection</td></tr>
1193 <tr><td><code>%...l</code></td>
1194 <td>Loglevel of the message</td></tr>
1196 <tr><td><code>%...L</code></td>
1197 <td>Log ID of the request</td></tr>
1199 <tr><td><code>%...{c}L</code></td>
1200 <td>Log ID of the connection</td></tr>
1202 <tr><td><code>%...{C}L</code></td>
1203 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1205 <tr><td><code>%...m</code></td>
1206 <td>Name of the module logging the message</td></tr>
1208 <tr><td><code>%M</code></td>
1209 <td>The actual log message</td></tr>
1211 <tr><td><code>%...{name}n</code></td>
1212 <td>Request note <code>name</code></td></tr>
1214 <tr><td><code>%...P</code></td>
1215 <td>Process ID of current process</td></tr>
1217 <tr><td><code>%...T</code></td>
1218 <td>Thread ID of current thread</td></tr>
1220 <tr><td><code>%...t</code></td>
1221 <td>The current time</td></tr>
1223 <tr><td><code>%...{u}t</code></td>
1224 <td>The current time including micro-seconds</td></tr>
1226 <tr><td><code>%...{cu}t</code></td>
1227 <td>The current time in compact ISO 8601 format, including
1228 micro-seconds</td></tr>
1230 <tr><td><code>%...v</code></td>
1231 <td>The canonical <directive module="core">ServerName</directive>
1232 of the current server.</td></tr>
1234 <tr><td><code>%...V</code></td>
1235 <td>The server name of the server serving the request according to the
1236 <directive module="core" >UseCanonicalName</directive>
1239 <tr><td><code>\ </code> (backslash space)</td>
1240 <td>Non-field delimiting space</td></tr>
1242 <tr><td><code>% </code> (percent space)</td>
1243 <td>Field delimiter (no output)</td></tr>
1246 <p>The log ID format <code>%L</code> produces a unique id for a connection
1247 or request. This can be used to correlate which log lines belong to the
1248 same connection or request, which request happens on which connection.
1249 A <code>%L</code> format string is also available in
1250 <module>mod_log_config</module>, to allow to correlate access log entries
1251 with error log lines. If <module>mod_unique_id</module> is loaded, its
1252 unique id will be used as log ID for requests.</p>
1254 <example><title>Example (somewhat similar to default format)</title>
1255 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1256 %M% ,\ referer\ %{Referer}i"
1259 <example><title>Example (similar to the 2.2.x format)</title>
1260 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1261 %M% ,\ referer\ %{Referer}i"
1264 <example><title>Advanced example with request/connection log IDs</title>
1265 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1266 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1267 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1268 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1269 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1273 <seealso><directive module="core">ErrorLog</directive></seealso>
1274 <seealso><directive module="core">LogLevel</directive></seealso>
1275 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1276 </directivesynopsis>
1279 <name>ExtendedStatus</name>
1280 <description>Keep track of extended status information for each
1281 request</description>
1282 <syntax>ExtendedStatus On|Off</syntax>
1283 <default>ExtendedStatus Off[*]</default>
1284 <contextlist><context>server config</context></contextlist>
1287 <p>This option tracks additional data per worker about the
1288 currently executing request, and a utilization summary; you
1289 can see these variables during runtime by configuring
1290 <module>mod_status</module>. Note that other modules may
1291 rely on this scoreboard.</p>
1293 <p>This setting applies to the entire server, and cannot be
1294 enabled or disabled on a virtualhost-by-virtualhost basis.
1295 The collection of extended status information can slow down
1296 the server. Also note that this setting cannot be changed
1297 during a graceful restart.</p>
1300 <p>Note that loading <module>mod_status</module> will change
1301 the default behavior to ExtendedStatus On, while other
1302 third party modules may do the same. Such modules rely on
1303 collecting detailed information about the state of all workers.
1304 The default is changed by <module>mod_status</module> beginning
1305 with version 2.3.6; the previous default was always Off.</p>
1310 </directivesynopsis>
1313 <name>FileETag</name>
1314 <description>File attributes used to create the ETag
1315 HTTP response header for static files</description>
1316 <syntax>FileETag <var>component</var> ...</syntax>
1317 <default>FileETag INode MTime Size</default>
1318 <contextlist><context>server config</context><context>virtual host</context>
1319 <context>directory</context><context>.htaccess</context>
1321 <override>FileInfo</override>
1325 The <directive>FileETag</directive> directive configures the file
1326 attributes that are used to create the <code>ETag</code> (entity
1327 tag) response header field when the document is based on a static file.
1328 (The <code>ETag</code> value is used in cache management to save
1329 network bandwidth.) The
1330 <directive>FileETag</directive> directive allows you to choose
1331 which of these -- if any -- should be used. The recognized keywords are:
1335 <dt><strong>INode</strong></dt>
1336 <dd>The file's i-node number will be included in the calculation</dd>
1337 <dt><strong>MTime</strong></dt>
1338 <dd>The date and time the file was last modified will be included</dd>
1339 <dt><strong>Size</strong></dt>
1340 <dd>The number of bytes in the file will be included</dd>
1341 <dt><strong>All</strong></dt>
1342 <dd>All available fields will be used. This is equivalent to:
1343 <example>FileETag INode MTime Size</example></dd>
1344 <dt><strong>None</strong></dt>
1345 <dd>If a document is file-based, no <code>ETag</code> field will be
1346 included in the response</dd>
1349 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1350 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1351 which allow changes to be made to the default setting inherited
1352 from a broader scope. Any keyword appearing without such a prefix
1353 immediately and completely cancels the inherited setting.</p>
1355 <p>If a directory's configuration includes
1356 <code>FileETag INode MTime Size</code>, and a
1357 subdirectory's includes <code>FileETag -INode</code>,
1358 the setting for that subdirectory (which will be inherited by
1359 any sub-subdirectories that don't override it) will be equivalent to
1360 <code>FileETag MTime Size</code>.</p>
1361 <note type="warning"><title>Warning</title>
1362 Do not change the default for directories or locations that have WebDAV
1363 enabled and use <module>mod_dav_fs</module> as a storage provider.
1364 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1365 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1366 These conditional requests will break if the <code>ETag</code> format is
1367 changed via <directive>FileETag</directive>.
1369 <note><title>Server Side Includes</title>
1370 An ETag is not generated for responses parsed by <module>mod_include</module>,
1371 since the response entity can change without a change of the INode, MTime, or Size
1372 of the static file with embedded SSI directives.
1376 </directivesynopsis>
1378 <directivesynopsis type="section">
1380 <description>Contains directives that apply to matched
1381 filenames</description>
1382 <syntax><Files <var>filename</var>> ... </Files></syntax>
1383 <contextlist><context>server config</context><context>virtual host</context>
1384 <context>directory</context><context>.htaccess</context>
1386 <override>All</override>
1389 <p>The <directive type="section">Files</directive> directive
1390 limits the scope of the enclosed directives by filename. It is comparable
1391 to the <directive module="core" type="section">Directory</directive>
1392 and <directive module="core" type="section">Location</directive>
1393 directives. It should be matched with a <code></Files></code>
1394 directive. The directives given within this section will be applied to
1395 any object with a basename (last component of filename) matching the
1396 specified filename. <directive type="section">Files</directive>
1397 sections are processed in the order they appear in the
1398 configuration file, after the <directive module="core"
1399 type="section">Directory</directive> sections and
1400 <code>.htaccess</code> files are read, but before <directive
1401 type="section" module="core">Location</directive> sections. Note
1402 that <directive type="section">Files</directive> can be nested
1403 inside <directive type="section"
1404 module="core">Directory</directive> sections to restrict the
1405 portion of the filesystem they apply to.</p>
1407 <p>The <var>filename</var> argument should include a filename, or
1408 a wild-card string, where <code>?</code> matches any single character,
1409 and <code>*</code> matches any sequences of characters.
1410 <glossary ref="regex">Regular expressions</glossary>
1411 can also be used, with the addition of the
1412 <code>~</code> character. For example:</p>
1415 <Files ~ "\.(gif|jpe?g|png)$">
1418 <p>would match most common Internet graphics formats. <directive
1419 module="core" type="section">FilesMatch</directive> is preferred,
1422 <p>Note that unlike <directive type="section"
1423 module="core">Directory</directive> and <directive type="section"
1424 module="core">Location</directive> sections, <directive
1425 type="section">Files</directive> sections can be used inside
1426 <code>.htaccess</code> files. This allows users to control access to
1427 their own files, at a file-by-file level.</p>
1430 <seealso><a href="../sections.html">How <Directory>, <Location>
1431 and <Files> sections work</a> for an explanation of how these
1432 different sections are combined when a request is received</seealso>
1433 </directivesynopsis>
1435 <directivesynopsis type="section">
1436 <name>FilesMatch</name>
1437 <description>Contains directives that apply to regular-expression matched
1438 filenames</description>
1439 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1440 <contextlist><context>server config</context><context>virtual host</context>
1441 <context>directory</context><context>.htaccess</context>
1443 <override>All</override>
1446 <p>The <directive type="section">FilesMatch</directive> directive
1447 limits the scope of the enclosed directives by filename, just as the
1448 <directive module="core" type="section">Files</directive> directive
1449 does. However, it accepts a <glossary ref="regex">regular
1450 expression</glossary>. For example:</p>
1453 <FilesMatch "\.(gif|jpe?g|png)$">
1456 <p>would match most common Internet graphics formats.</p>
1459 <seealso><a href="../sections.html">How <Directory>, <Location>
1460 and <Files> sections work</a> for an explanation of how these
1461 different sections are combined when a request is received</seealso>
1462 </directivesynopsis>
1465 <name>ForceType</name>
1466 <description>Forces all matching files to be served with the specified
1467 media type in the HTTP Content-Type header field</description>
1468 <syntax>ForceType <var>media-type</var>|None</syntax>
1469 <contextlist><context>directory</context><context>.htaccess</context>
1471 <override>FileInfo</override>
1472 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1475 <p>When placed into an <code>.htaccess</code> file or a
1476 <directive type="section" module="core">Directory</directive>, or
1477 <directive type="section" module="core">Location</directive> or
1478 <directive type="section" module="core">Files</directive>
1479 section, this directive forces all matching files to be served
1480 with the content type identification given by
1481 <var>media-type</var>. For example, if you had a directory full of
1482 GIF files, but did not want to label them all with <code>.gif</code>,
1483 you might want to use:</p>
1489 <p>Note that this directive overrides other indirect media type
1490 associations defined in mime.types or via the
1491 <directive module="mod_mime">AddType</directive>.</p>
1493 <p>You can also override more general
1494 <directive>ForceType</directive> settings
1495 by using the value of <code>None</code>:</p>
1498 # force all files to be image/gif:<br />
1499 <Location /images><br />
1501 ForceType image/gif<br />
1503 </Location><br />
1505 # but normal mime-type associations here:<br />
1506 <Location /images/mixed><br />
1508 ForceType None<br />
1513 <p>This directive primarily overrides the content types generated for
1514 static files served out of the filesystem. For resources other than
1515 static files, where the generator of the response typically specifies
1516 a Content-Type, this directive has no effect.</p>
1519 </directivesynopsis>
1521 <name>GprofDir</name>
1522 <description>Directory to write gmon.out profiling data to. </description>
1523 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1524 <contextlist><context>server config</context><context>virtual host</context>
1528 <p>When the server has been compiled with gprof profiling suppport,
1529 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1530 be written to the specified directory when the process exits. If the
1531 argument ends with a percent symbol ('%'), subdirectories are created
1532 for each process id.</p>
1534 <p>This directive currently only works with the <module>prefork</module>
1537 </directivesynopsis>
1540 <name>HostnameLookups</name>
1541 <description>Enables DNS lookups on client IP addresses</description>
1542 <syntax>HostnameLookups On|Off|Double</syntax>
1543 <default>HostnameLookups Off</default>
1544 <contextlist><context>server config</context><context>virtual host</context>
1545 <context>directory</context></contextlist>
1548 <p>This directive enables DNS lookups so that host names can be
1549 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1550 The value <code>Double</code> refers to doing double-reverse
1551 DNS lookup. That is, after a reverse lookup is performed, a forward
1552 lookup is then performed on that result. At least one of the IP
1553 addresses in the forward lookup must match the original
1554 address. (In "tcpwrappers" terminology this is called
1555 <code>PARANOID</code>.)</p>
1557 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1558 used for controlling access by hostname, a double reverse lookup
1559 will be performed. This is necessary for security. Note that the
1560 result of this double-reverse isn't generally available unless you
1561 set <code>HostnameLookups Double</code>. For example, if only
1562 <code>HostnameLookups On</code> and a request is made to an object
1563 that is protected by hostname restrictions, regardless of whether
1564 the double-reverse fails or not, CGIs will still be passed the
1565 single-reverse result in <code>REMOTE_HOST</code>.</p>
1567 <p>The default is <code>Off</code> in order to save the network
1568 traffic for those sites that don't truly need the reverse
1569 lookups done. It is also better for the end users because they
1570 don't have to suffer the extra latency that a lookup entails.
1571 Heavily loaded sites should leave this directive
1572 <code>Off</code>, since DNS lookups can take considerable
1573 amounts of time. The utility <program>logresolve</program>, compiled by
1574 default to the <code>bin</code> subdirectory of your installation
1575 directory, can be used to look up host names from logged IP addresses
1578 </directivesynopsis>
1580 <directivesynopsis type="section">
1582 <description>Contains directives that apply only if a condition is
1583 satisfied by a request at runtime</description>
1584 <syntax><If <var>expression</var>> ... </If></syntax>
1585 <contextlist><context>server config</context><context>virtual host</context>
1586 <context>directory</context><context>.htaccess</context>
1588 <override>All</override>
1591 <p>The <directive type="section">If</directive> directive
1592 evaluates an expression at runtime, and applies the enclosed
1593 directives if and only if the expression evaluates to true.
1597 <If "$req{Host} = ''">
1600 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1602 <p>You may compare the value of any variable in the request headers
1603 ($req), response headers ($resp) or environment ($env) in your
1606 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1607 operator to compare if the expression is in a given range:</p>
1610 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1615 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1616 for a complete reference and more examples.</seealso>
1617 <seealso><a href="../sections.html">How <Directory>, <Location>,
1618 <Files> sections work</a> for an explanation of how these
1619 different sections are combined when a request is received.
1620 <directive type="section">If</directive> has the same precedence
1621 and usage as <directive type="section">Files</directive></seealso>
1622 </directivesynopsis>
1624 <directivesynopsis type="section">
1625 <name>IfDefine</name>
1626 <description>Encloses directives that will be processed only
1627 if a test is true at startup</description>
1628 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1629 </IfDefine></syntax>
1630 <contextlist><context>server config</context><context>virtual host</context>
1631 <context>directory</context><context>.htaccess</context>
1633 <override>All</override>
1636 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1637 </code> section is used to mark directives that are conditional. The
1638 directives within an <directive type="section">IfDefine</directive>
1639 section are only processed if the <var>test</var> is true. If <var>
1640 test</var> is false, everything between the start and end markers is
1643 <p>The <var>test</var> in the <directive type="section"
1644 >IfDefine</directive> section directive can be one of two forms:</p>
1647 <li><var>parameter-name</var></li>
1649 <li><code>!</code><var>parameter-name</var></li>
1652 <p>In the former case, the directives between the start and end
1653 markers are only processed if the parameter named
1654 <var>parameter-name</var> is defined. The second format reverses
1655 the test, and only processes the directives if
1656 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1658 <p>The <var>parameter-name</var> argument is a define as given on the
1659 <program>httpd</program> command line via <code>-D<var>parameter</var>
1660 </code> at the time the server was started or by the <directive
1661 module="core">Define</directive> directive.</p>
1663 <p><directive type="section">IfDefine</directive> sections are
1664 nest-able, which can be used to implement simple
1665 multiple-parameter tests. Example:</p>
1668 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1671 <IfDefine ReverseProxy><br />
1673 LoadModule proxy_module modules/mod_proxy.so<br />
1674 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1675 <IfDefine UseCache><br />
1677 LoadModule cache_module modules/mod_cache.so<br />
1678 <IfDefine MemCache><br />
1680 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1682 </IfDefine><br />
1683 <IfDefine !MemCache><br />
1685 LoadModule cache_disk_module modules/mod_cache_disk.so<br />
1694 </directivesynopsis>
1696 <directivesynopsis type="section">
1697 <name>IfModule</name>
1698 <description>Encloses directives that are processed conditional on the
1699 presence or absence of a specific module</description>
1700 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1701 </IfModule></syntax>
1702 <contextlist><context>server config</context><context>virtual host</context>
1703 <context>directory</context><context>.htaccess</context>
1705 <override>All</override>
1706 <compatibility>Module identifiers are available in version 2.1 and
1707 later.</compatibility>
1710 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1711 section is used to mark directives that are conditional on the presence of
1712 a specific module. The directives within an <directive type="section"
1713 >IfModule</directive> section are only processed if the <var>test</var>
1714 is true. If <var>test</var> is false, everything between the start and
1715 end markers is ignored.</p>
1717 <p>The <var>test</var> in the <directive type="section"
1718 >IfModule</directive> section directive can be one of two forms:</p>
1721 <li><var>module</var></li>
1723 <li>!<var>module</var></li>
1726 <p>In the former case, the directives between the start and end
1727 markers are only processed if the module named <var>module</var>
1728 is included in Apache httpd -- either compiled in or
1729 dynamically loaded using <directive module="mod_so"
1730 >LoadModule</directive>. The second format reverses the test,
1731 and only processes the directives if <var>module</var> is
1732 <strong>not</strong> included.</p>
1734 <p>The <var>module</var> argument can be either the module identifier or
1735 the file name of the module, at the time it was compiled. For example,
1736 <code>rewrite_module</code> is the identifier and
1737 <code>mod_rewrite.c</code> is the file name. If a module consists of
1738 several source files, use the name of the file containing the string
1739 <code>STANDARD20_MODULE_STUFF</code>.</p>
1741 <p><directive type="section">IfModule</directive> sections are
1742 nest-able, which can be used to implement simple multiple-module
1745 <note>This section should only be used if you need to have one
1746 configuration file that works whether or not a specific module
1747 is available. In normal operation, directives need not be
1748 placed in <directive type="section">IfModule</directive>
1751 </directivesynopsis>
1754 <name>Include</name>
1755 <description>Includes other configuration files from within
1756 the server configuration files</description>
1757 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1758 <contextlist><context>server config</context><context>virtual host</context>
1759 <context>directory</context>
1761 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1762 wildcard matching available in 2.3.6 and later</compatibility>
1765 <p>This directive allows inclusion of other configuration files
1766 from within the server configuration files.</p>
1768 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1769 in the filename or directory parts of the path to include several files
1770 at once, in alphabetical order. In addition, if
1771 <directive>Include</directive> points to a directory, rather than a file,
1772 Apache httpd will read all files in that directory and any subdirectory.
1773 However, including entire directories is not recommended, because it is
1774 easy to accidentally leave temporary files in a directory that can cause
1775 <program>httpd</program> to fail. Instead, we encourage you to use the
1776 wildcard syntax shown below, to include files that match a particular
1777 pattern, such as *.conf, for example.</p>
1779 <p>When a wildcard is specified for a <strong>file</strong> component of
1780 the path, and no file matches the wildcard, the
1781 <directive module="core">Include</directive>
1782 directive will be <strong>silently ignored</strong>. When a wildcard is
1783 specified for a <strong>directory</strong> component of the path, and
1784 no directory matches the wildcard, the
1785 <directive module="core">Include</directive> directive will
1786 <strong>fail with an error</strong> saying the directory cannot be found.
1789 <p>For further control over the behaviour of the server when no files or
1790 directories match, prefix the path with the modifiers <var>optional</var>
1791 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1792 file or directory that does not match will be silently ignored. If
1793 <var>strict</var> is specified, any wildcard file or directory that does
1794 not match at least one file will cause server startup to fail.</p>
1796 <p>When a directory or file component of the path is
1797 specified exactly, and that directory or file does not exist,
1798 <directive module="core">Include</directive> directive will fail with an
1799 error saying the file or directory cannot be found.</p>
1801 <p>The file path specified may be an absolute path, or may be relative
1802 to the <directive module="core">ServerRoot</directive> directory.</p>
1807 Include /usr/local/apache2/conf/ssl.conf<br />
1808 Include /usr/local/apache2/conf/vhosts/*.conf
1811 <p>Or, providing paths relative to your <directive
1812 module="core">ServerRoot</directive> directory:</p>
1815 Include conf/ssl.conf<br />
1816 Include conf/vhosts/*.conf
1819 <p>Wildcards may be included in the directory or file portion of the
1820 path. In the following example, the server will fail to load if no
1821 directories match conf/vhosts/*, but will load successfully if no
1822 files match *.conf.</p>
1825 Include conf/vhosts/*/vhost.conf<br />
1826 Include conf/vhosts/*/*.conf
1829 <p>In this example, the server will fail to load if either
1830 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1833 Include strict conf/vhosts/*/*.conf
1836 <p>In this example, the server load successfully if either conf/vhosts/*
1837 matches no directories, or if *.conf matches no files:</p>
1840 Include optional conf/vhosts/*/*.conf
1845 <seealso><program>apachectl</program></seealso>
1846 </directivesynopsis>
1849 <name>KeepAlive</name>
1850 <description>Enables HTTP persistent connections</description>
1851 <syntax>KeepAlive On|Off</syntax>
1852 <default>KeepAlive On</default>
1853 <contextlist><context>server config</context><context>virtual host</context>
1857 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1858 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1859 which allow multiple requests to be sent over the same TCP
1860 connection. In some cases this has been shown to result in an
1861 almost 50% speedup in latency times for HTML documents with
1862 many images. To enable Keep-Alive connections, set
1863 <code>KeepAlive On</code>.</p>
1865 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1866 used if they are specifically requested by a client. In
1867 addition, a Keep-Alive connection with an HTTP/1.0 client can
1868 only be used when the length of the content is known in
1869 advance. This implies that dynamic content such as CGI output,
1870 SSI pages, and server-generated directory listings will
1871 generally not use Keep-Alive connections to HTTP/1.0 clients.
1872 For HTTP/1.1 clients, persistent connections are the default
1873 unless otherwise specified. If the client requests it, chunked
1874 encoding will be used in order to send content of unknown
1875 length over persistent connections.</p>
1877 <p>When a client uses a Keep-Alive connection it will be counted
1878 as a single "request" for the <directive module="mpm_common"
1879 >MaxConnectionsPerChild</directive> directive, regardless
1880 of how many requests are sent using the connection.</p>
1883 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1884 </directivesynopsis>
1887 <name>KeepAliveTimeout</name>
1888 <description>Amount of time the server will wait for subsequent
1889 requests on a persistent connection</description>
1890 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1891 <default>KeepAliveTimeout 5</default>
1892 <contextlist><context>server config</context><context>virtual host</context>
1894 <compatibility>Specifying a value in milliseconds is available in
1895 Apache httpd 2.3.2 and later</compatibility>
1898 <p>The number of seconds Apache httpd will wait for a subsequent
1899 request before closing the connection. By adding a postfix of ms the
1900 timeout can be also set in milliseconds. Once a request has been
1901 received, the timeout value specified by the
1902 <directive module="core">Timeout</directive> directive applies.</p>
1904 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1905 may cause performance problems in heavily loaded servers. The
1906 higher the timeout, the more server processes will be kept
1907 occupied waiting on connections with idle clients.</p>
1909 <p>In a name-based virtual host context, the value of the first
1910 defined virtual host best matching the local IP and port will be used.</p>
1912 </directivesynopsis>
1914 <directivesynopsis type="section">
1916 <description>Restrict enclosed access controls to only certain HTTP
1917 methods</description>
1918 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1919 </Limit></syntax>
1920 <contextlist><context>directory</context><context>.htaccess</context>
1922 <override>AuthConfig, Limit</override>
1925 <p>Access controls are normally effective for
1926 <strong>all</strong> access methods, and this is the usual
1927 desired behavior. <strong>In the general case, access control
1928 directives should not be placed within a
1929 <directive type="section">Limit</directive> section.</strong></p>
1931 <p>The purpose of the <directive type="section">Limit</directive>
1932 directive is to restrict the effect of the access controls to the
1933 nominated HTTP methods. For all other methods, the access
1934 restrictions that are enclosed in the <directive
1935 type="section">Limit</directive> bracket <strong>will have no
1936 effect</strong>. The following example applies the access control
1937 only to the methods <code>POST</code>, <code>PUT</code>, and
1938 <code>DELETE</code>, leaving all other methods unprotected:</p>
1941 <Limit POST PUT DELETE><br />
1943 Require valid-user<br />
1948 <p>The method names listed can be one or more of: <code>GET</code>,
1949 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1950 <code>CONNECT</code>, <code>OPTIONS</code>,
1951 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1952 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1953 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1954 case-sensitive.</strong> If <code>GET</code> is used it will also
1955 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1956 cannot be limited (see <directive module="core"
1957 >TraceEnable</directive>).</p>
1959 <note type="warning">A <directive type="section"
1960 module="core">LimitExcept</directive> section should always be
1961 used in preference to a <directive type="section">Limit</directive>
1962 section when restricting access, since a <directive type="section"
1963 module="core">LimitExcept</directive> section provides protection
1964 against arbitrary methods.</note>
1966 <p>The <directive type="section">Limit</directive> and
1967 <directive type="section" module="core">LimitExcept</directive>
1968 directives may be nested. In this case, each successive level of
1969 <directive type="section">Limit</directive> or <directive
1970 type="section" module="core">LimitExcept</directive> directives must
1971 further restrict the set of methods to which access controls apply.</p>
1973 <note type="warning">When using
1974 <directive type="section">Limit</directive> or
1975 <directive type="section">LimitExcept</directive> directives with
1976 the <directive module="mod_authz_core">Require</directive> directive,
1977 note that the first <directive module="mod_authz_core">Require</directive>
1978 to succeed authorizes the request, regardless of the presence of other
1979 <directive module="mod_authz_core">Require</directive> directives.</note>
1981 <p>For example, given the following configuration, all users will
1982 be authorized for <code>POST</code> requests, and the
1983 <code>Require group editors</code> directive will be ignored
1987 <LimitExcept GET>
1991 </LimitExcept><br />
1994 Require group editors
1999 </directivesynopsis>
2001 <directivesynopsis type="section">
2002 <name>LimitExcept</name>
2003 <description>Restrict access controls to all HTTP methods
2004 except the named ones</description>
2005 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2006 </LimitExcept></syntax>
2007 <contextlist><context>directory</context><context>.htaccess</context>
2009 <override>AuthConfig, Limit</override>
2012 <p><directive type="section">LimitExcept</directive> and
2013 <code></LimitExcept></code> are used to enclose
2014 a group of access control directives which will then apply to any
2015 HTTP access method <strong>not</strong> listed in the arguments;
2016 i.e., it is the opposite of a <directive type="section"
2017 module="core">Limit</directive> section and can be used to control
2018 both standard and nonstandard/unrecognized methods. See the
2019 documentation for <directive module="core"
2020 type="section">Limit</directive> for more details.</p>
2025 <LimitExcept POST GET><br />
2027 Require valid-user<br />
2029 </LimitExcept>
2033 </directivesynopsis>
2036 <name>LimitInternalRecursion</name>
2037 <description>Determine maximum number of internal redirects and nested
2038 subrequests</description>
2039 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2040 <default>LimitInternalRecursion 10</default>
2041 <contextlist><context>server config</context><context>virtual host</context>
2043 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
2046 <p>An internal redirect happens, for example, when using the <directive
2047 module="mod_actions">Action</directive> directive, which internally
2048 redirects the original request to a CGI script. A subrequest is Apache httpd's
2049 mechanism to find out what would happen for some URI if it were requested.
2050 For example, <module>mod_dir</module> uses subrequests to look for the
2051 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2054 <p><directive>LimitInternalRecursion</directive> prevents the server
2055 from crashing when entering an infinite loop of internal redirects or
2056 subrequests. Such loops are usually caused by misconfigurations.</p>
2058 <p>The directive stores two different limits, which are evaluated on
2059 per-request basis. The first <var>number</var> is the maximum number of
2060 internal redirects, that may follow each other. The second <var>number</var>
2061 determines, how deep subrequests may be nested. If you specify only one
2062 <var>number</var>, it will be assigned to both limits.</p>
2064 <example><title>Example</title>
2065 LimitInternalRecursion 5
2068 </directivesynopsis>
2071 <name>LimitRequestBody</name>
2072 <description>Restricts the total size of the HTTP request body sent
2073 from the client</description>
2074 <syntax>LimitRequestBody <var>bytes</var></syntax>
2075 <default>LimitRequestBody 0</default>
2076 <contextlist><context>server config</context><context>virtual host</context>
2077 <context>directory</context><context>.htaccess</context>
2079 <override>All</override>
2082 <p>This directive specifies the number of <var>bytes</var> from 0
2083 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2084 request body. See the note below for the limited applicability
2085 to proxy requests.</p>
2087 <p>The <directive>LimitRequestBody</directive> directive allows
2088 the user to set a limit on the allowed size of an HTTP request
2089 message body within the context in which the directive is given
2090 (server, per-directory, per-file or per-location). If the client
2091 request exceeds that limit, the server will return an error
2092 response instead of servicing the request. The size of a normal
2093 request message body will vary greatly depending on the nature of
2094 the resource and the methods allowed on that resource. CGI scripts
2095 typically use the message body for retrieving form information.
2096 Implementations of the <code>PUT</code> method will require
2097 a value at least as large as any representation that the server
2098 wishes to accept for that resource.</p>
2100 <p>This directive gives the server administrator greater
2101 control over abnormal client request behavior, which may be
2102 useful for avoiding some forms of denial-of-service
2105 <p>If, for example, you are permitting file upload to a particular
2106 location, and wish to limit the size of the uploaded file to 100K,
2107 you might use the following directive:</p>
2110 LimitRequestBody 102400
2113 <note><p>For a full description of how this directive is interpreted by
2114 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2118 </directivesynopsis>
2121 <name>LimitRequestFields</name>
2122 <description>Limits the number of HTTP request header fields that
2123 will be accepted from the client</description>
2124 <syntax>LimitRequestFields <var>number</var></syntax>
2125 <default>LimitRequestFields 100</default>
2126 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2129 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2130 32767. The default value is defined by the compile-time
2131 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2134 <p>The <directive>LimitRequestFields</directive> directive allows
2135 the server administrator to modify the limit on the number of
2136 request header fields allowed in an HTTP request. A server needs
2137 this value to be larger than the number of fields that a normal
2138 client request might include. The number of request header fields
2139 used by a client rarely exceeds 20, but this may vary among
2140 different client implementations, often depending upon the extent
2141 to which a user has configured their browser to support detailed
2142 content negotiation. Optional HTTP extensions are often expressed
2143 using request header fields.</p>
2145 <p>This directive gives the server administrator greater
2146 control over abnormal client request behavior, which may be
2147 useful for avoiding some forms of denial-of-service attacks.
2148 The value should be increased if normal clients see an error
2149 response from the server that indicates too many fields were
2150 sent in the request.</p>
2155 LimitRequestFields 50
2158 <note type="warning"><title>Warning</title>
2159 <p> When name-based virtual hosting is used, the value for this
2160 directive is taken from the default (first-listed) virtual host for the
2161 local IP and port combination</p>.
2165 </directivesynopsis>
2168 <name>LimitRequestFieldSize</name>
2169 <description>Limits the size of the HTTP request header allowed from the
2170 client</description>
2171 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2172 <default>LimitRequestFieldSize 8190</default>
2173 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2176 <p>This directive specifies the number of <var>bytes</var>
2177 that will be allowed in an HTTP request header.</p>
2179 <p>The <directive>LimitRequestFieldSize</directive> directive
2180 allows the server administrator to reduce or increase the limit
2181 on the allowed size of an HTTP request header field. A server
2182 needs this value to be large enough to hold any one header field
2183 from a normal client request. The size of a normal request header
2184 field will vary greatly among different client implementations,
2185 often depending upon the extent to which a user has configured
2186 their browser to support detailed content negotiation. SPNEGO
2187 authentication headers can be up to 12392 bytes.</p>
2189 <p>This directive gives the server administrator greater
2190 control over abnormal client request behavior, which may be
2191 useful for avoiding some forms of denial-of-service attacks.</p>
2196 LimitRequestFieldSize 4094
2199 <note>Under normal conditions, the value should not be changed from
2202 <note type="warning"><title>Warning</title>
2203 <p> When name-based virtual hosting is used, the value for this
2204 directive is taken from the default (first-listed) virtual host best
2205 matching the current IP address and port combination.</p>
2208 </directivesynopsis>
2211 <name>LimitRequestLine</name>
2212 <description>Limit the size of the HTTP request line that will be accepted
2213 from the client</description>
2214 <syntax>LimitRequestLine <var>bytes</var></syntax>
2215 <default>LimitRequestLine 8190</default>
2216 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2219 <p>This directive sets the number of <var>bytes</var> that will be
2220 allowed on the HTTP request-line.</p>
2222 <p>The <directive>LimitRequestLine</directive> directive allows
2223 the server administrator to reduce or increase the limit on the allowed size
2224 of a client's HTTP request-line. Since the request-line consists of the
2225 HTTP method, URI, and protocol version, the
2226 <directive>LimitRequestLine</directive> directive places a
2227 restriction on the length of a request-URI allowed for a request
2228 on the server. A server needs this value to be large enough to
2229 hold any of its resource names, including any information that
2230 might be passed in the query part of a <code>GET</code> request.</p>
2232 <p>This directive gives the server administrator greater
2233 control over abnormal client request behavior, which may be
2234 useful for avoiding some forms of denial-of-service attacks.</p>
2239 LimitRequestLine 4094
2242 <note>Under normal conditions, the value should not be changed from
2245 <note type="warning"><title>Warning</title>
2246 <p> When name-based virtual hosting is used, the value for this
2247 directive is taken from the default (first-listed) virtual host best
2248 matching the current IP address and port combination.</p>
2252 </directivesynopsis>
2255 <name>LimitXMLRequestBody</name>
2256 <description>Limits the size of an XML-based request body</description>
2257 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2258 <default>LimitXMLRequestBody 1000000</default>
2259 <contextlist><context>server config</context><context>virtual host</context>
2260 <context>directory</context><context>.htaccess</context></contextlist>
2261 <override>All</override>
2264 <p>Limit (in bytes) on maximum size of an XML-based request
2265 body. A value of <code>0</code> will disable any checking.</p>
2270 LimitXMLRequestBody 0
2274 </directivesynopsis>
2276 <directivesynopsis type="section">
2277 <name>Location</name>
2278 <description>Applies the enclosed directives only to matching
2280 <syntax><Location
2281 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2282 <contextlist><context>server config</context><context>virtual host</context>
2286 <p>The <directive type="section">Location</directive> directive
2287 limits the scope of the enclosed directives by URL. It is similar to the
2288 <directive type="section" module="core">Directory</directive>
2289 directive, and starts a subsection which is terminated with a
2290 <code></Location></code> directive. <directive
2291 type="section">Location</directive> sections are processed in the
2292 order they appear in the configuration file, after the <directive
2293 type="section" module="core">Directory</directive> sections and
2294 <code>.htaccess</code> files are read, and after the <directive
2295 type="section" module="core">Files</directive> sections.</p>
2297 <p><directive type="section">Location</directive> sections operate
2298 completely outside the filesystem. This has several consequences.
2299 Most importantly, <directive type="section">Location</directive>
2300 directives should not be used to control access to filesystem
2301 locations. Since several different URLs may map to the same
2302 filesystem location, such access controls may by circumvented.</p>
2304 <p>The enclosed directives will be applied to the request if the path component
2305 of the URL meets <em>any</em> of the following criteria:
2308 <li>The specified location matches exactly the path component of the URL.
2310 <li>The specified location, which ends in a forward slash, is a prefix
2311 of the path component of the URL (treated as a context root).
2313 <li>The specified location, with the addition of a trailing slash, is a
2314 prefix of the path component of the URL (also treated as a context root).
2318 In the example below, where no trailing slash is used, requests to
2319 /private1, /private1/ and /private1/file.txt will have the enclosed
2320 directives applied, but /private1other would not.
2323 <Location /private1>
2327 In the example below, where a trailing slash is used, requests to
2328 /private2/ and /private2/file.txt will have the enclosed
2329 directives applied, but /private2 and /private2other would not.
2332 <Location /private2<em>/</em>>
2336 <note><title>When to use <directive
2337 type="section">Location</directive></title>
2339 <p>Use <directive type="section">Location</directive> to apply
2340 directives to content that lives outside the filesystem. For
2341 content that lives in the filesystem, use <directive
2342 type="section" module="core">Directory</directive> and <directive
2343 type="section" module="core">Files</directive>. An exception is
2344 <code><Location /></code>, which is an easy way to
2345 apply a configuration to the entire server.</p>
2348 <p>For all origin (non-proxy) requests, the URL to be matched is a
2349 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2350 port, or query string may be included.</em> For proxy requests, the
2351 URL to be matched is of the form
2352 <code>scheme://servername/path</code>, and you must include the
2355 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2356 any single character, and <code>*</code> matches any sequences of
2357 characters. Neither wildcard character matches a / in the URL-path.</p>
2359 <p><glossary ref="regex">Regular expressions</glossary>
2360 can also be used, with the addition of the <code>~</code>
2361 character. For example:</p>
2364 <Location ~ "/(extra|special)/data">
2367 <p>would match URLs that contained the substring <code>/extra/data</code>
2368 or <code>/special/data</code>. The directive <directive
2369 type="section" module="core">LocationMatch</directive> behaves
2370 identical to the regex version of <directive
2371 type="section">Location</directive>, and is preferred, for the
2372 simple reason that <code>~</code> is hard to distinguish from
2373 <code>-</code> in many fonts.</p>
2375 <p>The <directive type="section">Location</directive>
2376 functionality is especially useful when combined with the
2377 <directive module="core">SetHandler</directive>
2378 directive. For example, to enable status requests, but allow them
2379 only from browsers at <code>example.com</code>, you might use:</p>
2382 <Location /status><br />
2384 SetHandler server-status<br />
2385 Require host example.com<br />
2390 <note><title>Note about / (slash)</title>
2391 <p>The slash character has special meaning depending on where in a
2392 URL it appears. People may be used to its behavior in the filesystem
2393 where multiple adjacent slashes are frequently collapsed to a single
2394 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2395 <code>/home/foo</code>). In URL-space this is not necessarily true.
2396 The <directive type="section" module="core">LocationMatch</directive>
2397 directive and the regex version of <directive type="section"
2398 >Location</directive> require you to explicitly specify multiple
2399 slashes if that is your intention.</p>
2401 <p>For example, <code><LocationMatch ^/abc></code> would match
2402 the request URL <code>/abc</code> but not the request URL <code>
2403 //abc</code>. The (non-regex) <directive type="section"
2404 >Location</directive> directive behaves similarly when used for
2405 proxy requests. But when (non-regex) <directive type="section"
2406 >Location</directive> is used for non-proxy requests it will
2407 implicitly match multiple slashes with a single slash. For example,
2408 if you specify <code><Location /abc/def></code> and the
2409 request is to <code>/abc//def</code> then it will match.</p>
2412 <seealso><a href="../sections.html">How <Directory>, <Location>
2413 and <Files> sections work</a> for an explanation of how these
2414 different sections are combined when a request is received.</seealso>
2415 <seealso><directive module="core">LocationMatch</directive></seealso>
2416 </directivesynopsis>
2418 <directivesynopsis type="section">
2419 <name>LocationMatch</name>
2420 <description>Applies the enclosed directives only to regular-expression
2421 matching URLs</description>
2422 <syntax><LocationMatch
2423 <var>regex</var>> ... </LocationMatch></syntax>
2424 <contextlist><context>server config</context><context>virtual host</context>
2428 <p>The <directive type="section">LocationMatch</directive> directive
2429 limits the scope of the enclosed directives by URL, in an identical manner
2430 to <directive module="core" type="section">Location</directive>. However,
2431 it takes a <glossary ref="regex">regular expression</glossary>
2432 as an argument instead of a simple string. For example:</p>
2435 <LocationMatch "/(extra|special)/data">
2438 <p>would match URLs that contained the substring <code>/extra/data</code>
2439 or <code>/special/data</code>.</p>
2442 <seealso><a href="../sections.html">How <Directory>, <Location>
2443 and <Files> sections work</a> for an explanation of how these
2444 different sections are combined when a request is received</seealso>
2445 </directivesynopsis>
2448 <name>LogLevel</name>
2449 <description>Controls the verbosity of the ErrorLog</description>
2450 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2451 [<var>module</var>:<var>level</var>] ...
2453 <default>LogLevel warn</default>
2454 <contextlist><context>server config</context><context>virtual host</context>
2455 <context>directory</context>
2457 <compatibility>Per-module and per-directory configuration is available in
2458 Apache HTTP Server 2.3.6 and later</compatibility>
2461 <p><directive>LogLevel</directive> adjusts the verbosity of the
2462 messages recorded in the error logs (see <directive
2463 module="core">ErrorLog</directive> directive). The following
2464 <var>level</var>s are available, in order of decreasing
2468 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2471 <th><strong>Level</strong> </th>
2473 <th><strong>Description</strong> </th>
2475 <th><strong>Example</strong> </th>
2479 <td><code>emerg</code> </td>
2481 <td>Emergencies - system is unusable.</td>
2483 <td>"Child cannot open lock file. Exiting"</td>
2487 <td><code>alert</code> </td>
2489 <td>Action must be taken immediately.</td>
2491 <td>"getpwuid: couldn't determine user name from uid"</td>
2495 <td><code>crit</code> </td>
2497 <td>Critical Conditions.</td>
2499 <td>"socket: Failed to get a socket, exiting child"</td>
2503 <td><code>error</code> </td>
2505 <td>Error conditions.</td>
2507 <td>"Premature end of script headers"</td>
2511 <td><code>warn</code> </td>
2513 <td>Warning conditions.</td>
2515 <td>"child process 1234 did not exit, sending another
2520 <td><code>notice</code> </td>
2522 <td>Normal but significant condition.</td>
2524 <td>"httpd: caught SIGBUS, attempting to dump core in
2529 <td><code>info</code> </td>
2531 <td>Informational.</td>
2533 <td>"Server seems busy, (you may need to increase
2534 StartServers, or Min/MaxSpareServers)..."</td>
2538 <td><code>debug</code> </td>
2540 <td>Debug-level messages</td>
2542 <td>"Opening config file ..."</td>
2545 <td><code>trace1</code> </td>
2547 <td>Trace messages</td>
2549 <td>"proxy: FTP: control connection complete"</td>
2552 <td><code>trace2</code> </td>
2554 <td>Trace messages</td>
2556 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2559 <td><code>trace3</code> </td>
2561 <td>Trace messages</td>
2563 <td>"openssl: Handshake: start"</td>
2566 <td><code>trace4</code> </td>
2568 <td>Trace messages</td>
2570 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2573 <td><code>trace5</code> </td>
2575 <td>Trace messages</td>
2577 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2580 <td><code>trace6</code> </td>
2582 <td>Trace messages</td>
2584 <td>"cache lookup FAILED, forcing new map lookup"</td>
2587 <td><code>trace7</code> </td>
2589 <td>Trace messages, dumping large amounts of data</td>
2591 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2594 <td><code>trace8</code> </td>
2596 <td>Trace messages, dumping large amounts of data</td>
2598 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2602 <p>When a particular level is specified, messages from all
2603 other levels of higher significance will be reported as well.
2604 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2605 then messages with log levels of <code>notice</code> and
2606 <code>warn</code> will also be posted.</p>
2608 <p>Using a level of at least <code>crit</code> is
2617 <note><title>Note</title>
2618 <p>When logging to a regular file messages of the level
2619 <code>notice</code> cannot be suppressed and thus are always
2620 logged. However, this doesn't apply when logging is done
2621 using <code>syslog</code>.</p>
2624 <p>Specifying a level without a module name will reset the level
2625 for all modules to that level. Specifying a level with a module
2626 name will set the level for that module only. It is possible to
2627 use the module source file name, the module identifier, or the
2628 module identifier with the trailing <code>_module</code> omitted
2629 as module specification. This means the following three specifications
2633 LogLevel info ssl:warn<br />
2634 LogLevel info mod_ssl.c:warn<br />
2635 LogLevel info ssl_module:warn<br />
2638 <p>It is also possible to change the level per directory:</p>
2642 <Directory /usr/local/apache/htdocs/app><br />
2643 LogLevel debug<br />
2648 Per directory loglevel configuration only affects messages that are
2649 logged after the request has been parsed and that are associated with
2650 the request. Log messages which are associated with the connection or
2651 the server are not affected.
2654 </directivesynopsis>
2657 <name>MaxKeepAliveRequests</name>
2658 <description>Number of requests allowed on a persistent
2659 connection</description>
2660 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2661 <default>MaxKeepAliveRequests 100</default>
2662 <contextlist><context>server config</context><context>virtual host</context>
2666 <p>The <directive>MaxKeepAliveRequests</directive> directive
2667 limits the number of requests allowed per connection when
2668 <directive module="core" >KeepAlive</directive> is on. If it is
2669 set to <code>0</code>, unlimited requests will be allowed. We
2670 recommend that this setting be kept to a high value for maximum
2671 server performance.</p>
2676 MaxKeepAliveRequests 500
2679 </directivesynopsis>
2683 <description>Configures mutex mechanism and lock file directory for all
2684 or specified mutexes</description>
2685 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2686 <default>Mutex default</default>
2687 <contextlist><context>server config</context></contextlist>
2688 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2691 <p>The <directive>Mutex</directive> directive sets the mechanism,
2692 and optionally the lock file location, that httpd and modules use
2693 to serialize access to resources. Specify <code>default</code> as
2694 the first argument to change the settings for all mutexes; specify
2695 a mutex name (see table below) as the first argument to override
2696 defaults only for that mutex.</p>
2698 <p>The <directive>Mutex</directive> directive is typically used in
2699 the following exceptional situations:</p>
2702 <li>change the mutex mechanism when the default mechanism selected
2703 by <glossary>APR</glossary> has a functional or performance
2706 <li>change the directory used by file-based mutexes when the
2707 default directory does not support locking</li>
2710 <note><title>Supported modules</title>
2711 <p>This directive only configures mutexes which have been registered
2712 with the core server using the <code>ap_mutex_register()</code> API.
2713 All modules bundled with httpd support the <directive>Mutex</directive>
2714 directive, but third-party modules may not. Consult the documentation
2715 of the third-party module, which must indicate the mutex name(s) which
2716 can be configured if this directive is supported.</p>
2719 <p>The following mutex <em>mechanisms</em> are available:</p>
2721 <li><code>default | yes</code>
2722 <p>This selects the default locking implementation, as determined by
2723 <glossary>APR</glossary>. The default locking implementation can
2724 be displayed by running <program>httpd</program> with the
2725 <code>-V</code> option.</p></li>
2727 <li><code>none | no</code>
2728 <p>This effectively disables the mutex, and is only allowed for a
2729 mutex if the module indicates that it is a valid choice. Consult the
2730 module documentation for more information.</p></li>
2732 <li><code>posixsem</code>
2733 <p>This is a mutex variant based on a Posix semaphore.</p>
2735 <note type="warning"><title>Warning</title>
2736 <p>The semaphore ownership is not recovered if a thread in the process
2737 holding the mutex segfaults, resulting in a hang of the web server.</p>
2741 <li><code>sysvsem</code>
2742 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2744 <note type="warning"><title>Warning</title>
2745 <p>It is possible to "leak" SysV semaphores if processes crash
2746 before the semaphore is removed.</p>
2749 <note type="warning"><title>Security</title>
2750 <p>The semaphore API allows for a denial of service attack by any
2751 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2752 all CGIs, unless you use something like <program>suexec</program>
2753 or <code>cgiwrapper</code>).</p>
2757 <li><code>sem</code>
2758 <p>This selects the "best" available semaphore implementation, choosing
2759 between Posix and SystemV IPC semaphores, in that order.</p></li>
2761 <li><code>pthread</code>
2762 <p>This is a mutex variant based on cross-process Posix thread
2765 <note type="warning"><title>Warning</title>
2766 <p>On most systems, if a child process terminates abnormally while
2767 holding a mutex that uses this implementation, the server will deadlock
2768 and stop responding to requests. When this occurs, the server will
2769 require a manual restart to recover.</p>
2770 <p>Solaris is a notable exception as it provides a mechanism which
2771 usually allows the mutex to be recovered after a child process
2772 terminates abnormally while holding a mutex.</p>
2773 <p>If your system implements the
2774 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2775 to use the <code>pthread</code> option safely.</p>
2779 <li><code>fcntl:/path/to/mutex</code>
2780 <p>This is a mutex variant where a physical (lock-)file and the
2781 <code>fcntl()</code> function are used as the mutex.</p>
2783 <note type="warning"><title>Warning</title>
2784 <p>When multiple mutexes based on this mechanism are used within
2785 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2786 can be reported for valid mutex operations if <code>fcntl()</code>
2787 is not thread-aware, such as on Solaris.</p>
2791 <li><code>flock:/path/to/mutex</code>
2792 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2793 with the exception that the <code>flock()</code> function is used to
2794 provide file locking.</p></li>
2796 <li><code>file:/path/to/mutex</code>
2797 <p>This selects the "best" available file locking implementation,
2798 choosing between <code>fcntl</code> and <code>flock</code>, in that
2802 <p>Most mechanisms are only available on selected platforms, where the
2803 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2804 which aren't available on all platforms are <em>posixsem</em>,
2805 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2806 <em>flock</em>, and <em>file</em>.</p>
2808 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2809 the path, if provided, is a directory where the lock file will be created.
2810 The default directory is httpd's run-time file directory relative to
2811 <directive module="core">ServerRoot</directive>. Always use a local disk
2812 filesystem for <code>/path/to/mutex</code> and never a directory residing
2813 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2814 type, an optional instance string provided by the module, and unless the
2815 <code>OmitPID</code> keyword is specified, the process id of the httpd
2816 parent process will be appended to to make the file name unique, avoiding
2817 conflicts when multiple httpd instances share a lock file directory. For
2818 example, if the mutex name is <code>mpm-accept</code> and the lock file
2819 directory is <code>/var/httpd/locks</code>, the lock file name for the
2820 httpd instance with parent process id 12345 would be
2821 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2823 <note type="warning"><title>Security</title>
2824 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2825 directory such as <code>/var/tmp</code> because someone could create
2826 a denial of service attack and prevent the server from starting by
2827 creating a lockfile with the same name as the one the server will try
2831 <p>The following table documents the names of mutexes used by httpd
2832 and bundled modules.</p>
2834 <table border="1" style="zebra">
2838 <th>Protected resource</th>
2841 <td><code>mpm-accept</code></td>
2842 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2843 <td>incoming connections, to avoid the thundering herd problem;
2844 for more information, refer to the
2845 <a href="../misc/perf-tuning.html">performance tuning</a>
2849 <td><code>authdigest-client</code></td>
2850 <td><module>mod_auth_digest</module></td>
2851 <td>client list in shared memory</td>
2854 <td><code>authdigest-opaque</code></td>
2855 <td><module>mod_auth_digest</module></td>
2856 <td>counter in shared memory</td>
2859 <td><code>ldap-cache</code></td>
2860 <td><module>mod_ldap</module></td>
2861 <td>LDAP result cache</td>
2864 <td><code>rewrite-map</code></td>
2865 <td><module>mod_rewrite</module></td>
2866 <td>communication with external mapping programs, to avoid
2867 intermixed I/O from multiple requests</td>
2870 <td><code>ssl-cache</code></td>
2871 <td><module>mod_ssl</module></td>
2872 <td>SSL session cache</td>
2875 <td><code>ssl-stapling</code></td>
2876 <td><module>mod_ssl</module></td>
2877 <td>OCSP stapling response cache</td>
2880 <td><code>watchdog-callback</code></td>
2881 <td><module>mod_watchdog</module></td>
2882 <td>callback function of a particular client module</td>
2886 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2887 parent process id from the lock file name.</p>
2889 <p>In the following example, the mutex mechanism for the MPM accept
2890 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2891 with the associated lock file created in directory
2892 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2893 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2896 Mutex default sysvsem<br />
2897 Mutex mpm-accept fcntl:/var/httpd/locks
2900 </directivesynopsis>
2903 <name>NameVirtualHost</name>
2904 <description>Designates an IP address for name-virtual
2905 hosting</description>
2906 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2907 <contextlist><context>server config</context></contextlist>
2911 <p>Prior to 2.3.11, <directive>NameVirtualHost</directive> was required
2912 to instruct the server that a particular IP address and port combination
2913 was usable as a name-based virtual host. In 2.3.11 and later,
2914 any time an IP address and port combination is used in multiple virtual
2915 hosts, name-based virtual hosting is automatically enabled for that address.</p>
2917 <p>This directive currently has no effect.</p>
2920 <seealso><a href="../vhosts/">Virtual Hosts
2921 documentation</a></seealso>
2923 </directivesynopsis>
2926 <name>Options</name>
2927 <description>Configures what features are available in a particular
2928 directory</description>
2930 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2931 <default>Options FollowSymlinks</default>
2932 <contextlist><context>server config</context><context>virtual host</context>
2933 <context>directory</context><context>.htaccess</context>
2935 <override>Options</override>
2936 <compatibility>The default was changed from All to FollowSymlinks in 2.3.11</compatibility>
2939 <p>The <directive>Options</directive> directive controls which
2940 server features are available in a particular directory.</p>
2942 <p><var>option</var> can be set to <code>None</code>, in which
2943 case none of the extra features are enabled, or one or more of
2947 <dt><code>All</code></dt>
2949 <dd>All options except for <code>MultiViews</code>.</dd>
2951 <dt><code>ExecCGI</code></dt>
2954 Execution of CGI scripts using <module>mod_cgi</module>
2957 <dt><code>FollowSymLinks</code></dt>
2960 The server will follow symbolic links in this directory. This is
2961 the default setting.
2963 <p>Even though the server follows the symlink it does <em>not</em>
2964 change the pathname used to match against <directive type="section"
2965 module="core">Directory</directive> sections.</p>
2966 <p>Note also, that this option <strong>gets ignored</strong> if set
2967 inside a <directive type="section" module="core">Location</directive>
2969 <p>Omitting this option should not be considered a security restriction,
2970 since symlink testing is subject to race conditions that make it
2974 <dt><code>Includes</code></dt>
2977 Server-side includes provided by <module>mod_include</module>
2980 <dt><code>IncludesNOEXEC</code></dt>
2984 Server-side includes are permitted, but the <code>#exec
2985 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2986 possible to <code>#include virtual</code> CGI scripts from
2987 <directive module="mod_alias">ScriptAlias</directive>ed
2990 <dt><code>Indexes</code></dt>
2993 If a URL which maps to a directory is requested, and there
2994 is no <directive module="mod_dir">DirectoryIndex</directive>
2995 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2996 <module>mod_autoindex</module> will return a formatted listing
2997 of the directory.</dd>
2999 <dt><code>MultiViews</code></dt>
3002 <a href="../content-negotiation.html">Content negotiated</a>
3003 "MultiViews" are allowed using
3004 <module>mod_negotiation</module>.
3005 <note><title>Note</title> <p>This option gets ignored if set
3006 anywhere other than <directive module="core" type="section"
3007 >Directory</directive>, as <module>mod_negotiation</module>
3008 needs real resources to compare against and evaluate from.</p></note>
3011 <dt><code>SymLinksIfOwnerMatch</code></dt>
3013 <dd>The server will only follow symbolic links for which the
3014 target file or directory is owned by the same user id as the
3017 <note><title>Note</title> <p>This option gets ignored if
3018 set inside a <directive module="core"
3019 type="section">Location</directive> section.</p>
3020 <p>This option should not be considered a security restriction,
3021 since symlink testing is subject to race conditions that make it
3022 circumventable.</p></note>
3026 <p>Normally, if multiple <directive>Options</directive> could
3027 apply to a directory, then the most specific one is used and
3028 others are ignored; the options are not merged. (See <a
3029 href="../sections.html#mergin">how sections are merged</a>.)
3030 However if <em>all</em> the options on the
3031 <directive>Options</directive> directive are preceded by a
3032 <code>+</code> or <code>-</code> symbol, the options are
3033 merged. Any options preceded by a <code>+</code> are added to the
3034 options currently in force, and any options preceded by a
3035 <code>-</code> are removed from the options currently in
3038 <note><title>Note</title>
3039 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3040 <code>-</code> with those without is not valid syntax, and will be
3041 rejected during server startup by the syntax check with an abort.</p>
3044 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3047 <Directory /web/docs><br />
3049 Options Indexes FollowSymLinks<br />
3051 </Directory><br />
3053 <Directory /web/docs/spec><br />
3055 Options Includes<br />
3060 <p>then only <code>Includes</code> will be set for the
3061 <code>/web/docs/spec</code> directory. However if the second
3062 <directive>Options</directive> directive uses the <code>+</code> and
3063 <code>-</code> symbols:</p>
3066 <Directory /web/docs><br />
3068 Options Indexes FollowSymLinks<br />
3070 </Directory><br />
3072 <Directory /web/docs/spec><br />
3074 Options +Includes -Indexes<br />
3079 <p>then the options <code>FollowSymLinks</code> and
3080 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3083 <note><title>Note</title>
3084 <p>Using <code>-IncludesNOEXEC</code> or
3085 <code>-Includes</code> disables server-side includes completely
3086 regardless of the previous setting.</p>
3089 <p>The default in the absence of any other settings is
3090 <code>FollowSymlinks</code>.</p>
3092 </directivesynopsis>
3095 <name>Protocol</name>
3096 <description>Protocol for a listening socket</description>
3097 <syntax>Protocol <var>protocol</var></syntax>
3098 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3099 <compatibility>Available in Apache 2.1.5 and later.
3100 On Windows from Apache 2.3.3 and later.</compatibility>
3103 <p>This directive specifies the protocol used for a specific listening socket.
3104 The protocol is used to determine which module should handle a request, and
3105 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3108 <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>
3110 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3116 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3118 <seealso><directive>AcceptFilter</directive></seealso>
3119 <seealso><directive module="mpm_common">Listen</directive></seealso>
3120 </directivesynopsis>
3124 <name>RLimitCPU</name>
3125 <description>Limits the CPU consumption of processes launched
3126 by Apache httpd children</description>
3127 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3128 <default>Unset; uses operating system defaults</default>
3129 <contextlist><context>server config</context><context>virtual host</context>
3130 <context>directory</context><context>.htaccess</context></contextlist>
3131 <override>All</override>
3134 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3135 resource limit for all processes and the second parameter sets
3136 the maximum resource limit. Either parameter can be a number,
3137 or <code>max</code> to indicate to the server that the limit should
3138 be set to the maximum allowed by the operating system
3139 configuration. Raising the maximum resource limit requires that
3140 the server is running as <code>root</code>, or in the initial startup
3143 <p>This applies to processes forked off from Apache httpd children
3144 servicing requests, not the Apache httpd children themselves. This
3145 includes CGI scripts and SSI exec commands, but not any
3146 processes forked off from the Apache httpd parent such as piped
3149 <p>CPU resource limits are expressed in seconds per
3152 <seealso><directive module="core">RLimitMEM</directive></seealso>
3153 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3154 </directivesynopsis>
3157 <name>RLimitMEM</name>
3158 <description>Limits the memory consumption of processes launched
3159 by Apache httpd children</description>
3160 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3161 <default>Unset; uses operating system defaults</default>
3162 <contextlist><context>server config</context><context>virtual host</context>
3163 <context>directory</context><context>.htaccess</context></contextlist>
3164 <override>All</override>
3167 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3168 resource limit for all processes and the second parameter sets
3169 the maximum resource limit. Either parameter can be a number,
3170 or <code>max</code> to indicate to the server that the limit should
3171 be set to the maximum allowed by the operating system
3172 configuration. Raising the maximum resource limit requires that
3173 the server is running as <code>root</code>, or in the initial startup
3176 <p>This applies to processes forked off from Apache httpd children
3177 servicing requests, not the Apache httpd children themselves. This
3178 includes CGI scripts and SSI exec commands, but not any
3179 processes forked off from the Apache httpd parent such as piped
3182 <p>Memory resource limits are expressed in bytes per
3185 <seealso><directive module="core">RLimitCPU</directive></seealso>
3186 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3187 </directivesynopsis>
3190 <name>RLimitNPROC</name>
3191 <description>Limits the number of processes that can be launched by
3192 processes launched by Apache httpd children</description>
3193 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3194 <default>Unset; uses operating system defaults</default>
3195 <contextlist><context>server config</context><context>virtual host</context>
3196 <context>directory</context><context>.htaccess</context></contextlist>
3197 <override>All</override>
3200 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3201 resource limit for all processes and the second parameter sets
3202 the maximum resource limit. Either parameter can be a number,
3203 or <code>max</code> to indicate to the server that the limit
3204 should be set to the maximum allowed by the operating system
3205 configuration. Raising the maximum resource limit requires that
3206 the server is running as <code>root</code>, or in the initial startup
3209 <p>This applies to processes forked off from Apache httpd children
3210 servicing requests, not the Apache httpd children themselves. This
3211 includes CGI scripts and SSI exec commands, but not any
3212 processes forked off from the Apache httpd parent such as piped
3215 <p>Process limits control the number of processes per user.</p>
3217 <note><title>Note</title>
3218 <p>If CGI processes are <strong>not</strong> running
3219 under user ids other than the web server user id, this directive
3220 will limit the number of processes that the server itself can
3221 create. Evidence of this situation will be indicated by
3222 <strong><code>cannot fork</code></strong> messages in the
3223 <code>error_log</code>.</p>
3226 <seealso><directive module="core">RLimitMEM</directive></seealso>
3227 <seealso><directive module="core">RLimitCPU</directive></seealso>
3228 </directivesynopsis>
3231 <name>ScriptInterpreterSource</name>
3232 <description>Technique for locating the interpreter for CGI
3233 scripts</description>
3234 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3235 <default>ScriptInterpreterSource Script</default>
3236 <contextlist><context>server config</context><context>virtual host</context>
3237 <context>directory</context><context>.htaccess</context></contextlist>
3238 <override>FileInfo</override>
3239 <compatibility>Win32 only;
3240 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3241 later</compatibility>
3244 <p>This directive is used to control how Apache httpd finds the
3245 interpreter used to run CGI scripts. The default setting is
3246 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3247 by the shebang line (first line, starting with <code>#!</code>) in the
3248 script. On Win32 systems this line usually looks like:</p>
3251 #!C:/Perl/bin/perl.exe
3254 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3260 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3261 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3262 searched using the script file extension (e.g., <code>.pl</code>) as a
3263 search key. The command defined by the registry subkey
3264 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3265 <code>Shell\Open\Command</code> is used to open the script file. If the
3266 registry keys cannot be found, Apache httpd falls back to the behavior of the
3267 <code>Script</code> option.</p>
3269 <note type="warning"><title>Security</title>
3270 <p>Be careful when using <code>ScriptInterpreterSource
3271 Registry</code> with <directive
3272 module="mod_alias">ScriptAlias</directive>'ed directories, because
3273 Apache httpd will try to execute <strong>every</strong> file within this
3274 directory. The <code>Registry</code> setting may cause undesired
3275 program calls on files which are typically not executed. For
3276 example, the default open command on <code>.htm</code> files on
3277 most Windows systems will execute Microsoft Internet Explorer, so
3278 any HTTP request for an <code>.htm</code> file existing within the
3279 script directory would start the browser in the background on the
3280 server. This is a good way to crash your system within a minute or
3284 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3285 2.0 does the same thing as <code>Registry</code> but uses only the
3286 subkey <code>Shell\ExecCGI\Command</code>. The
3287 <code>ExecCGI</code> key is not a common one. It must be
3288 configured manually in the windows registry and hence prevents
3289 accidental program calls on your system.</p>
3291 </directivesynopsis>
3294 <name>SeeRequestTail</name>
3295 <description>Determine if mod_status displays the first 63 characters
3296 of a request or the last 63, assuming the request itself is greater than
3297 63 chars.</description>
3298 <syntax>SeeRequestTail On|Off</syntax>
3299 <default>SeeRequestTail Off</default>
3300 <contextlist><context>server config</context></contextlist>
3301 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3304 <p>mod_status with <code>ExtendedStatus On</code>
3305 displays the actual request being handled.
3306 For historical purposes, only 63 characters of the request
3307 are actually stored for display purposes. This directive
3308 controls whether the 1st 63 characters are stored (the previous
3309 behavior and the default) or if the last 63 characters are. This
3310 is only applicable, of course, if the length of the request is
3311 64 characters or greater.</p>
3313 <p>If Apache httpd is handling <code
3314 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3315 > mod_status displays as follows:
3320 <th>Off (default)</th>
3321 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3325 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3330 </directivesynopsis>
3333 <name>ServerAdmin</name>
3334 <description>Email address that the server includes in error
3335 messages sent to the client</description>
3336 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3337 <contextlist><context>server config</context><context>virtual host</context>
3341 <p>The <directive>ServerAdmin</directive> sets the contact address
3342 that the server includes in any error messages it returns to the
3343 client. If the <code>httpd</code> doesn't recognize the supplied argument
3345 assumes, that it's an <var>email-address</var> and prepends it with
3346 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3347 actually use an email address, since there are a lot of CGI scripts that
3348 make that assumption. If you want to use an URL, it should point to another
3349 server under your control. Otherwise users may not be able to contact you in
3352 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3355 ServerAdmin www-admin@foo.example.com
3357 <p>as users do not always mention that they are talking about the
3360 </directivesynopsis>
3363 <name>ServerAlias</name>
3364 <description>Alternate names for a host used when matching requests
3365 to name-virtual hosts</description>
3366 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3367 <contextlist><context>virtual host</context></contextlist>
3370 <p>The <directive>ServerAlias</directive> directive sets the
3371 alternate names for a host, for use with <a
3372 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3373 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3376 <VirtualHost *:80><br />
3377 ServerName server.example.com<br />
3378 ServerAlias server server2.example.com server2<br />
3379 ServerAlias *.example.com<br />
3380 UseCanonicalName Off<br />
3382 </VirtualHost>
3385 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3386 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3387 </directivesynopsis>
3390 <name>ServerName</name>
3391 <description>Hostname and port that the server uses to identify
3392 itself</description>
3393 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3394 <contextlist><context>server config</context><context>virtual host</context>
3398 <p>The <directive>ServerName</directive> directive sets the
3399 request scheme, hostname and
3400 port that the server uses to identify itself. This is used when
3401 creating redirection URLs.</p>
3403 <p>Additionally, <directive>ServerName</directive> is used (possibly
3404 in conjunction with <directive>ServerAlias</directive>) to uniquely
3405 identify a virtual host, when using <a
3406 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3408 <p>For example, if the name of the
3409 machine hosting the web server is <code>simple.example.com</code>,
3410 but the machine also has the DNS alias <code>www.example.com</code>
3411 and you wish the web server to be so identified, the following
3412 directive should be used:</p>
3415 ServerName www.example.com
3418 <p>The <directive>ServerName</directive> directive
3419 may appear anywhere within the definition of a server. However,
3420 each appearance overrides the previous appearance (within that
3423 <p>If no <directive>ServerName</directive> is specified, then the
3424 server attempts to deduce the hostname by performing a reverse
3425 lookup on the IP address. If no port is specified in the
3426 <directive>ServerName</directive>, then the server will use the
3427 port from the incoming request. For optimal reliability and
3428 predictability, you should specify an explicit hostname and port
3429 using the <directive>ServerName</directive> directive.</p>
3431 <p>If you are using <a
3432 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3433 the <directive>ServerName</directive> inside a
3434 <directive type="section" module="core">VirtualHost</directive>
3435 section specifies what hostname must appear in the request's
3436 <code>Host:</code> header to match this virtual host.</p>
3438 <p>Sometimes, the server runs behind a device that processes SSL,
3439 such as a reverse proxy, load balancer or SSL offload
3440 appliance. When this is the case, specify the
3441 <code>https://</code> scheme and the port number to which the
3442 clients connect in the <directive>ServerName</directive> directive
3443 to make sure that the server generates the correct
3444 self-referential URLs.
3447 <p>See the description of the
3448 <directive module="core">UseCanonicalName</directive> and
3449 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3450 settings which determine whether self-referential URLs (e.g., by the
3451 <module>mod_dir</module> module) will refer to the
3452 specified port, or to the port number given in the client's request.
3455 <note type="warning">
3456 <p>Failure to set <directive>ServerName</directive> to a name that
3457 your server can resolve to an IP address will result in a startup
3458 warning. <code>httpd</code> will then use whatever hostname it can
3459 determine, using the system's <code>hostname</code> command. This
3460 will almost never be the hostname you actually want.</p>
3462 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3468 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3469 Apache HTTP Server</a></seealso>
3470 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3471 documentation</a></seealso>
3472 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3473 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3474 <seealso><directive module="core">ServerAlias</directive></seealso>
3475 </directivesynopsis>
3478 <name>ServerPath</name>
3479 <description>Legacy URL pathname for a name-based virtual host that
3480 is accessed by an incompatible browser</description>
3481 <syntax>ServerPath <var>URL-path</var></syntax>
3482 <contextlist><context>virtual host</context></contextlist>
3485 <p>The <directive>ServerPath</directive> directive sets the legacy
3486 URL pathname for a host, for use with <a
3487 href="../vhosts/">name-based virtual hosts</a>.</p>
3489 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3490 </directivesynopsis>
3493 <name>ServerRoot</name>
3494 <description>Base directory for the server installation</description>
3495 <syntax>ServerRoot <var>directory-path</var></syntax>
3496 <default>ServerRoot /usr/local/apache</default>
3497 <contextlist><context>server config</context></contextlist>
3500 <p>The <directive>ServerRoot</directive> directive sets the
3501 directory in which the server lives. Typically it will contain the
3502 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3503 paths in other configuration directives (such as <directive
3504 module="core">Include</directive> or <directive
3505 module="mod_so">LoadModule</directive>, for example) are taken as
3506 relative to this directory.</p>
3508 <example><title>Example</title>
3509 ServerRoot /home/httpd
3513 <seealso><a href="../invoking.html">the <code>-d</code>
3514 option to <code>httpd</code></a></seealso>
3515 <seealso><a href="../misc/security_tips.html#serverroot">the
3516 security tips</a> for information on how to properly set
3517 permissions on the <directive>ServerRoot</directive></seealso>
3518 </directivesynopsis>
3521 <name>ServerSignature</name>
3522 <description>Configures the footer on server-generated documents</description>
3523 <syntax>ServerSignature On|Off|EMail</syntax>
3524 <default>ServerSignature Off</default>
3525 <contextlist><context>server config</context><context>virtual host</context>
3526 <context>directory</context><context>.htaccess</context>
3528 <override>All</override>
3531 <p>The <directive>ServerSignature</directive> directive allows the
3532 configuration of a trailing footer line under server-generated
3533 documents (error messages, <module>mod_proxy</module> ftp directory
3534 listings, <module>mod_info</module> output, ...). The reason why you
3535 would want to enable such a footer line is that in a chain of proxies,
3536 the user often has no possibility to tell which of the chained servers
3537 actually produced a returned error message.</p>
3539 <p>The <code>Off</code>
3540 setting, which is the default, suppresses the footer line (and is
3541 therefore compatible with the behavior of Apache-1.2 and
3542 below). The <code>On</code> setting simply adds a line with the
3543 server version number and <directive
3544 module="core">ServerName</directive> of the serving virtual host,
3545 and the <code>EMail</code> setting additionally creates a
3546 "mailto:" reference to the <directive
3547 module="core">ServerAdmin</directive> of the referenced
3550 <p>After version 2.0.44, the details of the server version number
3551 presented are controlled by the <directive
3552 module="core">ServerTokens</directive> directive.</p>
3554 <seealso><directive module="core">ServerTokens</directive></seealso>
3555 </directivesynopsis>
3558 <name>ServerTokens</name>
3559 <description>Configures the <code>Server</code> HTTP response
3560 header</description>
3561 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3562 <default>ServerTokens Full</default>
3563 <contextlist><context>server config</context></contextlist>
3566 <p>This directive controls whether <code>Server</code> response
3567 header field which is sent back to clients includes a
3568 description of the generic OS-type of the server as well as
3569 information about compiled-in modules.</p>
3572 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3574 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3575 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3577 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3579 <dd>Server sends (<em>e.g.</em>): <code>Server:
3582 <dt><code>ServerTokens Major</code></dt>
3584 <dd>Server sends (<em>e.g.</em>): <code>Server:
3585 Apache/2</code></dd>
3587 <dt><code>ServerTokens Minor</code></dt>
3589 <dd>Server sends (<em>e.g.</em>): <code>Server:
3590 Apache/2.4</code></dd>
3592 <dt><code>ServerTokens Min[imal]</code></dt>
3594 <dd>Server sends (<em>e.g.</em>): <code>Server:
3595 Apache/2.4.1</code></dd>
3597 <dt><code>ServerTokens OS</code></dt>
3599 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3604 <p>This setting applies to the entire server, and cannot be
3605 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3607 <p>After version 2.0.44, this directive also controls the
3608 information presented by the <directive
3609 module="core">ServerSignature</directive> directive.</p>
3611 <note>Setting <directive>ServerTokens</directive> to less than
3612 <code>minimal</code> is not recommended because it makes it more
3613 difficult to debug interoperational problems. Also note that
3614 disabling the Server: header does nothing at all to make your
3615 server more secure; the idea of "security through obscurity"
3616 is a myth and leads to a false sense of safety.</note>
3619 <seealso><directive module="core">ServerSignature</directive></seealso>
3620 </directivesynopsis>
3623 <name>SetHandler</name>
3624 <description>Forces all matching files to be processed by a
3625 handler</description>
3626 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3627 <contextlist><context>server config</context><context>virtual host</context>
3628 <context>directory</context><context>.htaccess</context>
3630 <override>FileInfo</override>
3631 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3634 <p>When placed into an <code>.htaccess</code> file or a
3635 <directive type="section" module="core">Directory</directive> or
3636 <directive type="section" module="core">Location</directive>
3637 section, this directive forces all matching files to be parsed
3638 through the <a href="../handler.html">handler</a> given by
3639 <var>handler-name</var>. For example, if you had a directory you
3640 wanted to be parsed entirely as imagemap rule files, regardless
3641 of extension, you might put the following into an
3642 <code>.htaccess</code> file in that directory:</p>
3645 SetHandler imap-file
3648 <p>Another example: if you wanted to have the server display a
3649 status report whenever a URL of
3650 <code>http://servername/status</code> was called, you might put
3651 the following into <code>httpd.conf</code>:</p>
3654 <Location /status><br />
3656 SetHandler server-status<br />
3661 <p>You can override an earlier defined <directive>SetHandler</directive>
3662 directive by using the value <code>None</code>.</p>
3664 <note><title>Note</title>
3665 <p>Because <directive>SetHandler</directive> overrides default handlers,
3666 normal behaviour such as handling of URLs ending in a slash (/) as
3667 directories or index files is suppressed.</p></note>
3670 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3672 </directivesynopsis>
3675 <name>SetInputFilter</name>
3676 <description>Sets the filters that will process client requests and POST
3678 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3679 <contextlist><context>server config</context><context>virtual host</context>
3680 <context>directory</context><context>.htaccess</context>
3682 <override>FileInfo</override>
3685 <p>The <directive>SetInputFilter</directive> directive sets the
3686 filter or filters which will process client requests and POST
3687 input when they are received by the server. This is in addition to
3688 any filters defined elsewhere, including the
3689 <directive module="mod_mime">AddInputFilter</directive>
3692 <p>If more than one filter is specified, they must be separated
3693 by semicolons in the order in which they should process the
3696 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3697 </directivesynopsis>
3700 <name>SetOutputFilter</name>
3701 <description>Sets the filters that will process responses from the
3702 server</description>
3703 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3704 <contextlist><context>server config</context><context>virtual host</context>
3705 <context>directory</context><context>.htaccess</context>
3707 <override>FileInfo</override>
3710 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3711 which will process responses from the server before they are
3712 sent to the client. This is in addition to any filters defined
3713 elsewhere, including the
3714 <directive module="mod_mime">AddOutputFilter</directive>
3717 <p>For example, the following configuration will process all files
3718 in the <code>/www/data/</code> directory for server-side
3722 <Directory /www/data/><br />
3724 SetOutputFilter INCLUDES<br />
3729 <p>If more than one filter is specified, they must be separated
3730 by semicolons in the order in which they should process the
3733 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3734 </directivesynopsis>
3737 <name>TimeOut</name>
3738 <description>Amount of time the server will wait for
3739 certain events before failing a request</description>
3740 <syntax>TimeOut <var>seconds</var></syntax>
3741 <default>TimeOut 300</default>
3742 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3745 <p>The <directive>TimeOut</directive> directive defines the length
3746 of time Apache httpd will wait for I/O in various circumstances:</p>
3749 <li>When reading data from the client, the length of time to
3750 wait for a TCP packet to arrive if the read buffer is
3753 <li>When writing data to the client, the length of time to wait
3754 for an acknowledgement of a packet if the send buffer is
3757 <li>In <module>mod_cgi</module>, the length of time to wait for
3758 output from a CGI script.</li>
3760 <li>In <module>mod_ext_filter</module>, the length of time to
3761 wait for output from a filtering process.</li>
3763 <li>In <module>mod_proxy</module>, the default timeout value if
3764 <directive module="mod_proxy">ProxyTimeout</directive> is not
3769 </directivesynopsis>
3772 <name>TraceEnable</name>
3773 <description>Determines the behaviour on <code>TRACE</code> requests</description>
3774 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3775 <default>TraceEnable on</default>
3776 <contextlist><context>server config</context></contextlist>
3777 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3780 <p>This directive overrides the behavior of <code>TRACE</code> for both
3781 the core server and <module>mod_proxy</module>. The default
3782 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3783 RFC 2616, which disallows any request body to accompany the request.
3784 <code>TraceEnable off</code> causes the core server and
3785 <module>mod_proxy</module> to return a <code>405</code> (Method not
3786 allowed) error to the client.</p>
3788 <p>Finally, for testing and diagnostic purposes only, request
3789 bodies may be allowed using the non-compliant <code>TraceEnable
3790 extended</code> directive. The core (as an origin server) will
3791 restrict the request body to 64k (plus 8k for chunk headers if
3792 <code>Transfer-Encoding: chunked</code> is used). The core will
3793 reflect the full headers and all chunk headers with the response
3794 body. As a proxy server, the request body is not restricted to 64k.</p>
3796 </directivesynopsis>
3799 <name>UnDefine</name>
3800 <description>Undefine the existence of a variable</description>
3801 <syntax>UnDefine <var>parameter-name</var></syntax>
3802 <contextlist><context>server config</context></contextlist>
3805 <p>Undoes the effect of a <directive module="core">Define</directive> or
3806 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3807 <p>This directive can be used to toggle the use of <directive module="core"
3808 type="section">IfDefine</directive> sections without needing to alter
3809 <code>-D</code> arguments in any startup scripts.</p>
3811 </directivesynopsis>
3814 <name>UseCanonicalName</name>
3815 <description>Configures how the server determines its own name and
3817 <syntax>UseCanonicalName On|Off|DNS</syntax>
3818 <default>UseCanonicalName Off</default>
3819 <contextlist><context>server config</context><context>virtual host</context>
3820 <context>directory</context></contextlist>
3823 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3824 URL -- that is, a URL that refers back to the same server. With
3825 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3826 specified in the <directive module="core">ServerName</directive>
3827 directive to construct the canonical name for the server. This name
3828 is used in all self-referential URLs, and for the values of
3829 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3831 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3832 self-referential URLs using the hostname and port supplied by
3833 the client if any are supplied (otherwise it will use the
3834 canonical name, as defined above). These values are the same
3835 that are used to implement <a
3836 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3837 and are available with the same clients. The CGI variables
3838 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3839 constructed from the client supplied values as well.</p>
3841 <p>An example where this may be useful is on an intranet server
3842 where you have users connecting to the machine using short
3843 names such as <code>www</code>. You'll notice that if the users
3844 type a shortname, and a URL which is a directory, such as
3845 <code>http://www/splat</code>, <em>without the trailing
3846 slash</em> then Apache httpd will redirect them to
3847 <code>http://www.example.com/splat/</code>. If you have
3848 authentication enabled, this will cause the user to have to
3849 authenticate twice (once for <code>www</code> and once again
3850 for <code>www.example.com</code> -- see <a
3851 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3852 FAQ on this subject for more information</a>). But if
3853 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3854 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3856 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3857 which is intended for use with mass IP-based virtual hosting to
3858 support ancient clients that do not provide a
3859 <code>Host:</code> header. With this option Apache httpd does a
3860 reverse DNS lookup on the server IP address that the client
3861 connected to in order to work out self-referential URLs.</p>
3863 <note type="warning"><title>Warning</title>
3864 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3865 they may be broken by this option. The client is essentially free
3866 to give whatever value they want as a hostname. But if the CGI is
3867 only using <code>SERVER_NAME</code> to construct self-referential URLs
3868 then it should be just fine.</p>
3871 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3872 <seealso><directive module="core">ServerName</directive></seealso>
3873 <seealso><directive module="mpm_common">Listen</directive></seealso>
3874 </directivesynopsis>
3877 <name>UseCanonicalPhysicalPort</name>
3878 <description>Configures how the server determines its own port</description>
3879 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3880 <default>UseCanonicalPhysicalPort Off</default>
3881 <contextlist><context>server config</context><context>virtual host</context>
3882 <context>directory</context></contextlist>
3885 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3886 URL -- that is, a URL that refers back to the same server. With
3887 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3888 constructing the canonical port for the server to honor
3889 the <directive module="core">UseCanonicalName</directive> directive,
3890 provide the actual physical port number being used by this request
3891 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3892 Apache httpd will not ever use the actual physical port number, instead
3893 relying on all configured information to construct a valid port number.</p>
3895 <note><title>Note</title>
3896 <p>The ordering of the lookup when the physical port is used is as
3899 <dt><code>UseCanonicalName On</code></dt>
3902 <li>Port provided in <directive module="core">Servername</directive></li>
3903 <li>Physical port</li>
3904 <li>Default port</li>
3907 <dt><code>UseCanonicalName Off | DNS</code></dt>
3910 <li>Parsed port from <code>Host:</code> header</li>
3911 <li>Physical port</li>
3912 <li>Port provided in <directive module="core">Servername</directive></li>
3913 <li>Default port</li>
3918 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3919 physical ports are removed from the ordering.</p>
3923 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3924 <seealso><directive module="core">ServerName</directive></seealso>
3925 <seealso><directive module="mpm_common">Listen</directive></seealso>
3926 </directivesynopsis>
3928 <directivesynopsis type="section">
3929 <name>VirtualHost</name>
3930 <description>Contains directives that apply only to a specific
3931 hostname or IP address</description>
3932 <syntax><VirtualHost
3933 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3934 ...> ... </VirtualHost></syntax>
3935 <contextlist><context>server config</context></contextlist>
3938 <p><directive type="section">VirtualHost</directive> and
3939 <code></VirtualHost></code> are used to enclose a group of
3940 directives that will apply only to a particular virtual host. Any
3941 directive that is allowed in a virtual host context may be
3942 used. When the server receives a request for a document on a
3943 particular virtual host, it uses the configuration directives
3944 enclosed in the <directive type="section">VirtualHost</directive>
3945 section. <var>Addr</var> can be any of the following, optionally followed by
3946 a colon and a port number (or *):</p>
3949 <li>The IP address of the virtual host;</li>
3951 <li>A fully qualified domain name for the IP address of the
3952 virtual host (not recommended);</li>
3954 <li>The character <code>*</code>, which acts as a wildcard and matches
3955 any IP address.</li>
3957 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
3961 <example><title>Example</title>
3962 <VirtualHost 10.1.2.3:80><br />
3964 ServerAdmin webmaster@host.example.com<br />
3965 DocumentRoot /www/docs/host.example.com<br />
3966 ServerName host.example.com<br />
3967 ErrorLog logs/host.example.com-error_log<br />
3968 TransferLog logs/host.example.com-access_log<br />
3970 </VirtualHost>
3974 <p>IPv6 addresses must be specified in square brackets because
3975 the optional port number could not be determined otherwise. An
3976 IPv6 example is shown below:</p>
3979 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80><br />
3981 ServerAdmin webmaster@host.example.com<br />
3982 DocumentRoot /www/docs/host.example.com<br />
3983 ServerName host.example.com<br />
3984 ErrorLog logs/host.example.com-error_log<br />
3985 TransferLog logs/host.example.com-access_log<br />
3987 </VirtualHost>
3990 <p>Each Virtual Host must correspond to a different IP address,
3991 different port number or a different host name for the server,
3992 in the former case the server machine must be configured to
3993 accept IP packets for multiple addresses. (If the machine does
3994 not have multiple network interfaces, then this can be
3995 accomplished with the <code>ifconfig alias</code> command -- if
3996 your OS supports it).</p>
3998 <note><title>Note</title>
3999 <p>The use of <directive type="section">VirtualHost</directive> does
4000 <strong>not</strong> affect what addresses Apache httpd listens on. You
4001 may need to ensure that Apache httpd is listening on the correct addresses
4002 using <directive module="mpm_common">Listen</directive>.</p>
4005 <p>A <directive module="core">ServerName</directive> should be
4006 specified inside each <directive
4007 type="section">VirtualHost</directive> block. If it is absent, the
4008 <directive module="core">ServerName</directive> from the "main"
4009 server configuration will be inherited.</p>
4011 <p>When a request is received, the server first maps it to the best matching
4012 <directive type="section">VirtualHost</directive> based on the local
4013 IP address and port combination only. Non-wildcards have a higher
4014 precedence. If no match based on IP and port occurs at all, the
4015 "main" server configuration is used.</p>
4017 <p>If multiple virtual hosts contain the best matching IP address and port,
4018 the server selects from these virtual hosts the best match based on the
4019 requested hostname. If no matching name-based virtual host is found,
4020 then the first listed virtual host that matched the IP address will be
4021 used. As a consequence, the first listed virtual host for a given IP address
4022 and port combination is default virtual host for that IP and port
4025 <note type="warning"><title>Security</title>
4026 <p>See the <a href="../misc/security_tips.html">security tips</a>
4027 document for details on why your security could be compromised if the
4028 directory where log files are stored is writable by anyone other
4029 than the user that starts the server.</p>
4032 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4033 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4034 Apache HTTP Server</a></seealso>
4035 <seealso><a href="../bind.html">Setting
4036 which addresses and ports Apache HTTP Server uses</a></seealso>
4037 <seealso><a href="../sections.html">How <Directory>, <Location>
4038 and <Files> sections work</a> for an explanation of how these
4039 different sections are combined when a request is received</seealso>
4040 </directivesynopsis>