2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2002-2005 The Apache Software Foundation or its licensors, as
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 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>AcceptPathInfo</name>
32 <description>Resources accept trailing pathname information</description>
33 <syntax>AcceptPathInfo On|Off|Default</syntax>
34 <default>AcceptPathInfo Default</default>
35 <contextlist><context>server config</context>
36 <context>virtual host</context><context>directory</context>
37 <context>.htaccess</context></contextlist>
38 <override>FileInfo</override>
39 <compatibility>Available in Apache 2.0.30 and later</compatibility>
43 <p>This directive controls whether requests that contain trailing
44 pathname information that follows an actual filename (or
45 non-existent file in an existing directory) will be accepted or
46 rejected. The trailing pathname information can be made
47 available to scripts in the <code>PATH_INFO</code> environment
50 <p>For example, assume the location <code>/test/</code> points to
51 a directory that contains only the single file
52 <code>here.html</code>. Then requests for
53 <code>/test/here.html/more</code> and
54 <code>/test/nothere.html/more</code> both collect
55 <code>/more</code> as <code>PATH_INFO</code>.</p>
57 <p>The three possible arguments for the
58 <directive>AcceptPathInfo</directive> directive are:</p>
60 <dt><code>Off</code></dt><dd>A request will only be accepted if it
61 maps to a literal path that exists. Therefore a request with
62 trailing pathname information after the true filename such as
63 <code>/test/here.html/more</code> in the above example will return
64 a 404 NOT FOUND error.</dd>
66 <dt><code>On</code></dt><dd>A request will be accepted if a
67 leading path component maps to a file that exists. The above
68 example <code>/test/here.html/more</code> will be accepted if
69 <code>/test/here.html</code> maps to a valid file.</dd>
71 <dt><code>Default</code></dt><dd>The treatment of requests with
72 trailing pathname information is determined by the <a
73 href="../handler.html">handler</a> responsible for the request.
74 The core handler for normal files defaults to rejecting
75 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
76 href="mod_cgi.html">cgi-script</a> and <a
77 href="mod_isapi.html">isapi-isa</a>, generally accept
78 <code>PATH_INFO</code> by default.</dd>
81 <p>The primary purpose of the <code>AcceptPathInfo</code>
82 directive is to allow you to override the handler's choice of
83 accepting or rejecting <code>PATH_INFO</code>. This override is required,
84 for example, when you use a <a href="../filter.html">filter</a>, such
85 as <a href="mod_include.html">INCLUDES</a>, to generate content
86 based on <code>PATH_INFO</code>. The core handler would usually reject
87 the request, so you can use the following configuration to enable
91 <Files "mypaths.shtml"><br />
93 Options +Includes<br />
94 SetOutputFilter INCLUDES<br />
95 AcceptPathInfo On<br />
104 <name>AccessFileName</name>
105 <description>Name of the distributed configuration file</description>
106 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
107 <default>AccessFileName .htaccess</default>
108 <contextlist><context>server config</context><context>virtual host</context>
112 <p>While processing a request the server looks for
113 the first existing configuration file from this list of names in
114 every directory of the path to the document, if distributed
115 configuration files are <a href="#allowoverride">enabled for that
116 directory</a>. For example:</p>
122 <p>before returning the document
123 <code>/usr/local/web/index.html</code>, the server will read
124 <code>/.acl</code>, <code>/usr/.acl</code>,
125 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
126 for directives, unless they have been disabled with</p>
129 <Directory /><br />
131 AllowOverride None<br />
136 <seealso><directive module="core">AllowOverride</directive></seealso>
137 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
138 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
142 <name>AddDefaultCharset</name>
143 <description>Default charset parameter to be added when a response
144 content-type is <code>text/plain</code> or <code>text/html</code></description>
145 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
146 <default>AddDefaultCharset Off</default>
147 <contextlist><context>server config</context>
148 <context>virtual host</context><context>directory</context>
149 <context>.htaccess</context></contextlist>
150 <override>FileInfo</override>
153 <p>This directive specifies a default value for the media type
154 charset parameter (the name of a character encoding) to be added
155 to a response if and only if the response's content-type is either
156 <code>text/plain</code> or <code>text/html</code>. This should override
157 any charset specified in the body of the response via a <code>META</code>
158 element, though the exact behavior is often dependent on the user's client
159 configuration. A setting of <code>AddDefaultCharset Off</code>
160 disables this functionality. <code>AddDefaultCharset On</code> enables
161 a default charset of <code>iso-8859-1</code>. Any other value is assumed
162 to be the <var>charset</var> to be used, which should be one of the
163 <a href="http://www.iana.org/assignments/character-sets">IANA registered
164 charset values</a> for use in MIME media types.
168 AddDefaultCharset utf-8
171 <p><directive>AddDefaultCharset</directive> should only be used when all
172 of the text resources to which it applies are known to be in that
173 character encoding and it is too inconvenient to label their charset
174 individually. One such example is to add the charset parameter
175 to resources containing generated content, such as legacy CGI
176 scripts, that might be vulnerable to cross-site scripting attacks
177 due to user-provided data being included in the output. Note, however,
178 that a better solution is to just fix (or delete) those scripts, since
179 setting a default charset does not protect users that have enabled
180 the "auto-detect character encoding" feature on their browser.</p>
182 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
186 <name>AddOutputFilterByType</name>
187 <description>assigns an output filter to a particular MIME-type</description>
188 <syntax>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
189 <var>MIME-type</var> [<var>MIME-type</var>] ...</syntax>
190 <contextlist><context>server config</context>
191 <context>virtual host</context><context>directory</context>
192 <context>.htaccess</context></contextlist>
193 <override>FileInfo</override>
194 <compatibility>Available in Apache 2.0.33 and later</compatibility>
197 <p>This directive activates a particular output <a
198 href="../filter.html">filter</a> for a request depending on the
199 response MIME-type.</p>
201 <p>The following example uses the <code>DEFLATE</code> filter, which
202 is provided by <module>mod_deflate</module>. It will compress all
203 output (either static or dynamic) which is labeled as
204 <code>text/html</code> or <code>text/plain</code> before it is sent
208 AddOutputFilterByType DEFLATE text/html text/plain
211 <p>If you want the content to be processed by more than one filter, their
212 names have to be separated by semicolons. It's also possible to use one
213 <directive>AddOutputFilterByType</directive> directive for each of
216 <p>The configuration below causes all script output labeled as
217 <code>text/html</code> to be processed at first by the
218 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
222 <Location /cgi-bin/><br />
224 Options Includes<br />
225 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
230 <note type="warning"><title>Note</title>
231 <p>Enabling filters with <directive>AddOutputFilterByType</directive>
232 may fail partially or completely in some cases. For example, no
233 filters are applied if the MIME-type could not be determined and falls
234 back to the <directive module="core">DefaultType</directive> setting,
235 even if the <directive module="core">DefaultType</directive> is the
238 <p>However, if you want to make sure, that the filters will be
239 applied, assign the content type to a resource explicitly, for
240 example with <directive module="mod_mime">AddType</directive> or
241 <directive module="core">ForceType</directive>. Setting the
242 content type within a (non-nph) CGI script is also safe.</p>
244 <p>The by-type output filters are never applied on proxy requests.</p>
248 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
249 <seealso><directive module="core">SetOutputFilter</directive></seealso>
250 <seealso><a href="../filter.html">filters</a></seealso>
254 <name>AllowEncodedSlashes</name>
255 <description>Determines whether encoded path separators in URLs are allowed to
256 be passed through</description>
257 <syntax>AllowEncodedSlashes On|Off</syntax>
258 <default>AllowEncodedSlashes Off</default>
259 <contextlist><context>server config</context><context>virtual host</context>
261 <compatibility>Available in Apache 2.0.46 and later</compatibility>
264 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
265 which contain encoded path separators (<code>%2F</code> for <code>/</code>
266 and additionally <code>%5C</code> for <code>\</code> on according systems)
267 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
269 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
270 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
272 <note><title>Note</title>
273 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
274 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
275 according systems) will be left as such in the otherwise decoded URL
279 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
283 <name>AllowOverride</name>
284 <description>Types of directives that are allowed in
285 <code>.htaccess</code> files</description>
286 <syntax>AllowOverride All|None|<var>directive-type</var>
287 [<var>directive-type</var>] ...</syntax>
288 <default>AllowOverride All</default>
289 <contextlist><context>directory</context></contextlist>
292 <p>When the server finds an <code>.htaccess</code> file (as
293 specified by <directive module="core">AccessFileName</directive>)
294 it needs to know which directives declared in that file can override
295 earlier configuration directives.</p>
297 <note><title>Only available in <Directory> sections</title>
298 <directive>AllowOverride</directive> is valid only in
299 <directive type="section" module="core">Directory</directive>
300 sections specified without regular expressions, not in <directive
301 type="section" module="core">Location</directive>, <directive
302 module="core" type="section">DirectoryMatch</directive> or
303 <directive type="section" module="core">Files</directive> sections.
306 <p>When this directive is set to <code>None</code>, then
307 <a href="#accessfilename">.htaccess</a> files are completely ignored.
308 In this case, the server will not even attempt to read
309 <code>.htaccess</code> files in the filesystem.</p>
311 <p>When this directive is set to <code>All</code>, then any
312 directive which has the .htaccess <a
313 href="directive-dict.html#Context">Context</a> is allowed in
314 <code>.htaccess</code> files.</p>
316 <p>The <var>directive-type</var> can be one of the following
317 groupings of directives.</p>
324 Allow use of the authorization directives (<directive
325 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
326 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
327 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
328 <directive module="core">AuthName</directive>,
329 <directive module="core">AuthType</directive>, <directive
330 module="mod_authn_file">AuthUserFile</directive>, <directive
331 module="core">Require</directive>, <em>etc.</em>).</dd>
336 Allow use of the directives controlling document types (<directive
337 module="core">DefaultType</directive>, <directive
338 module="core">ErrorDocument</directive>, <directive
339 module="core">ForceType</directive>, <directive
340 module="mod_negotiation">LanguagePriority</directive>,
341 <directive module="core">SetHandler</directive>, <directive
342 module="core">SetInputFilter</directive>, <directive
343 module="core">SetOutputFilter</directive>, and
344 <module>mod_mime</module> Add* and Remove*
345 directives, <em>etc.</em>).</dd>
350 Allow use of the directives controlling directory indexing
352 module="mod_autoindex">AddDescription</directive>,
353 <directive module="mod_autoindex">AddIcon</directive>, <directive
354 module="mod_autoindex">AddIconByEncoding</directive>,
355 <directive module="mod_autoindex">AddIconByType</directive>,
356 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
357 module="mod_dir">DirectoryIndex</directive>, <directive
358 module="mod_autoindex">FancyIndexing</directive>, <directive
359 module="mod_autoindex">HeaderName</directive>, <directive
360 module="mod_autoindex">IndexIgnore</directive>, <directive
361 module="mod_autoindex">IndexOptions</directive>, <directive
362 module="mod_autoindex">ReadmeName</directive>,
368 Allow use of the directives controlling host access (<directive
369 module="mod_authz_host">Allow</directive>, <directive
370 module="mod_authz_host">Deny</directive> and <directive
371 module="mod_authz_host">Order</directive>).</dd>
373 <dt>Options[=<var>Option</var>,...]</dt>
376 Allow use of the directives controlling specific directory
377 features (<directive module="core">Options</directive> and
378 <directive module="mod_include">XBitHack</directive>).
379 An equal sign may be given followed by a comma (but no spaces)
380 separated lists of options that may be set using the <directive
381 module="core">Options</directive> command.</dd>
387 AllowOverride AuthConfig Indexes
390 <p>In the example above all directives that are neither in the group
391 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
395 <seealso><directive module="core">AccessFileName</directive></seealso>
396 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
397 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
401 <name>AuthName</name>
402 <description>Authorization realm for use in HTTP
403 authentication</description>
404 <syntax>AuthName <var>auth-domain</var></syntax>
405 <contextlist><context>directory</context><context>.htaccess</context>
407 <override>AuthConfig</override>
410 <p>This directive sets the name of the authorization realm for a
411 directory. This realm is given to the client so that the user
412 knows which username and password to send.
413 <directive>AuthName</directive> takes a single argument; if the
414 realm name contains spaces, it must be enclosed in quotation
415 marks. It must be accompanied by <directive
416 module="core">AuthType</directive> and <directive
417 module="core">Require</directive> directives, and directives such
418 as <directive module="mod_authn_file">AuthUserFile</directive> and
419 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
425 AuthName "Top Secret"
428 <p>The string provided for the <code>AuthName</code> is what will
429 appear in the password dialog provided by most browsers.</p>
432 href="../howto/auth.html">Authentication, Authorization, and
433 Access Control</a></seealso>
437 <name>AuthType</name>
438 <description>Type of user authentication</description>
439 <syntax>AuthType Basic|Digest</syntax>
440 <contextlist><context>directory</context><context>.htaccess</context>
442 <override>AuthConfig</override>
445 <p>This directive selects the type of user authentication for a
446 directory. Only <code>Basic</code> and <code>Digest</code> are
447 currently implemented.
449 It must be accompanied by <directive
450 module="core">AuthName</directive> and <directive
451 module="core">Require</directive> directives, and directives such
452 as <directive module="mod_authn_file">AuthUserFile</directive> and
453 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
456 <seealso><a href="../howto/auth.html">Authentication, Authorization,
457 and Access Control</a></seealso>
461 <name>CGIMapExtension</name>
462 <description>Technique for locating the interpreter for CGI
463 scripts</description>
464 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
465 <contextlist><context>directory</context><context>.htaccess</context>
467 <override>FileInfo</override>
468 <compatibility>NetWare only</compatibility>
471 <p>This directive is used to control how Apache finds the
472 interpreter used to run CGI scripts. For example, setting
473 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
474 cause all CGI script files with a <code>.foo</code> extension to
475 be passed to the FOO interpreter.</p>
480 <name>ContentDigest</name>
481 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
482 headers</description>
483 <syntax>ContentDigest On|Off</syntax>
484 <default>ContentDigest Off</default>
485 <contextlist><context>server config</context><context>virtual host</context>
486 <context>directory</context><context>.htaccess</context>
488 <override>Options</override>
489 <status>Experimental</status>
492 <p>This directive enables the generation of
493 <code>Content-MD5</code> headers as defined in RFC1864
494 respectively RFC2068.</p>
496 <p>MD5 is an algorithm for computing a "message digest"
497 (sometimes called "fingerprint") of arbitrary-length data, with
498 a high degree of confidence that any alterations in the data
499 will be reflected in alterations in the message digest.</p>
501 <p>The <code>Content-MD5</code> header provides an end-to-end
502 message integrity check (MIC) of the entity-body. A proxy or
503 client may check this header for detecting accidental
504 modification of the entity-body in transit. Example header:</p>
507 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
510 <p>Note that this can cause performance problems on your server
511 since the message digest is computed on every request (the
512 values are not cached).</p>
514 <p><code>Content-MD5</code> is only sent for documents served
515 by the <module>core</module>, and not by any module. For example,
516 SSI documents, output from CGI scripts, and byte range responses
517 do not have this header.</p>
522 <name>DefaultType</name>
523 <description>MIME content-type that will be sent if the
524 server cannot determine a type in any other way</description>
525 <syntax>DefaultType <var>MIME-type</var></syntax>
526 <default>DefaultType text/plain</default>
527 <contextlist><context>server config</context><context>virtual host</context>
528 <context>directory</context><context>.htaccess</context>
530 <override>FileInfo</override>
533 <p>There will be times when the server is asked to provide a
534 document whose type cannot be determined by its MIME types
537 <p>The server must inform the client of the content-type of the
538 document, so in the event of an unknown type it uses the
539 <code>DefaultType</code>. For example:</p>
542 DefaultType image/gif
545 <p>would be appropriate for a directory which contained many GIF
546 images with filenames missing the <code>.gif</code> extension.</p>
548 <p>Note that unlike <directive
549 module="core">ForceType</directive>, this directive only
550 provides the default mime-type. All other mime-type definitions,
551 including filename extensions, that might identify the media type
552 will override this default.</p>
556 <directivesynopsis type="section">
557 <name>Directory</name>
558 <description>Enclose a group of directives that apply only to the
559 named file-system directory and sub-directories</description>
560 <syntax><Directory <var>directory-path</var>>
561 ... </Directory></syntax>
562 <contextlist><context>server config</context><context>virtual host</context>
566 <p><directive type="section">Directory</directive> and
567 <code></Directory></code> are used to enclose a group of
568 directives that will apply only to the named directory and
569 sub-directories of that directory. Any directive that is allowed
570 in a directory context may be used. <var>Directory-path</var> is
571 either the full path to a directory, or a wild-card string using
572 Unix shell-style matching. In a wild-card string, <code>?</code> matches
573 any single character, and <code>*</code> matches any sequences of
574 characters. You may also use <code>[]</code> character ranges. None
575 of the wildcards match a `/' character, so <code><Directory
576 /*/public_html></code> will not match
577 <code>/home/user/public_html</code>, but <code><Directory
578 /home/*/public_html></code> will match. Example:</p>
581 <Directory /usr/local/httpd/htdocs><br />
583 Options Indexes FollowSymLinks<br />
589 <p>Be careful with the <var>directory-path</var> arguments:
590 They have to literally match the filesystem path which Apache uses
591 to access the files. Directives applied to a particular
592 <code><Directory></code> will not apply to files accessed from
593 that same directory via a different path, such as via different symbolic
598 expressions can also be used, with the addition of the
599 <code>~</code> character. For example:</p>
602 <Directory ~ "^/www/.*/[0-9]{3}">
605 <p>would match directories in <code>/www/</code> that consisted of
608 <p>If multiple (non-regular expression) <directive
609 type="section">Directory</directive> sections
610 match the directory (or one of its parents) containing a document,
611 then the directives are applied in the order of shortest match
612 first, interspersed with the directives from the <a
613 href="#accessfilename">.htaccess</a> files. For example,
617 <Directory /><br />
619 AllowOverride None<br />
621 </Directory><br />
623 <Directory /home/><br />
625 AllowOverride FileInfo<br />
630 <p>for access to the document <code>/home/web/dir/doc.html</code>
634 <li>Apply directive <code>AllowOverride None</code>
635 (disabling <code>.htaccess</code> files).</li>
637 <li>Apply directive <code>AllowOverride FileInfo</code> (for
638 directory <code>/home</code>).</li>
640 <li>Apply any <code>FileInfo</code> directives in
641 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
642 <code>/home/web/dir/.htaccess</code> in that order.</li>
645 <p>Regular expressions are not considered until after all of the
646 normal sections have been applied. Then all of the regular
647 expressions are tested in the order they appeared in the
648 configuration file. For example, with</p>
651 <Directory ~ abc$><br />
653 # ... directives here ...<br />
658 <p>the regular expression section won't be considered until after
659 all normal <directive type="section">Directory</directive>s and
660 <code>.htaccess</code> files have been applied. Then the regular
661 expression will match on <code>/home/abc/public_html/abc</code> and
662 the corresponding <directive type="section">Directory</directive> will
665 <p><strong>Note that the default Apache access for
666 <code><Directory /></code> is <code>Allow from All</code>.
667 This means that Apache will serve any file mapped from an URL. It is
668 recommended that you change this with a block such
672 <Directory /><br />
674 Order Deny,Allow<br />
680 <p><strong>and then override this for directories you
681 <em>want</em> accessible. See the <a
682 href="../misc/security_tips.html">Security Tips</a> page for more
683 details.</strong></p>
685 <p>The directory sections occur in the <code>httpd.conf</code> file.
686 <directive type="section">Directory</directive> directives
687 cannot nest, and cannot appear in a <directive module="core"
688 type="section">Limit</directive> or <directive module="core"
689 type="section">LimitExcept</directive> section.</p>
691 <seealso><a href="../sections.html">How <Directory>,
692 <Location> and <Files> sections work</a> for an
693 explanation of how these different sections are combined when a
694 request is received</seealso>
697 <directivesynopsis type="section">
698 <name>DirectoryMatch</name>
699 <description>Enclose directives that apply to
700 file-system directories matching a regular expression and their
701 subdirectories</description>
702 <syntax><DirectoryMatch <var>regex</var>>
703 ... </DirectoryMatch></syntax>
704 <contextlist><context>server config</context><context>virtual host</context>
708 <p><directive type="section">DirectoryMatch</directive> and
709 <code></DirectoryMatch></code> are used to enclose a group
710 of directives which will apply only to the named directory and
711 sub-directories of that directory, the same as <directive
712 module="core" type="section">Directory</directive>. However, it
713 takes as an argument a regular expression. For example:</p>
716 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
719 <p>would match directories in <code>/www/</code> that consisted of three
722 <seealso><directive type="section" module="core">Directory</directive> for
723 a description of how regular expressions are mixed in with normal
724 <directive type="section">Directory</directive>s</seealso>
726 href="../sections.html">How <Directory>, <Location> and
727 <Files> sections work</a> for an explanation of how these different
728 sections are combined when a request is received</seealso>
732 <name>DocumentRoot</name>
733 <description>Directory that forms the main document tree visible
734 from the web</description>
735 <syntax>DocumentRoot <var>directory-path</var></syntax>
736 <default>DocumentRoot /usr/local/apache/htdocs</default>
737 <contextlist><context>server config</context><context>virtual host</context>
741 <p>This directive sets the directory from which <program>httpd</program>
742 will serve files. Unless matched by a directive like <directive
743 module="mod_alias">Alias</directive>, the server appends the
744 path from the requested URL to the document root to make the
745 path to the document. Example:</p>
748 DocumentRoot /usr/web
752 <code>http://www.my.host.com/index.html</code> refers to
753 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
754 not absolute then it is assumed to be relative to the <directive
755 module="core">ServerRoot</directive>.</p>
757 <p>The <directive>DocumentRoot</directive> should be specified without
758 a trailing slash.</p>
760 <seealso><a href="../urlmapping.html">Mapping URLs to Filesystem
761 Location</a></seealso>
765 <name>EnableMMAP</name>
766 <description>Use memory-mapping to read files during delivery</description>
767 <syntax>EnableMMAP On|Off</syntax>
768 <default>EnableMMAP On</default>
769 <contextlist><context>server config</context><context>virtual host</context>
770 <context>directory</context><context>.htaccess</context>
772 <override>FileInfo</override>
775 <p>This directive controls whether the <program>httpd</program> may use
776 memory-mapping if it needs to read the contents of a file during
777 delivery. By default, when the handling of a request requires
778 access to the data within a file -- for example, when delivering a
779 server-parsed file using <module>mod_include</module> -- Apache
780 memory-maps the file if the OS supports it.</p>
782 <p>This memory-mapping sometimes yields a performance improvement.
783 But in some environments, it is better to disable the memory-mapping
784 to prevent operational problems:</p>
787 <li>On some multiprocessor systems, memory-mapping can reduce the
788 performance of the <program>httpd</program>.</li>
789 <li>With an NFS-mounted <directive module="core">DocumentRoot</directive>,
790 the <program>httpd</program> may crash due to a segmentation fault if a file
791 is deleted or truncated while the <program>httpd</program> has it
795 <p>For server configurations that are vulnerable to these problems,
796 you should disable memory-mapping of delivered files by specifying:</p>
802 <p>For NFS mounted files, this feature may be disabled explicitly for
803 the offending files by specifying:</p>
806 <Directory "/path-to-nfs-files">
816 <name>EnableSendfile</name>
817 <description>Use the kernel sendfile support to deliver files to the client</description>
818 <syntax>EnableSendfile On|Off</syntax>
819 <default>EnableSendfile On</default>
820 <contextlist><context>server config</context><context>virtual host</context>
821 <context>directory</context><context>.htaccess</context>
823 <override>FileInfo</override>
824 <compatibility>Available in version 2.0.44 and later</compatibility>
827 <p>This directive controls whether <program>httpd</program> may use the
828 sendfile support from the kernel to transmit file contents to the client.
829 By default, when the handling of a request requires no access
830 to the data within a file -- for example, when delivering a
831 static file -- Apache uses sendfile to deliver the file contents
832 without ever reading the file if the OS supports it.</p>
834 <p>This sendfile mechanism avoids separate read and send operations,
835 and buffer allocations. But on some platforms or within some
836 filesystems, it is better to disable this feature to avoid
837 operational problems:</p>
840 <li>Some platforms may have broken sendfile support that the build
841 system did not detect, especially if the binaries were built on
842 another box and moved to such a machine with broken sendfile
844 <li>On Linux the use of sendfile triggers TCP-checksum
845 offloading bugs on certain networking cards when using IPv6.</li>
846 <li>With a network-mounted <directive
847 module="core">DocumentRoot</directive> (e.g., NFS or SMB),
848 the kernel may be unable to serve the network file through
852 <p>For server configurations that are vulnerable to these problems,
853 you should disable this feature by specifying:</p>
859 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
860 for the offending files by specifying:</p>
863 <Directory "/path-to-nfs-files">
873 <name>ErrorDocument</name>
874 <description>What the server will return to the client
875 in case of an error</description>
876 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
877 <contextlist><context>server config</context><context>virtual host</context>
878 <context>directory</context><context>.htaccess</context>
880 <override>FileInfo</override>
881 <compatibility>Quoting syntax for text messages is different in Apache
885 <p>In the event of a problem or error, Apache can be configured
886 to do one of four things,</p>
889 <li>output a simple hardcoded error message</li>
891 <li>output a customized message</li>
893 <li>redirect to a local <var>URL-path</var> to handle the
896 <li>redirect to an external <var>URL</var> to handle the
900 <p>The first option is the default, while options 2-4 are
901 configured using the <directive>ErrorDocument</directive>
902 directive, which is followed by the HTTP response code and a URL
903 or a message. Apache will sometimes offer additional information
904 regarding the problem/error.</p>
906 <p>URLs can begin with a slash (/) for local web-paths (relative
907 to the <directive module="core">DocumentRoot</directive>), or be a
908 full URL which the client can resolve. Alternatively, a message
909 can be provided to be displayed by the browser. Examples:</p>
912 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
913 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
914 ErrorDocument 401 /subscription_info.html<br />
915 ErrorDocument 403 "Sorry can't allow you access today"
918 <p>Additionally, the special value <code>default</code> can be used
919 to specify Apache's simple hardcoded message. While not required
920 under normal circumstances, <code>default</code> will restore
921 Apache's simple hardcoded message for configurations that would
922 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
925 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
926 <Directory /web/docs><br />
928 ErrorDocument 404 default<br />
933 <p>Note that when you specify an <directive>ErrorDocument</directive>
934 that points to a remote URL (ie. anything with a method such as
935 <code>http</code> in front of it), Apache will send a redirect to the
936 client to tell it where to find the document, even if the
937 document ends up being on the same server. This has several
938 implications, the most important being that the client will not
939 receive the original error status code, but instead will
940 receive a redirect status code. This in turn can confuse web
941 robots and other clients which try to determine if a URL is
942 valid using the status code. In addition, if you use a remote
943 URL in an <code>ErrorDocument 401</code>, the client will not
944 know to prompt the user for a password since it will not
945 receive the 401 status code. Therefore, <strong>if you use an
946 <code>ErrorDocument 401</code> directive then it must refer to a local
947 document.</strong></p>
949 <p>Microsoft Internet Explorer (MSIE) will by default ignore
950 server-generated error messages when they are "too small" and substitute
951 its own "friendly" error messages. The size threshold varies depending on
952 the type of error, but in general, if you make your error document
953 greater than 512 bytes, then MSIE will show the server-generated
954 error rather than masking it. More information is available in
955 Microsoft Knowledge Base article <a
956 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
959 <p>Although most error messages can be overriden, there are certain
960 circumstances where the internal messages are used regardless of the
961 setting of <directive module="core">ErrorDocument</directive>. In
962 particular, if a malformed request is detected, normal request processing
963 will be immediately halted and the internal error message returned.
964 This is necessary to guard against security problems caused by
967 <p>Prior to version 2.0, messages were indicated by prefixing
968 them with a single unmatched double quote character.</p>
971 <seealso><a href="../custom-error.html">documentation of
972 customizable responses</a></seealso>
976 <name>ErrorLog</name>
977 <description>Location where the server will log errors</description>
978 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
979 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
980 <contextlist><context>server config</context><context>virtual host</context>
984 <p>The <directive>ErrorLog</directive> directive sets the name of
985 the file to which the server will log any errors it encounters. If
986 the <var>file-path</var> is not absolute then it is assumed to be
987 relative to the <directive module="core">ServerRoot</directive>.</p>
989 <example><title>Example</title>
990 ErrorLog /var/log/httpd/error_log
993 <p>If the <var>file-path</var>
994 begins with a pipe (|) then it is assumed to be a command to spawn
995 to handle the error log.</p>
997 <example><title>Example</title>
998 ErrorLog "|/usr/local/bin/httpd_errors"
1001 <p>Using <code>syslog</code> instead of a filename enables logging
1002 via syslogd(8) if the system supports it. The default is to use
1003 syslog facility <code>local7</code>, but you can override this by
1004 using the <code>syslog:<var>facility</var></code> syntax where
1005 <var>facility</var> can be one of the names usually documented in
1008 <example><title>Example</title>
1009 ErrorLog syslog:user
1012 <p>SECURITY: See the <a
1013 href="../misc/security_tips.html#serverroot">security tips</a>
1014 document for details on why your security could be compromised
1015 if the directory where log files are stored is writable by
1016 anyone other than the user that starts the server.</p>
1017 <note type="warning"><title>Note</title>
1018 <p>When entering a file path on non-Unix platforms, care should be taken
1019 to make sure that only forward slashed are used even though the platform
1020 may allow the use of back slashes. In general it is a good idea to always
1021 use forward slashes throughout the configuration files.</p>
1024 <seealso><directive module="core">LogLevel</directive></seealso>
1025 <seealso><a href="../logs.html">Apache Log Files</a></seealso>
1026 </directivesynopsis>
1029 <name>FileETag</name>
1030 <description>File attributes used to create the ETag
1031 HTTP response header</description>
1032 <syntax>FileETag <var>component</var> ...</syntax>
1033 <default>FileETag INode MTime Size</default>
1034 <contextlist><context>server config</context><context>virtual host</context>
1035 <context>directory</context><context>.htaccess</context>
1037 <override>FileInfo</override>
1041 The <directive>FileETag</directive> directive configures the file
1042 attributes that are used to create the <code>ETag</code> (entity
1043 tag) response header field when the document is based on a file.
1044 (The <code>ETag</code> value is used in cache management to save
1045 network bandwidth.) In Apache 1.3.22 and earlier, the
1046 <code>ETag</code> value was <em>always</em> formed
1047 from the file's inode, size, and last-modified time (mtime). The
1048 <directive>FileETag</directive> directive allows you to choose
1049 which of these -- if any -- should be used. The recognized keywords are:
1053 <dt><strong>INode</strong></dt>
1054 <dd>The file's i-node number will be included in the calculation</dd>
1055 <dt><strong>MTime</strong></dt>
1056 <dd>The date and time the file was last modified will be included</dd>
1057 <dt><strong>Size</strong></dt>
1058 <dd>The number of bytes in the file will be included</dd>
1059 <dt><strong>All</strong></dt>
1060 <dd>All available fields will be used. This is equivalent to:
1061 <example>FileETag INode MTime Size</example></dd>
1062 <dt><strong>None</strong></dt>
1063 <dd>If a document is file-based, no <code>ETag</code> field will be
1064 included in the response</dd>
1067 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1068 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1069 which allow changes to be made to the default setting inherited
1070 from a broader scope. Any keyword appearing without such a prefix
1071 immediately and completely cancels the inherited setting.</p>
1073 <p>If a directory's configuration includes
1074 <code>FileETag INode MTime Size</code>, and a
1075 subdirectory's includes <code>FileETag -INode</code>,
1076 the setting for that subdirectory (which will be inherited by
1077 any sub-subdirectories that don't override it) will be equivalent to
1078 <code>FileETag MTime Size</code>.</p>
1080 </directivesynopsis>
1082 <directivesynopsis type="section">
1084 <description>Contains directives that apply to matched
1085 filenames</description>
1086 <syntax><Files <var>filename</var>> ... </Files></syntax>
1087 <contextlist><context>server config</context><context>virtual host</context>
1088 <context>directory</context><context>.htaccess</context>
1090 <override>All</override>
1093 <p>The <directive type="section">Files</directive> directive
1094 limits the scope of the enclosed directives by filename. It is comparable
1095 to the <directive module="core" type="section">Directory</directive>
1096 and <directive module="core" type="section">Location</directive>
1097 directives. It should be matched with a <code></Files></code>
1098 directive. The directives given within this section will be applied to
1099 any object with a basename (last component of filename) matching the
1100 specified filename. <directive type="section">Files</directive>
1101 sections are processed in the order they appear in the
1102 configuration file, after the <directive module="core"
1103 type="section">Directory</directive> sections and
1104 <code>.htaccess</code> files are read, but before <directive
1105 type="section" module="core">Location</directive> sections. Note
1106 that <directive type="section">Files</directive> can be nested
1107 inside <directive type="section"
1108 module="core">Directory</directive> sections to restrict the
1109 portion of the filesystem they apply to.</p>
1111 <p>The <var>filename</var> argument should include a filename, or
1112 a wild-card string, where <code>?</code> matches any single character,
1113 and <code>*</code> matches any sequences of characters. Extended regular
1114 expressions can also be used, with the addition of the
1115 <code>~</code> character. For example:</p>
1118 <Files ~ "\.(gif|jpe?g|png)$">
1121 <p>would match most common Internet graphics formats. <directive
1122 module="core" type="section">FilesMatch</directive> is preferred,
1125 <p>Note that unlike <directive type="section"
1126 module="core">Directory</directive> and <directive type="section"
1127 module="core">Location</directive> sections, <directive
1128 type="section">Files</directive> sections can be used inside
1129 <code>.htaccess</code> files. This allows users to control access to
1130 their own files, at a file-by-file level.</p>
1133 <seealso><a href="../sections.html">How <Directory>, <Location>
1134 and <Files> sections work</a> for an explanation of how these
1135 different sections are combined when a request is received</seealso>
1136 </directivesynopsis>
1138 <directivesynopsis type="section">
1139 <name>FilesMatch</name>
1140 <description>Contains directives that apply to regular-expression matched
1141 filenames</description>
1142 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1143 <contextlist><context>server config</context><context>virtual host</context>
1144 <context>directory</context><context>.htaccess</context>
1146 <override>All</override>
1149 <p>The <directive type="section">FilesMatch</directive> directive
1150 limits the scope of the enclosed directives by filename, just as the
1151 <directive module="core" type="section">Files</directive> directive
1152 does. However, it accepts a regular expression. For example:</p>
1155 <FilesMatch "\.(gif|jpe?g|png)$">
1158 <p>would match most common Internet graphics formats.</p>
1161 <seealso><a href="../sections.html">How <Directory>, <Location>
1162 and <Files> sections work</a> for an explanation of how these
1163 different sections are combined when a request is received</seealso>
1164 </directivesynopsis>
1167 <name>ForceType</name>
1168 <description>Forces all matching files to be served with the specified
1169 MIME content-type</description>
1170 <syntax>ForceType <var>MIME-type</var>|None</syntax>
1171 <contextlist><context>directory</context><context>.htaccess</context>
1173 <override>FileInfo</override>
1174 <compatibility>Moved to the core in Apache 2.0</compatibility>
1177 <p>When placed into an <code>.htaccess</code> file or a
1178 <directive type="section" module="core">Directory</directive>, or
1179 <directive type="section" module="core">Location</directive> or
1180 <directive type="section" module="core">Files</directive>
1181 section, this directive forces all matching files to be served
1182 with the content type identification given by
1183 <var>MIME-type</var>. For example, if you had a directory full of
1184 GIF files, but did not want to label them all with <code>.gif</code>,
1185 you might want to use:</p>
1191 <p>Note that unlike <directive module="core">DefaultType</directive>,
1192 this directive overrides all mime-type associations, including
1193 filename extensions, that might identify the media type.</p>
1195 <p>You can override any <directive>ForceType</directive> setting
1196 by using the value of <code>None</code>:</p>
1199 # force all files to be image/gif:<br />
1200 <Location /images><br />
1202 ForceType image/gif<br />
1204 </Location><br />
1206 # but normal mime-type associations here:<br />
1207 <Location /images/mixed><br />
1209 ForceType None<br />
1214 </directivesynopsis>
1217 <name>HostnameLookups</name>
1218 <description>Enables DNS lookups on client IP addresses</description>
1219 <syntax>HostnameLookups On|Off|Double</syntax>
1220 <default>HostnameLookups Off</default>
1221 <contextlist><context>server config</context><context>virtual host</context>
1222 <context>directory</context></contextlist>
1225 <p>This directive enables DNS lookups so that host names can be
1226 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1227 The value <code>Double</code> refers to doing double-reverse
1228 DNS lookup. That is, after a reverse lookup is performed, a forward
1229 lookup is then performed on that result. At least one of the IP
1230 addresses in the forward lookup must match the original
1231 address. (In "tcpwrappers" terminology this is called
1232 <code>PARANOID</code>.)</p>
1234 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1235 used for controlling access by hostname, a double reverse lookup
1236 will be performed. This is necessary for security. Note that the
1237 result of this double-reverse isn't generally available unless you
1238 set <code>HostnameLookups Double</code>. For example, if only
1239 <code>HostnameLookups On</code> and a request is made to an object
1240 that is protected by hostname restrictions, regardless of whether
1241 the double-reverse fails or not, CGIs will still be passed the
1242 single-reverse result in <code>REMOTE_HOST</code>.</p>
1244 <p>The default is <code>Off</code> in order to save the network
1245 traffic for those sites that don't truly need the reverse
1246 lookups done. It is also better for the end users because they
1247 don't have to suffer the extra latency that a lookup entails.
1248 Heavily loaded sites should leave this directive
1249 <code>Off</code>, since DNS lookups can take considerable
1250 amounts of time. The utility <program>logresolve</program>, compiled by
1251 default to the <code>bin</code> subdirectory of your installation
1252 directory, can be used to look up host names from logged IP addresses
1255 </directivesynopsis>
1257 <directivesynopsis type="section">
1258 <name>IfDefine</name>
1259 <description>Encloses directives that will be processed only
1260 if a test is true at startup</description>
1261 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1262 </IfDefine></syntax>
1263 <contextlist><context>server config</context><context>virtual host</context>
1264 <context>directory</context><context>.htaccess</context>
1266 <override>All</override>
1269 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1270 </code> section is used to mark directives that are conditional. The
1271 directives within an <directive type="section">IfDefine</directive>
1272 section are only processed if the <var>test</var> is true. If <var>
1273 test</var> is false, everything between the start and end markers is
1276 <p>The <var>test</var> in the <directive type="section"
1277 >IfDefine</directive> section directive can be one of two forms:</p>
1280 <li><var>parameter-name</var></li>
1282 <li><code>!</code><var>parameter-name</var></li>
1285 <p>In the former case, the directives between the start and end
1286 markers are only processed if the parameter named
1287 <var>parameter-name</var> is defined. The second format reverses
1288 the test, and only processes the directives if
1289 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1291 <p>The <var>parameter-name</var> argument is a define as given on
1292 the <program>httpd</program> command line via <code>-D<var>parameter-</var>
1293 </code>, at the time the server was started.</p>
1295 <p><directive type="section">IfDefine</directive> sections are
1296 nest-able, which can be used to implement simple
1297 multiple-parameter tests. Example:</p>
1300 httpd -DReverseProxy ...<br />
1303 <IfDefine ReverseProxy><br />
1305 LoadModule rewrite_module modules/mod_rewrite.so<br />
1306 LoadModule proxy_module modules/libproxy.so<br />
1311 </directivesynopsis>
1313 <directivesynopsis type="section">
1314 <name>IfModule</name>
1315 <description>Encloses directives that are processed conditional on the
1316 presence or absence of a specific module</description>
1317 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1318 </IfModule></syntax>
1319 <contextlist><context>server config</context><context>virtual host</context>
1320 <context>directory</context><context>.htaccess</context>
1322 <override>All</override>
1323 <compatibility>Module identifiers are available in version 2.1 and
1324 later.</compatibility>
1327 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1328 section is used to mark directives that are conditional on the presence of
1329 a specific module. The directives within an <directive type="section"
1330 >IfModule</directive> section are only processed if the <var>test</var>
1331 is true. If <var>test</var> is false, everything between the start and
1332 end markers is ignored.</p>
1334 <p>The <var>test</var> in the <directive type="section"
1335 >IfModule</directive> section directive can be one of two forms:</p>
1338 <li><var>module</var></li>
1340 <li>!<var>module</var></li>
1343 <p>In the former case, the directives between the start and end
1344 markers are only processed if the module named <var>module</var>
1345 is included in Apache -- either compiled in or
1346 dynamically loaded using <directive module="mod_so"
1347 >LoadModule</directive>. The second format reverses the test,
1348 and only processes the directives if <var>module</var> is
1349 <strong>not</strong> included.</p>
1351 <p>The <var>module</var> argument can be either the module identifier or
1352 the file name of the module, at the time it was compiled. For example,
1353 <code>rewrite_module</code> is the identifier and
1354 <code>mod_rewrite.c</code> is the file name. If a module consists of
1355 several source files, use the name of the file containing the string
1356 <code>STANDARD20_MODULE_STUFF</code>.</p>
1358 <p><directive type="section">IfModule</directive> sections are
1359 nest-able, which can be used to implement simple multiple-module
1362 <note>This section should only be used if you need to have one
1363 configuration file that works whether or not a specific module
1364 is available. In normal operation, directives need not be
1365 placed in <directive type="section">IfModule</directive>
1368 </directivesynopsis>
1371 <name>Include</name>
1372 <description>Includes other configuration files from within
1373 the server configuration files</description>
1374 <syntax>Include <var>file-path</var>|<var>directory-path</var></syntax>
1375 <contextlist><context>server config</context><context>virtual host</context>
1376 <context>directory</context>
1378 <compatibility>Wildcard matching available in 2.0.41 and later</compatibility>
1381 <p>This directive allows inclusion of other configuration files
1382 from within the server configuration files.</p>
1384 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1385 include several files at once, in alphabetical order. In
1386 addition, if <directive>Include</directive> points to a directory,
1387 rather than a file, Apache will read all files in that directory
1388 and any subdirectory. But including entire directories is not
1389 recommended, because it is easy to accidentally leave temporary
1390 files in a directory that can cause <program>httpd</program> to
1393 <p>The file path specified may be an absolute path, or may be relative
1394 to the <directive module="core">ServerRoot</directive> directory.</p>
1399 Include /usr/local/apache2/conf/ssl.conf<br />
1400 Include /usr/local/apache2/conf/vhosts/*.conf
1403 <p>Or, providing paths relative to your <directive
1404 module="core">ServerRoot</directive> directory:</p>
1407 Include conf/ssl.conf<br />
1408 Include conf/vhosts/*.conf
1411 <p>Running <code>apachectl configtest</code> will give you a list
1412 of the files that are being processed during the configuration
1416 root@host# apachectl configtest<br />
1417 Processing config file: /usr/local/apache2/conf/ssl.conf<br />
1418 Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf<br />
1419 Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf<br />
1424 <seealso><program>apachectl</program></seealso>
1425 </directivesynopsis>
1428 <name>KeepAlive</name>
1429 <description>Enables HTTP persistent connections</description>
1430 <syntax>KeepAlive On|Off</syntax>
1431 <default>KeepAlive On</default>
1432 <contextlist><context>server config</context><context>virtual host</context>
1436 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1437 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1438 which allow multiple requests to be sent over the same TCP
1439 connection. In some cases this has been shown to result in an
1440 almost 50% speedup in latency times for HTML documents with
1441 many images. To enable Keep-Alive connections, set
1442 <code>KeepAlive On</code>.</p>
1444 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1445 used if they are specifically requested by a client. In
1446 addition, a Keep-Alive connection with an HTTP/1.0 client can
1447 only be used when the length of the content is known in
1448 advance. This implies that dynamic content such as CGI output,
1449 SSI pages, and server-generated directory listings will
1450 generally not use Keep-Alive connections to HTTP/1.0 clients.
1451 For HTTP/1.1 clients, persistent connections are the default
1452 unless otherwise specified. If the client requests it, chunked
1453 encoding will be used in order to send content of unknown
1454 length over persistent connections.</p>
1457 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1458 </directivesynopsis>
1461 <name>KeepAliveTimeout</name>
1462 <description>Amount of time the server will wait for subsequent
1463 requests on a persistent connection</description>
1464 <syntax>KeepAliveTimeout <var>seconds</var></syntax>
1465 <default>KeepAliveTimeout 5</default>
1466 <contextlist><context>server config</context><context>virtual host</context>
1470 <p>The number of seconds Apache will wait for a subsequent
1471 request before closing the connection. Once a request has been
1472 received, the timeout value specified by the
1473 <directive module="core">Timeout</directive> directive applies.</p>
1475 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1476 may cause performance problems in heavily loaded servers. The
1477 higher the timeout, the more server processes will be kept
1478 occupied waiting on connections with idle clients.</p>
1480 </directivesynopsis>
1482 <directivesynopsis type="section">
1484 <description>Restrict enclosed access controls to only certain HTTP
1485 methods</description>
1486 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1487 </Limit></syntax>
1488 <contextlist><context>server config</context><context>virtual host</context>
1489 <context>directory</context><context>.htaccess</context>
1491 <override>All</override>
1494 <p>Access controls are normally effective for
1495 <strong>all</strong> access methods, and this is the usual
1496 desired behavior. <strong>In the general case, access control
1497 directives should not be placed within a
1498 <directive type="section">Limit</directive> section.</strong></p>
1500 <p>The purpose of the <directive type="section">Limit</directive>
1501 directive is to restrict the effect of the access controls to the
1502 nominated HTTP methods. For all other methods, the access
1503 restrictions that are enclosed in the <directive
1504 type="section">Limit</directive> bracket <strong>will have no
1505 effect</strong>. The following example applies the access control
1506 only to the methods <code>POST</code>, <code>PUT</code>, and
1507 <code>DELETE</code>, leaving all other methods unprotected:</p>
1510 <Limit POST PUT DELETE><br />
1512 Require valid-user<br />
1517 <p>The method names listed can be one or more of: <code>GET</code>,
1518 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1519 <code>CONNECT</code>, <code>OPTIONS</code>,
1520 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1521 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1522 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1523 case-sensitive.</strong> If <code>GET</code> is used it will also
1524 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1525 cannot be limited.</p>
1527 <note type="warning">A <directive type="section"
1528 module="core">LimitExcept</directive> section should always be
1529 used in preference to a <directive type="section"
1530 module="core">Limit</directive> section when restricting access,
1531 since a <directive type="section"
1532 module="core">LimitExcept</directive> section provides protection
1533 against arbitrary methods.</note>
1536 </directivesynopsis>
1538 <directivesynopsis type="section">
1539 <name>LimitExcept</name>
1540 <description>Restrict access controls to all HTTP methods
1541 except the named ones</description>
1542 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1543 </LimitExcept></syntax>
1544 <contextlist><context>server config</context><context>virtual host</context>
1545 <context>directory</context><context>.htaccess</context>
1547 <override>All</override>
1550 <p><directive type="section">LimitExcept</directive> and
1551 <code></LimitExcept></code> are used to enclose
1552 a group of access control directives which will then apply to any
1553 HTTP access method <strong>not</strong> listed in the arguments;
1554 i.e., it is the opposite of a <directive type="section"
1555 module="core">Limit</directive> section and can be used to control
1556 both standard and nonstandard/unrecognized methods. See the
1557 documentation for <directive module="core"
1558 type="section">Limit</directive> for more details.</p>
1563 <LimitExcept POST GET><br />
1565 Require valid-user<br />
1567 </LimitExcept>
1571 </directivesynopsis>
1574 <name>LimitInternalRecursion</name>
1575 <description>Determine maximum number of internal redirects and nested
1576 subrequests</description>
1577 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
1578 <default>LimitInternalRecursion 10</default>
1579 <contextlist><context>server config</context><context>virtual host</context>
1581 <compatibility>Available in Apache 2.0.47 and later</compatibility>
1584 <p>An internal redirect happens, for example, when using the <directive
1585 module="mod_actions">Action</directive> directive, which internally
1586 redirects the original request to a CGI script. A subrequest is Apache's
1587 mechanism to find out what would happen for some URI if it were requested.
1588 For example, <module>mod_dir</module> uses subrequests to look for the
1589 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
1592 <p><directive>LimitInternalRecursion</directive> prevents the server
1593 from crashing when entering an infinite loop of internal redirects or
1594 subrequests. Such loops are usually caused by misconfigurations.</p>
1596 <p>The directive stores two different limits, which are evaluated on
1597 per-request basis. The first <var>number</var> is the maximum number of
1598 internal redirects, that may follow each other. The second <var>number</var>
1599 determines, how deep subrequests may be nested. If you specify only one
1600 <var>number</var>, it will be assigned to both limits.</p>
1602 <example><title>Example</title>
1603 LimitInternalRecursion 5
1606 </directivesynopsis>
1609 <name>LimitRequestBody</name>
1610 <description>Restricts the total size of the HTTP request body sent
1611 from the client</description>
1612 <syntax>LimitRequestBody <var>bytes</var></syntax>
1613 <default>LimitRequestBody 0</default>
1614 <contextlist><context>server config</context><context>virtual host</context>
1615 <context>directory</context><context>.htaccess</context>
1617 <override>All</override>
1620 <p>This directive specifies the number of <var>bytes</var> from 0
1621 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1624 <p>The <directive>LimitRequestBody</directive> directive allows
1625 the user to set a limit on the allowed size of an HTTP request
1626 message body within the context in which the directive is given
1627 (server, per-directory, per-file or per-location). If the client
1628 request exceeds that limit, the server will return an error
1629 response instead of servicing the request. The size of a normal
1630 request message body will vary greatly depending on the nature of
1631 the resource and the methods allowed on that resource. CGI scripts
1632 typically use the message body for retrieving form information.
1633 Implementations of the <code>PUT</code> method will require
1634 a value at least as large as any representation that the server
1635 wishes to accept for that resource.</p>
1637 <p>This directive gives the server administrator greater
1638 control over abnormal client request behavior, which may be
1639 useful for avoiding some forms of denial-of-service
1642 <p>If, for example, you are permitting file upload to a particular
1643 location, and wish to limit the size of the uploaded file to 100K,
1644 you might use the following directive:</p>
1647 LimitRequestBody 102400
1651 </directivesynopsis>
1654 <name>LimitRequestFields</name>
1655 <description>Limits the number of HTTP request header fields that
1656 will be accepted from the client</description>
1657 <syntax>LimitRequestFields <var>number</var></syntax>
1658 <default>LimitRequestFields 100</default>
1659 <contextlist><context>server config</context></contextlist>
1662 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1663 32767. The default value is defined by the compile-time
1664 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1667 <p>The <directive>LimitRequestFields</directive> directive allows
1668 the server administrator to modify the limit on the number of
1669 request header fields allowed in an HTTP request. A server needs
1670 this value to be larger than the number of fields that a normal
1671 client request might include. The number of request header fields
1672 used by a client rarely exceeds 20, but this may vary among
1673 different client implementations, often depending upon the extent
1674 to which a user has configured their browser to support detailed
1675 content negotiation. Optional HTTP extensions are often expressed
1676 using request header fields.</p>
1678 <p>This directive gives the server administrator greater
1679 control over abnormal client request behavior, which may be
1680 useful for avoiding some forms of denial-of-service attacks.
1681 The value should be increased if normal clients see an error
1682 response from the server that indicates too many fields were
1683 sent in the request.</p>
1688 LimitRequestFields 50
1692 </directivesynopsis>
1695 <name>LimitRequestFieldSize</name>
1696 <description>Limits the size of the HTTP request header allowed from the
1697 client</description>
1698 <syntax>LimitRequestFieldsize <var>bytes</var></syntax>
1699 <default>LimitRequestFieldsize 8190</default>
1700 <contextlist><context>server config</context></contextlist>
1703 <p>This directive specifies the number of <var>bytes</var>
1704 that will be allowed in an HTTP request header.</p>
1706 <p>The <directive>LimitRequestFieldSize</directive> directive
1707 allows the server administrator to reduce or increase the limit
1708 on the allowed size of an HTTP request header field. A server
1709 needs this value to be large enough to hold any one header field
1710 from a normal client request. The size of a normal request header
1711 field will vary greatly among different client implementations,
1712 often depending upon the extent to which a user has configured
1713 their browser to support detailed content negotiation. SPNEGO
1714 authentication headers can be up to 12392 bytes.</p>
1716 <p>This directive gives the server administrator greater
1717 control over abnormal client request behavior, which may be
1718 useful for avoiding some forms of denial-of-service attacks.</p>
1723 LimitRequestFieldSize 4094
1726 <note>Under normal conditions, the value should not be changed from
1730 </directivesynopsis>
1733 <name>LimitRequestLine</name>
1734 <description>Limit the size of the HTTP request line that will be accepted
1735 from the client</description>
1736 <syntax>LimitRequestLine <var>bytes</var></syntax>
1737 <default>LimitRequestLine 8190</default>
1738 <contextlist><context>server config</context></contextlist>
1741 <p>This directive sets the number of <var>bytes</var> that will be
1742 allowed on the HTTP request-line.</p>
1744 <p>The <directive>LimitRequestLine</directive> directive allows
1745 the server administrator to reduce or increase the limit on the allowed size
1746 of a client's HTTP request-line. Since the request-line consists of the
1747 HTTP method, URI, and protocol version, the
1748 <directive>LimitRequestLine</directive> directive places a
1749 restriction on the length of a request-URI allowed for a request
1750 on the server. A server needs this value to be large enough to
1751 hold any of its resource names, including any information that
1752 might be passed in the query part of a <code>GET</code> request.</p>
1754 <p>This directive gives the server administrator greater
1755 control over abnormal client request behavior, which may be
1756 useful for avoiding some forms of denial-of-service attacks.</p>
1761 LimitRequestLine 4094
1764 <note>Under normal conditions, the value should not be changed from
1767 </directivesynopsis>
1770 <name>LimitXMLRequestBody</name>
1771 <description>Limits the size of an XML-based request body</description>
1772 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
1773 <default>LimitXMLRequestBody 1000000</default>
1774 <contextlist><context>server config</context><context>virtual host</context>
1775 <context>directory</context><context>.htaccess</context></contextlist>
1776 <override>All</override>
1779 <p>Limit (in bytes) on maximum size of an XML-based request
1780 body. A value of <code>0</code> will disable any checking.</p>
1785 LimitXMLRequestBody 0
1789 </directivesynopsis>
1791 <directivesynopsis type="section">
1792 <name>Location</name>
1793 <description>Applies the enclosed directives only to matching
1795 <syntax><Location
1796 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
1797 <contextlist><context>server config</context><context>virtual host</context>
1801 <p>The <directive type="section">Location</directive> directive
1802 limits the scope of the enclosed directives by URL. It is similar to the
1803 <directive type="section" module="core">Directory</directive>
1804 directive, and starts a subsection which is terminated with a
1805 <code></Location></code> directive. <directive
1806 type="section">Location</directive> sections are processed in the
1807 order they appear in the configuration file, after the <directive
1808 type="section" module="core">Directory</directive> sections and
1809 <code>.htaccess</code> files are read, and after the <directive
1810 type="section" module="core">Files</directive> sections.</p>
1812 <p><directive type="section">Location</directive> sections operate
1813 completely outside the filesystem. This has several consequences.
1814 Most importantly, <directive type="section">Location</directive>
1815 directives should not be used to control access to filesystem
1816 locations. Since several different URLs may map to the same
1817 filesystem location, such access controls may by circumvented.</p>
1819 <note><title>When to use <directive
1820 type="section">Location</directive></title>
1822 <p>Use <directive type="section">Location</directive> to apply
1823 directives to content that lives outside the filesystem. For
1824 content that lives in the filesystem, use <directive
1825 type="section" module="core">Directory</directive> and <directive
1826 type="section" module="core">Files</directive>. An exception is
1827 <code><Location /></code>, which is an easy way to
1828 apply a configuration to the entire server.</p>
1831 <p>For all origin (non-proxy) requests, the URL to be matched is a
1832 URL-path of the form <code>/path/</code>. No scheme, hostname,
1833 port, or query string may be included. For proxy requests, the
1834 URL to be matched is of the form
1835 <code>scheme://servername/path</code>, and you must include the
1838 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1839 any single character, and <code>*</code> matches any sequences of
1843 expressions can also be used, with the addition of the
1844 <code>~</code> character. For example:</p>
1847 <Location ~ "/(extra|special)/data">
1850 <p>would match URLs that contained the substring <code>/extra/data</code>
1851 or <code>/special/data</code>. The directive <directive
1852 type="section" module="core">LocationMatch</directive> behaves
1853 identical to the regex version of <directive
1854 type="section">Location</directive>.</p>
1856 <p>The <directive type="section">Location</directive>
1857 functionality is especially useful when combined with the
1858 <directive module="core">SetHandler</directive>
1859 directive. For example, to enable status requests, but allow them
1860 only from browsers at <code>foo.com</code>, you might use:</p>
1863 <Location /status><br />
1865 SetHandler server-status<br />
1866 Order Deny,Allow<br />
1868 Allow from .foo.com<br />
1873 <note><title>Note about / (slash)</title>
1874 <p>The slash character has special meaning depending on where in a
1875 URL it appears. People may be used to its behavior in the filesystem
1876 where multiple adjacent slashes are frequently collapsed to a single
1877 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
1878 <code>/home/foo</code>). In URL-space this is not necessarily true.
1879 The <directive type="section" module="core">LocationMatch</directive>
1880 directive and the regex version of <directive type="section"
1881 >Location</directive> require you to explicitly specify multiple
1882 slashes if that is your intention.</p>
1884 <p>For example, <code><LocationMatch ^/abc></code> would match
1885 the request URL <code>/abc</code> but not the request URL <code>
1886 //abc</code>. The (non-regex) <directive type="section"
1887 >Location</directive> directive behaves similarly when used for
1888 proxy requests. But when (non-regex) <directive type="section"
1889 >Location</directive> is used for non-proxy requests it will
1890 implicitly match multiple slashes with a single slash. For example,
1891 if you specify <code><Location /abc/def></code> and the
1892 request is to <code>/abc//def</code> then it will match.</p>
1895 <seealso><a href="../sections.html">How <Directory>, <Location>
1896 and <Files> sections work</a> for an explanation of how these
1897 different sections are combined when a request is received</seealso>
1898 </directivesynopsis>
1900 <directivesynopsis type="section">
1901 <name>LocationMatch</name>
1902 <description>Applies the enclosed directives only to regular-expression
1903 matching URLs</description>
1904 <syntax><LocationMatch
1905 <var>regex</var>> ... </LocationMatch></syntax>
1906 <contextlist><context>server config</context><context>virtual host</context>
1910 <p>The <directive type="section">LocationMatch</directive> directive
1911 limits the scope of the enclosed directives by URL, in an identical manner
1912 to <directive module="core" type="section">Location</directive>. However,
1913 it takes a regular expression as an argument instead of a simple
1914 string. For example:</p>
1917 <LocationMatch "/(extra|special)/data">
1920 <p>would match URLs that contained the substring <code>/extra/data</code>
1921 or <code>/special/data</code>.</p>
1924 <seealso><a href="../sections.html">How <Directory>, <Location>
1925 and <Files> sections work</a> for an explanation of how these
1926 different sections are combined when a request is received</seealso>
1927 </directivesynopsis>
1930 <name>LogLevel</name>
1931 <description>Controls the verbosity of the ErrorLog</description>
1932 <syntax>LogLevel <var>level</var></syntax>
1933 <default>LogLevel warn</default>
1934 <contextlist><context>server config</context><context>virtual host</context>
1938 <p><directive>LogLevel</directive> adjusts the verbosity of the
1939 messages recorded in the error logs (see <directive
1940 module="core">ErrorLog</directive> directive). The following
1941 <var>level</var>s are available, in order of decreasing
1945 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
1948 <th><strong>Level</strong> </th>
1950 <th><strong>Description</strong> </th>
1952 <th><strong>Example</strong> </th>
1956 <td><code>emerg</code> </td>
1958 <td>Emergencies - system is unusable.</td>
1960 <td>"Child cannot open lock file. Exiting"</td>
1964 <td><code>alert</code> </td>
1966 <td>Action must be taken immediately.</td>
1968 <td>"getpwuid: couldn't determine user name from uid"</td>
1972 <td><code>crit</code> </td>
1974 <td>Critical Conditions.</td>
1976 <td>"socket: Failed to get a socket, exiting child"</td>
1980 <td><code>error</code> </td>
1982 <td>Error conditions.</td>
1984 <td>"Premature end of script headers"</td>
1988 <td><code>warn</code> </td>
1990 <td>Warning conditions.</td>
1992 <td>"child process 1234 did not exit, sending another
1997 <td><code>notice</code> </td>
1999 <td>Normal but significant condition.</td>
2001 <td>"httpd: caught SIGBUS, attempting to dump core in
2006 <td><code>info</code> </td>
2008 <td>Informational.</td>
2010 <td>"Server seems busy, (you may need to increase
2011 StartServers, or Min/MaxSpareServers)..."</td>
2015 <td><code>debug</code> </td>
2017 <td>Debug-level messages</td>
2019 <td>"Opening config file ..."</td>
2023 <p>When a particular level is specified, messages from all
2024 other levels of higher significance will be reported as well.
2025 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2026 then messages with log levels of <code>notice</code> and
2027 <code>warn</code> will also be posted.</p>
2029 <p>Using a level of at least <code>crit</code> is
2038 <note><title>Note</title>
2039 <p>When logging to a regular file messages of the level
2040 <code>notice</code> cannot be suppressed and thus are always
2041 logged. However, this doesn't apply when logging is done
2042 using <code>syslog</code>.</p>
2045 </directivesynopsis>
2048 <name>MaxKeepAliveRequests</name>
2049 <description>Number of requests allowed on a persistent
2050 connection</description>
2051 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2052 <default>MaxKeepAliveRequests 100</default>
2053 <contextlist><context>server config</context><context>virtual host</context>
2057 <p>The <directive>MaxKeepAliveRequests</directive> directive
2058 limits the number of requests allowed per connection when
2059 <directive module="core" >KeepAlive</directive> is on. If it is
2060 set to <code>0</code>, unlimited requests will be allowed. We
2061 recommend that this setting be kept to a high value for maximum
2062 server performance.</p>
2067 MaxKeepAliveRequests 500
2070 </directivesynopsis>
2073 <name>NameVirtualHost</name>
2074 <description>Designates an IP address for name-virtual
2075 hosting</description>
2076 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2077 <contextlist><context>server config</context></contextlist>
2080 <p>The <directive>NameVirtualHost</directive> directive is a
2081 required directive if you want to configure <a
2082 href="../vhosts/">name-based virtual hosts</a>.</p>
2084 <p>Although <var>addr</var> can be hostname it is recommended
2085 that you always use an IP address, e.g.</p>
2088 NameVirtualHost 111.22.33.44
2091 <p>With the <directive>NameVirtualHost</directive> directive you
2092 specify the IP address on which the server will receive requests
2093 for the name-based virtual hosts. This will usually be the address
2094 to which your name-based virtual host names resolve. In cases
2095 where a firewall or other proxy receives the requests and forwards
2096 them on a different IP address to the server, you must specify the
2097 IP address of the physical interface on the machine which will be
2098 servicing the requests. If you have multiple name-based hosts on
2099 multiple addresses, repeat the directive for each address.</p>
2101 <note><title>Note</title>
2102 <p>Note, that the "main server" and any <code>_default_</code> servers
2103 will <strong>never</strong> be served for a request to a
2104 <directive>NameVirtualHost</directive> IP address (unless for some
2105 reason you specify <directive>NameVirtualHost</directive> but then
2106 don't define any <directive>VirtualHost</directive>s for that
2110 <p>Optionally you can specify a port number on which the
2111 name-based virtual hosts should be used, e.g.</p>
2114 NameVirtualHost 111.22.33.44:8080
2117 <p>IPv6 addresses must be enclosed in square brackets, as shown
2118 in the following example:</p>
2121 NameVirtualHost [fe80::a00:20ff:fea7:ccea]:8080
2124 <p>To receive requests on all interfaces, you can use an argument of
2131 <note><title>Argument to <directive type="section">VirtualHost</directive>
2133 <p>Note that the argument to the <directive
2134 type="section">VirtualHost</directive> directive must
2135 exactly match the argument to the <directive
2136 >NameVirtualHost</directive> directive.</p>
2139 NameVirtualHost 1.2.3.4<br />
2140 <VirtualHost 1.2.3.4><br />
2142 </VirtualHost><br />
2147 <seealso><a href="../vhosts/">Virtual Hosts
2148 documentation</a></seealso>
2150 </directivesynopsis>
2153 <name>Options</name>
2154 <description>Configures what features are available in a particular
2155 directory</description>
2157 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2158 <default>Options All</default>
2159 <contextlist><context>server config</context><context>virtual host</context>
2160 <context>directory</context><context>.htaccess</context>
2162 <override>Options</override>
2165 <p>The <directive>Options</directive> directive controls which
2166 server features are available in a particular directory.</p>
2168 <p><var>option</var> can be set to <code>None</code>, in which
2169 case none of the extra features are enabled, or one or more of
2173 <dt><code>All</code></dt>
2175 <dd>All options except for <code>MultiViews</code>. This is the default
2178 <dt><code>ExecCGI</code></dt>
2181 Execution of CGI scripts using <module>mod_cgi</module>
2184 <dt><code>FollowSymLinks</code></dt>
2188 The server will follow symbolic links in this directory.
2190 <p>Even though the server follows the symlink it does <em>not</em>
2191 change the pathname used to match against <directive type="section"
2192 module="core">Directory</directive> sections.</p>
2193 <p>Note also, that this option <strong>gets ignored</strong> if set
2194 inside a <directive type="section" module="core">Location</directive>
2198 <dt><code>Includes</code></dt>
2201 Server-side includes provided by <module>mod_include</module>
2204 <dt><code>IncludesNOEXEC</code></dt>
2208 Server-side includes are permitted, but the <code>#exec
2209 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2210 possible to <code>#include virtual</code> CGI scripts from
2211 <directive module="mod_alias">ScriptAlias</directive>ed
2214 <dt><code>Indexes</code></dt>
2217 If a URL which maps to a directory is requested, and there
2218 is no <directive module="mod_dir">DirectoryIndex</directive>
2219 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2220 <module>mod_autoindex</module> will return a formatted listing
2221 of the directory.</dd>
2223 <dt><code>MultiViews</code></dt>
2226 <a href="../content-negotiation.html">Content negotiated</a>
2227 "MultiViews" are allowed using
2228 <module>mod_negotiation</module>.</dd>
2230 <dt><code>SymLinksIfOwnerMatch</code></dt>
2232 <dd>The server will only follow symbolic links for which the
2233 target file or directory is owned by the same user id as the
2236 <note><title>Note</title> This option gets ignored if
2237 set inside a <directive module="core"
2238 type="section">Location</directive> section.</note>
2242 <p>Normally, if multiple <directive>Options</directive> could
2243 apply to a directory, then the most specific one is used and
2244 others are ignored; the options are not merged. (See <a
2245 href="../sections.html#mergin">how sections are merged</a>.)
2246 However if <em>all</em> the options on the
2247 <directive>Options</directive> directive are preceded by a
2248 <code>+</code> or <code>-</code> symbol, the options are
2249 merged. Any options preceded by a <code>+</code> are added to the
2250 options currently in force, and any options preceded by a
2251 <code>-</code> are removed from the options currently in
2254 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2257 <Directory /web/docs><br />
2259 Options Indexes FollowSymLinks<br />
2261 </Directory><br />
2263 <Directory /web/docs/spec><br />
2265 Options Includes<br />
2270 <p>then only <code>Includes</code> will be set for the
2271 <code>/web/docs/spec</code> directory. However if the second
2272 <directive>Options</directive> directive uses the <code>+</code> and
2273 <code>-</code> symbols:</p>
2276 <Directory /web/docs><br />
2278 Options Indexes FollowSymLinks<br />
2280 </Directory><br />
2282 <Directory /web/docs/spec><br />
2284 Options +Includes -Indexes<br />
2289 <p>then the options <code>FollowSymLinks</code> and
2290 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2293 <note><title>Note</title>
2294 <p>Using <code>-IncludesNOEXEC</code> or
2295 <code>-Includes</code> disables server-side includes completely
2296 regardless of the previous setting.</p>
2299 <p>The default in the absence of any other settings is
2300 <code>All</code>.</p>
2302 </directivesynopsis>
2305 <name>Require</name>
2306 <description>Selects which authenticated users can access
2307 a resource</description>
2308 <syntax>Require <var>entity-name</var> [<var>entity-name</var>] ...</syntax>
2309 <contextlist><context>directory</context><context>.htaccess</context>
2311 <override>AuthConfig</override>
2314 <p>This directive selects which authenticated users can access
2315 a resource. The allowed syntaxes are:</p>
2318 <dt><code>Require user <var>userid</var> [<var>userid</var>]
2320 <dd>Only the named users can access the resource.</dd>
2322 <dt><code>Require group <var>group-name</var> [<var>group-name</var>]
2324 <dd>Only users in the named groups can access the resource.</dd>
2326 <dt><code>Require valid-user</code></dt>
2327 <dd>All valid users can access the resource.</dd>
2330 <p><directive>Require</directive> must be accompanied by
2331 <directive module="core">AuthName</directive> and <directive
2332 module="core">AuthType</directive> directives, and directives such
2333 as <directive module="mod_authn_file">AuthUserFile</directive>
2334 and <directive module="mod_authz_groupfile">AuthGroupFile</directive> (to
2335 define users and groups) in order to work correctly. Example:</p>
2338 AuthType Basic<br />
2339 AuthName "Restricted Resource"<br />
2340 AuthUserFile /web/users<br />
2341 AuthGroupFile /web/groups<br />
2345 <p>Access controls which are applied in this way are effective for
2346 <strong>all</strong> methods. <strong>This is what is normally
2347 desired.</strong> If you wish to apply access controls only to
2348 specific methods, while leaving other methods unprotected, then
2349 place the <directive>Require</directive> statement into a
2350 <directive module="core" type="section">Limit</directive>
2353 <seealso><directive module="core">Satisfy</directive></seealso>
2354 <seealso><module>mod_authz_host</module></seealso>
2355 </directivesynopsis>
2358 <name>RLimitCPU</name>
2359 <description>Limits the CPU consumption of processes launched
2360 by Apache children</description>
2361 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
2362 <default>Unset; uses operating system defaults</default>
2363 <contextlist><context>server config</context><context>virtual host</context>
2364 <context>directory</context><context>.htaccess</context></contextlist>
2365 <override>All</override>
2368 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2369 resource limit for all processes and the second parameter sets
2370 the maximum resource limit. Either parameter can be a number,
2371 or <code>max</code> to indicate to the server that the limit should
2372 be set to the maximum allowed by the operating system
2373 configuration. Raising the maximum resource limit requires that
2374 the server is running as <code>root</code>, or in the initial startup
2377 <p>This applies to processes forked off from Apache children
2378 servicing requests, not the Apache children themselves. This
2379 includes CGI scripts and SSI exec commands, but not any
2380 processes forked off from the Apache parent such as piped
2383 <p>CPU resource limits are expressed in seconds per
2386 <seealso><directive module="core">RLimitMEM</directive></seealso>
2387 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2388 </directivesynopsis>
2391 <name>RLimitMEM</name>
2392 <description>Limits the memory consumption of processes launched
2393 by Apache children</description>
2394 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
2395 <default>Unset; uses operating system defaults</default>
2396 <contextlist><context>server config</context><context>virtual host</context>
2397 <context>directory</context><context>.htaccess</context></contextlist>
2398 <override>All</override>
2401 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2402 resource limit for all processes and the second parameter sets
2403 the maximum resource limit. Either parameter can be a number,
2404 or <code>max</code> to indicate to the server that the limit should
2405 be set to the maximum allowed by the operating system
2406 configuration. Raising the maximum resource limit requires that
2407 the server is running as <code>root</code>, or in the initial startup
2410 <p>This applies to processes forked off from Apache children
2411 servicing requests, not the Apache children themselves. This
2412 includes CGI scripts and SSI exec commands, but not any
2413 processes forked off from the Apache parent such as piped
2416 <p>Memory resource limits are expressed in bytes per
2419 <seealso><directive module="core">RLimitCPU</directive></seealso>
2420 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2421 </directivesynopsis>
2424 <name>RLimitNPROC</name>
2425 <description>Limits the number of processes that can be launched by
2426 processes launched by Apache children</description>
2427 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
2428 <default>Unset; uses operating system defaults</default>
2429 <contextlist><context>server config</context><context>virtual host</context>
2430 <context>directory</context><context>.htaccess</context></contextlist>
2431 <override>All</override>
2434 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2435 resource limit for all processes and the second parameter sets
2436 the maximum resource limit. Either parameter can be a number,
2437 or <code>max</code> to indicate to the server that the limit
2438 should be set to the maximum allowed by the operating system
2439 configuration. Raising the maximum resource limit requires that
2440 the server is running as <code>root</code>, or in the initial startup
2443 <p>This applies to processes forked off from Apache children
2444 servicing requests, not the Apache children themselves. This
2445 includes CGI scripts and SSI exec commands, but not any
2446 processes forked off from the Apache parent such as piped
2449 <p>Process limits control the number of processes per user.</p>
2451 <note><title>Note</title>
2452 <p>If CGI processes are <strong>not</strong> running
2453 under user ids other than the web server user id, this directive
2454 will limit the number of processes that the server itself can
2455 create. Evidence of this situation will be indicated by
2456 <strong><code>cannot fork</code></strong> messages in the
2457 <code>error_log</code>.</p>
2460 <seealso><directive module="core">RLimitMEM</directive></seealso>
2461 <seealso><directive module="core">RLimitCPU</directive></seealso>
2462 </directivesynopsis>
2465 <name>Satisfy</name>
2466 <description>Interaction between host-level access control and
2467 user authentication</description>
2468 <syntax>Satisfy Any|All</syntax>
2469 <default>Satisfy All</default>
2470 <contextlist><context>directory</context><context>.htaccess</context>
2472 <override>AuthConfig</override>
2473 <compatibility>Influenced by <directive module="core" type="section"
2474 >Limit</directive> and <directive module="core"
2475 type="section">LimitExcept</directive> in version 2.0.51 and
2476 later</compatibility>
2479 <p>Access policy if both <directive
2480 module="mod_authz_host">Allow</directive> and <directive
2481 module="core">Require</directive> used. The parameter can be
2482 either <code>All</code> or <code>Any</code>. This directive is only
2483 useful if access to a particular area is being restricted by both
2484 username/password <em>and</em> client host address. In this case
2485 the default behavior (<code>All</code>) is to require that the client
2486 passes the address access restriction <em>and</em> enters a valid
2487 username and password. With the <code>Any</code> option the client will be
2488 granted access if they either pass the host restriction or enter a
2489 valid username and password. This can be used to password restrict
2490 an area, but to let clients from particular addresses in without
2491 prompting for a password.</p>
2493 <p>For example, if you wanted to let people on your network have
2494 unrestricted access to a portion of your website, but require that
2495 people outside of your network provide a password, you could use a
2496 configuration similar to the following:</p>
2499 Require valid-user<br />
2500 Allow from 192.168.1<br />
2504 <p>Since version 2.0.51 <directive>Satisfy</directive> directives can
2505 be restricted to particular methods by <directive module="core"
2506 type="section">Limit</directive> and <directive module="core" type="section"
2507 >LimitExcept</directive> sections.</p>
2509 <seealso><directive module="mod_authz_host">Allow</directive></seealso>
2510 <seealso><directive module="core">Require</directive></seealso>
2511 </directivesynopsis>
2514 <name>ScriptInterpreterSource</name>
2515 <description>Technique for locating the interpreter for CGI
2516 scripts</description>
2517 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
2518 <default>ScriptInterpreterSource Script</default>
2519 <contextlist><context>server config</context><context>virtual host</context>
2520 <context>directory</context><context>.htaccess</context></contextlist>
2521 <override>FileInfo</override>
2522 <compatibility>Win32 only;
2523 option <code>Registry-Strict</code> is available in Apache 2.0 and
2524 later</compatibility>
2527 <p>This directive is used to control how Apache finds the
2528 interpreter used to run CGI scripts. The default setting is
2529 <code>Script</code>. This causes Apache to use the interpreter pointed to
2530 by the shebang line (first line, starting with <code>#!</code>) in the
2531 script. On Win32 systems this line usually looks like:</p>
2534 #!C:/Perl/bin/perl.exe
2537 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2543 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2544 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2545 searched using the script file extension (e.g., <code>.pl</code>) as a
2546 search key. The command defined by the registry subkey
2547 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2548 <code>Shell\Open\Command</code> is used to open the script file. If the
2549 registry keys cannot be found, Apache falls back to the behavior of the
2550 <code>Script</code> option.</p>
2552 <note type="warning"><title>Security</title>
2553 <p>Be careful when using <code>ScriptInterpreterSource
2554 Registry</code> with <directive
2555 module="mod_alias">ScriptAlias</directive>'ed directories, because
2556 Apache will try to execute <strong>every</strong> file within this
2557 directory. The <code>Registry</code> setting may cause undesired
2558 program calls on files which are typically not executed. For
2559 example, the default open command on <code>.htm</code> files on
2560 most Windows systems will execute Microsoft Internet Explorer, so
2561 any HTTP request for an <code>.htm</code> file existing within the
2562 script directory would start the browser in the background on the
2563 server. This is a good way to crash your system within a minute or
2567 <p>The option <code>Registry-Strict</code> which is new in Apache
2568 2.0 does the same thing as <code>Registry</code> but uses only the
2569 subkey <code>Shell\ExecCGI\Command</code>. The
2570 <code>ExecCGI</code> key is not a common one. It must be
2571 configured manually in the windows registry and hence prevents
2572 accidental program calls on your system.</p>
2574 </directivesynopsis>
2577 <name>ServerAdmin</name>
2578 <description>Email address that the server includes in error
2579 messages sent to the client</description>
2580 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
2581 <contextlist><context>server config</context><context>virtual host</context>
2585 <p>The <directive>ServerAdmin</directive> sets the contact address
2586 that the server includes in any error messages it returns to the
2587 client. If the <code>httpd</code> doesn't recognize the supplied argument
2589 assumes, that it's an <var>email-address</var> and prepends it with
2590 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2591 actually use an email address, since there are a lot of CGI scripts that
2592 make that assumption. If you want to use an URL, it should point to another
2593 server under your control. Otherwise users may not be able to contact you in
2596 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2599 ServerAdmin www-admin@foo.example.com
2601 <p>as users do not always mention that they are talking about the
2604 </directivesynopsis>
2607 <name>ServerAlias</name>
2608 <description>Alternate names for a host used when matching requests
2609 to name-virtual hosts</description>
2610 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
2611 <contextlist><context>virtual host</context></contextlist>
2614 <p>The <directive>ServerAlias</directive> directive sets the
2615 alternate names for a host, for use with <a
2616 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
2619 <VirtualHost *><br />
2620 ServerName server.domain.com<br />
2621 ServerAlias server server2.domain.com server2<br />
2623 </VirtualHost>
2626 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2627 </directivesynopsis>
2630 <name>ServerName</name>
2631 <description>Hostname and port that the server uses to identify
2632 itself</description>
2633 <syntax>ServerName <var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
2634 <contextlist><context>server config</context><context>virtual host</context>
2636 <compatibility>In version 2.0, this
2637 directive supersedes the functionality of the <directive>Port</directive>
2638 directive from version 1.3.</compatibility>
2641 <p>The <directive>ServerName</directive> directive sets the hostname and
2642 port that the server uses to identify itself. This is used when
2643 creating redirection URLs. For example, if the name of the
2644 machine hosting the web server is <code>simple.example.com</code>,
2645 but the machine also has the DNS alias <code>www.example.com</code>
2646 and you wish the web server to be so identified, the following
2647 directive should be used:</p>
2650 ServerName www.example.com:80
2653 <p>If no <directive>ServerName</directive> is specified, then the
2654 server attempts to deduce the hostname by performing a reverse
2655 lookup on the IP address. If no port is specified in the
2656 <directive>ServerName</directive>, then the server will use the port
2658 request. For optimal reliability and predictability, you should
2659 specify an explicit hostname and port using the
2660 <directive>ServerName</directive> directive.</p>
2662 <p>If you are using <a
2663 href="../vhosts/name-based.html">name-based virtual hosts</a>,
2664 the <directive>ServerName</directive> inside a
2665 <directive type="section" module="core">VirtualHost</directive>
2666 section specifies what hostname must appear in the request's
2667 <code>Host:</code> header to match this virtual host.</p>
2669 <p>See the description of the
2670 <directive module="core">UseCanonicalName</directive> directive for
2671 settings which determine whether self-referential URL's (e.g., by the
2672 <module>mod_dir</module> module) will refer to the
2673 specified port, or to the port number given in the client's request.
2677 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
2678 Apache</a></seealso>
2679 <seealso><a href="../vhosts/">Apache virtual host
2680 documentation</a></seealso>
2681 <seealso><directive module="core">UseCanonicalName</directive></seealso>
2682 <seealso><directive module="core">NameVirtualHost</directive></seealso>
2683 <seealso><directive module="core">ServerAlias</directive></seealso>
2684 </directivesynopsis>
2687 <name>ServerPath</name>
2688 <description>Legacy URL pathname for a name-based virtual host that
2689 is accessed by an incompatible browser</description>
2690 <syntax>ServerPath <var>URL-path</var></syntax>
2691 <contextlist><context>virtual host</context></contextlist>
2694 <p>The <directive>ServerPath</directive> directive sets the legacy
2695 URL pathname for a host, for use with <a
2696 href="../vhosts/">name-based virtual hosts</a>.</p>
2698 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2699 </directivesynopsis>
2702 <name>ServerRoot</name>
2703 <description>Base directory for the server installation</description>
2704 <syntax>ServerRoot <var>directory-path</var></syntax>
2705 <default>ServerRoot /usr/local/apache</default>
2706 <contextlist><context>server config</context></contextlist>
2709 <p>The <directive>ServerRoot</directive> directive sets the
2710 directory in which the server lives. Typically it will contain the
2711 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2712 paths in other configuration directives (such as <directive
2713 module="core">Include</directive> or <directive
2714 module="mod_so">LoadModule</directive>, for example) are taken as
2715 relative to this directory.</p>
2717 <example><title>Example</title>
2718 ServerRoot /home/httpd
2722 <seealso><a href="../invoking.html">the <code>-d</code>
2723 option to <code>httpd</code></a></seealso>
2724 <seealso><a href="../misc/security_tips.html#serverroot">the
2725 security tips</a> for information on how to properly set
2726 permissions on the <directive>ServerRoot</directive></seealso>
2727 </directivesynopsis>
2730 <name>ServerSignature</name>
2731 <description>Configures the footer on server-generated documents</description>
2732 <syntax>ServerSignature On|Off|EMail</syntax>
2733 <default>ServerSignature Off</default>
2734 <contextlist><context>server config</context><context>virtual host</context>
2735 <context>directory</context><context>.htaccess</context>
2737 <override>All</override>
2740 <p>The <directive>ServerSignature</directive> directive allows the
2741 configuration of a trailing footer line under server-generated
2742 documents (error messages, <module>mod_proxy</module> ftp directory
2743 listings, <module>mod_info</module> output, ...). The reason why you
2744 would want to enable such a footer line is that in a chain of proxies,
2745 the user often has no possibility to tell which of the chained servers
2746 actually produced a returned error message.</p>
2748 <p>The <code>Off</code>
2749 setting, which is the default, suppresses the footer line (and is
2750 therefore compatible with the behavior of Apache-1.2 and
2751 below). The <code>On</code> setting simply adds a line with the
2752 server version number and <directive
2753 module="core">ServerName</directive> of the serving virtual host,
2754 and the <code>EMail</code> setting additionally creates a
2755 "mailto:" reference to the <directive
2756 module="core">ServerAdmin</directive> of the referenced
2759 <p>After version 2.0.44, the details of the server version number
2760 presented are controlled by the <directive
2761 module="core">ServerTokens</directive> directive.</p>
2763 <seealso><directive module="core">ServerTokens</directive></seealso>
2764 </directivesynopsis>
2767 <name>ServerTokens</name>
2768 <description>Configures the <code>Server</code> HTTP response
2769 header</description>
2770 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
2771 <default>ServerTokens Full</default>
2772 <contextlist><context>server config</context></contextlist>
2775 <p>This directive controls whether <code>Server</code> response
2776 header field which is sent back to clients includes a
2777 description of the generic OS-type of the server as well as
2778 information about compiled-in modules.</p>
2781 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2783 <dd>Server sends (<em>e.g.</em>): <code>Server:
2786 <dt><code>ServerTokens Major</code></dt>
2788 <dd>Server sends (<em>e.g.</em>): <code>Server:
2789 Apache/2</code></dd>
2791 <dt><code>ServerTokens Minor</code></dt>
2793 <dd>Server sends (<em>e.g.</em>): <code>Server:
2794 Apache/2.0</code></dd>
2796 <dt><code>ServerTokens Min[imal]</code></dt>
2798 <dd>Server sends (<em>e.g.</em>): <code>Server:
2799 Apache/2.0.41</code></dd>
2801 <dt><code>ServerTokens OS</code></dt>
2803 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2806 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2808 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2809 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2812 <p>This setting applies to the entire server, and cannot be
2813 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2815 <p>After version 2.0.44, this directive also controls the
2816 information presented by the <directive
2817 module="core">ServerSignature</directive> directive.</p>
2819 <seealso><directive module="core">ServerSignature</directive></seealso>
2820 </directivesynopsis>
2823 <name>SetHandler</name>
2824 <description>Forces all matching files to be processed by a
2825 handler</description>
2826 <syntax>SetHandler <var>handler-name</var>|None</syntax>
2827 <contextlist><context>server config</context><context>virtual host</context>
2828 <context>directory</context><context>.htaccess</context>
2830 <override>FileInfo</override>
2831 <compatibility>Moved into the core in Apache 2.0</compatibility>
2834 <p>When placed into an <code>.htaccess</code> file or a
2835 <directive type="section" module="core">Directory</directive> or
2836 <directive type="section" module="core">Location</directive>
2837 section, this directive forces all matching files to be parsed
2838 through the <a href="../handler.html">handler</a> given by
2839 <var>handler-name</var>. For example, if you had a directory you
2840 wanted to be parsed entirely as imagemap rule files, regardless
2841 of extension, you might put the following into an
2842 <code>.htaccess</code> file in that directory:</p>
2845 SetHandler imap-file
2848 <p>Another example: if you wanted to have the server display a
2849 status report whenever a URL of
2850 <code>http://servername/status</code> was called, you might put
2851 the following into <code>httpd.conf</code>:</p>
2854 <Location /status><br />
2856 SetHandler server-status<br />
2861 <p>You can override an earlier defined <directive>SetHandler</directive>
2862 directive by using the value <code>None</code>.</p>
2865 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
2867 </directivesynopsis>
2870 <name>SetInputFilter</name>
2871 <description>Sets the filters that will process client requests and POST
2873 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2874 <contextlist><context>server config</context><context>virtual host</context>
2875 <context>directory</context><context>.htaccess</context>
2877 <override>FileInfo</override>
2880 <p>The <directive>SetInputFilter</directive> directive sets the
2881 filter or filters which will process client requests and POST
2882 input when they are received by the server. This is in addition to
2883 any filters defined elsewhere, including the
2884 <directive module="mod_mime">AddInputFilter</directive>
2887 <p>If more than one filter is specified, they must be separated
2888 by semicolons in the order in which they should process the
2891 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
2892 </directivesynopsis>
2895 <name>SetOutputFilter</name>
2896 <description>Sets the filters that will process responses from the
2897 server</description>
2898 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2899 <contextlist><context>server config</context><context>virtual host</context>
2900 <context>directory</context><context>.htaccess</context>
2902 <override>FileInfo</override>
2905 <p>The <directive>SetOutputFilter</directive> directive sets the filters
2906 which will process responses from the server before they are
2907 sent to the client. This is in addition to any filters defined
2908 elsewhere, including the
2909 <directive module="mod_mime">AddOutputFilter</directive>
2912 <p>For example, the following configuration will process all files
2913 in the <code>/www/data/</code> directory for server-side
2917 <Directory /www/data/><br />
2919 SetOutputFilter INCLUDES<br />
2924 <p>If more than one filter is specified, they must be separated
2925 by semicolons in the order in which they should process the
2928 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
2929 </directivesynopsis>
2932 <name>TimeOut</name>
2933 <description>Amount of time the server will wait for
2934 certain events before failing a request</description>
2935 <syntax>TimeOut <var>seconds</var></syntax>
2936 <default>TimeOut 300</default>
2937 <contextlist><context>server config</context></contextlist>
2940 <p>The <directive>TimeOut</directive> directive currently defines
2941 the amount of time Apache will wait for three things:</p>
2944 <li>The total amount of time it takes to receive a GET
2947 <li>The amount of time between receipt of TCP packets on a
2948 POST or PUT request.</li>
2950 <li>The amount of time between ACKs on transmissions of TCP
2951 packets in responses.</li>
2954 <p>We plan on making these separately configurable at some point
2955 down the road. The timer used to default to 1200 before 1.2,
2956 but has been lowered to 300 which is still far more than
2957 necessary in most situations. It is not set any lower by
2958 default because there may still be odd places in the code where
2959 the timer is not reset when a packet is sent. </p>
2961 </directivesynopsis>
2964 <name>UseCanonicalName</name>
2965 <description>Configures how the server determines its own name and
2967 <syntax>UseCanonicalName On|Off|DNS</syntax>
2968 <default>UseCanonicalName Off</default>
2969 <contextlist><context>server config</context><context>virtual host</context>
2970 <context>directory</context></contextlist>
2973 <p>In many situations Apache must construct a <em>self-referential</em>
2974 URL -- that is, a URL that refers back to the same server. With
2975 <code>UseCanonicalName On</code> Apache will use the hostname and port
2976 specified in the <directive module="core">ServerName</directive>
2977 directive to construct the canonical name for the server. This name
2978 is used in all self-referential URLs, and for the values of
2979 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
2981 <p>With <code>UseCanonicalName Off</code> Apache will form
2982 self-referential URLs using the hostname and port supplied by
2983 the client if any are supplied (otherwise it will use the
2984 canonical name, as defined above). These values are the same
2985 that are used to implement <a
2986 href="../vhosts/name-based.html">name based virtual hosts</a>,
2987 and are available with the same clients. The CGI variables
2988 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
2989 constructed from the client supplied values as well.</p>
2991 <p>An example where this may be useful is on an intranet server
2992 where you have users connecting to the machine using short
2993 names such as <code>www</code>. You'll notice that if the users
2994 type a shortname, and a URL which is a directory, such as
2995 <code>http://www/splat</code>, <em>without the trailing
2996 slash</em> then Apache will redirect them to
2997 <code>http://www.domain.com/splat/</code>. If you have
2998 authentication enabled, this will cause the user to have to
2999 authenticate twice (once for <code>www</code> and once again
3000 for <code>www.domain.com</code> -- see <a
3001 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3002 FAQ on this subject for more information</a>). But if
3003 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3004 Apache will redirect to <code>http://www/splat/</code>.</p>
3006 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3007 which is intended for use with mass IP-based virtual hosting to
3008 support ancient clients that do not provide a
3009 <code>Host:</code> header. With this option Apache does a
3010 reverse DNS lookup on the server IP address that the client
3011 connected to in order to work out self-referential URLs.</p>
3013 <note type="warning"><title>Warning</title>
3014 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3015 they may be broken by this option. The client is essentially free
3016 to give whatever value they want as a hostname. But if the CGI is
3017 only using <code>SERVER_NAME</code> to construct self-referential URLs
3018 then it should be just fine.</p>
3021 <seealso><directive module="core">ServerName</directive></seealso>
3022 <seealso><directive module="mpm_common">Listen</directive></seealso>
3023 </directivesynopsis>
3025 <directivesynopsis type="section">
3026 <name>VirtualHost</name>
3027 <description>Contains directives that apply only to a specific
3028 hostname or IP address</description>
3029 <syntax><VirtualHost
3030 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3031 ...> ... </VirtualHost></syntax>
3032 <contextlist><context>server config</context></contextlist>
3035 <p><directive type="section">VirtualHost</directive> and
3036 <code></VirtualHost></code> are used to enclose a group of
3037 directives that will apply only to a particular virtual host. Any
3038 directive that is allowed in a virtual host context may be
3039 used. When the server receives a request for a document on a
3040 particular virtual host, it uses the configuration directives
3041 enclosed in the <directive type="section">VirtualHost</directive>
3042 section. <var>Addr</var> can be:</p>
3045 <li>The IP address of the virtual host;</li>
3047 <li>A fully qualified domain name for the IP address of the
3050 <li>The character <code>*</code>, which is used only in combination with
3051 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3053 <li>The string <code>_default_</code>, which is used only
3054 with IP virtual hosting to catch unmatched IP addresses.</li>
3057 <example><title>Example</title>
3058 <VirtualHost 10.1.2.3><br />
3060 ServerAdmin webmaster@host.foo.com<br />
3061 DocumentRoot /www/docs/host.foo.com<br />
3062 ServerName host.foo.com<br />
3063 ErrorLog logs/host.foo.com-error_log<br />
3064 TransferLog logs/host.foo.com-access_log<br />
3066 </VirtualHost>
3070 <p>IPv6 addresses must be specified in square brackets because
3071 the optional port number could not be determined otherwise. An
3072 IPv6 example is shown below:</p>
3075 <VirtualHost [fe80::a00:20ff:fea7:ccea]><br />
3077 ServerAdmin webmaster@host.example.com<br />
3078 DocumentRoot /www/docs/host.example.com<br />
3079 ServerName host.example.com<br />
3080 ErrorLog logs/host.example.com-error_log<br />
3081 TransferLog logs/host.example.com-access_log<br />
3083 </VirtualHost>
3086 <p>Each Virtual Host must correspond to a different IP address,
3087 different port number or a different host name for the server,
3088 in the former case the server machine must be configured to
3089 accept IP packets for multiple addresses. (If the machine does
3090 not have multiple network interfaces, then this can be
3091 accomplished with the <code>ifconfig alias</code> command -- if
3092 your OS supports it).</p>
3094 <note><title>Note</title>
3095 <p>The use of <directive type="section">VirtualHost</directive> does
3096 <strong>not</strong> affect what addresses Apache listens on. You
3097 may need to ensure that Apache is listening on the correct addresses
3098 using <directive module="mpm_common">Listen</directive>.</p>
3101 <p>When using IP-based virtual hosting, the special name
3102 <code>_default_</code> can be specified in
3103 which case this virtual host will match any IP address that is
3104 not explicitly listed in another virtual host. In the absence
3105 of any <code>_default_</code> virtual host the "main" server config,
3106 consisting of all those definitions outside any VirtualHost
3107 section, is used when no IP-match occurs. (But note that any IP
3108 address that matches a <directive
3109 module="core">NameVirtualHost</directive> directive will use neither
3110 the "main" server config nor the <code>_default_</code> virtual host.
3111 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
3112 documentation for further details.)</p>
3114 <p>You can specify a <code>:port</code> to change the port that is
3115 matched. If unspecified then it defaults to the same port as the
3116 most recent <directive module="mpm_common">Listen</directive>
3117 statement of the main server. You may also specify <code>:*</code>
3118 to match all ports on that address. (This is recommended when used
3119 with <code>_default_</code>.)</p>
3121 <note type="warning"><title>Security</title>
3122 <p>See the <a href="../misc/security_tips.html">security tips</a>
3123 document for details on why your security could be compromised if the
3124 directory where log files are stored is writable by anyone other
3125 than the user that starts the server.</p>
3128 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
3129 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3130 Apache</a></seealso>
3131 <seealso><a href="../bind.html">Setting
3132 which addresses and ports Apache uses</a></seealso>
3133 <seealso><a href="../sections.html">How <Directory>, <Location>
3134 and <Files> sections work</a> for an explanation of how these
3135 different sections are combined when a request is received</seealso>
3136 </directivesynopsis>