2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2002-2004 The Apache Software Foundation
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
22 <modulesynopsis metafile="core.xml.meta">
25 <description>Core Apache HTTP Server features that are always
26 available</description>
30 <name>AcceptPathInfo</name>
31 <description>Resources accept trailing pathname information</description>
32 <syntax>AcceptPathInfo On|Off|Default</syntax>
33 <default>AcceptPathInfo Default</default>
34 <contextlist><context>server config</context>
35 <context>virtual host</context><context>directory</context>
36 <context>.htaccess</context></contextlist>
37 <override>FileInfo</override>
38 <compatibility>Available in Apache 2.0.30 and later</compatibility>
42 <p>This directive controls whether requests that contain trailing
43 pathname information that follows an actual filename (or
44 non-existent file in an existing directory) will be accepted or
45 rejected. The trailing pathname information can be made
46 available to scripts in the <code>PATH_INFO</code> environment
49 <p>For example, assume the location <code>/test/</code> points to
50 a directory that contains only the single file
51 <code>here.html</code>. Then requests for
52 <code>/test/here.html/more</code> and
53 <code>/test/nothere.html/more</code> both collect
54 <code>/more</code> as <code>PATH_INFO</code>.</p>
56 <p>The three possible arguments for the
57 <directive>AcceptPathInfo</directive> directive are:</p>
59 <dt><code>Off</code></dt><dd>A request will only be accepted if it
60 maps to a literal path that exists. Therefore a request with
61 trailing pathname information after the true filename such as
62 <code>/test/here.html/more</code> in the above example will return
63 a 404 NOT FOUND error.</dd>
65 <dt><code>On</code></dt><dd>A request will be accepted if a
66 leading path component maps to a file that exists. The above
67 example <code>/test/here.html/more</code> will be accepted if
68 <code>/test/here.html</code> maps to a valid file.</dd>
70 <dt><code>Default</code></dt><dd>The treatment of requests with
71 trailing pathname information is determined by the <a
72 href="../handler.html">handler</a> responsible for the request.
73 The core handler for normal files defaults to rejecting
74 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
75 href="mod_cgi.html">cgi-script</a> and <a
76 href="mod_isapi.html">isapi-isa</a>, generally accept
77 <code>PATH_INFO</code> by default.</dd>
80 <p>The primary purpose of the <code>AcceptPathInfo</code>
81 directive is to allow you to override the handler's choice of
82 accepting or rejecting <code>PATH_INFO</code>. This override is required,
83 for example, when you use a <a href="../filter.html">filter</a>, such
84 as <a href="mod_include.html">INCLUDES</a>, to generate content
85 based on <code>PATH_INFO</code>. The core handler would usually reject
86 the request, so you can use the following configuration to enable
90 <Files "mypaths.shtml"><br />
92 Options +Includes<br />
93 SetOutputFilter INCLUDES<br />
94 AcceptPathInfo On<br />
103 <name>AccessFileName</name>
104 <description>Name of the distributed configuration file</description>
105 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
106 <default>AccessFileName .htaccess</default>
107 <contextlist><context>server config</context><context>virtual host</context>
111 <p>While processing a request the server looks for
112 the first existing configuration file from this list of names in
113 every directory of the path to the document, if distributed
114 configuration files are <a href="#allowoverride">enabled for that
115 directory</a>. For example:</p>
121 <p>before returning the document
122 <code>/usr/local/web/index.html</code>, the server will read
123 <code>/.acl</code>, <code>/usr/.acl</code>,
124 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
125 for directives, unless they have been disabled with</p>
128 <Directory /><br />
130 AllowOverride None<br />
135 <seealso><directive module="core">AllowOverride</directive></seealso>
136 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
137 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
141 <name>AddDefaultCharset</name>
142 <description>Default charset parameter to be added when a response
143 content-type is "text/plain" or "text/html"</description>
144 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
145 <default>AddDefaultCharset Off</default>
146 <contextlist><context>server config</context>
147 <context>virtual host</context><context>directory</context>
148 <context>.htaccess</context></contextlist>
149 <override>FileInfo</override>
152 <p>This directive specifies a default value for the media type
153 charset parameter (the name of a character encoding) to be added
154 to a response if and only if the response's content-type is either
155 "text/plain" or "text/html". This should override any charset
156 specified in the body of the document via a <code>META</code> tag,
157 though the exact behavior is often dependent on the user's client
158 configuration. A setting of <code>AddDefaultCharset Off</code>
159 disables this functionality. <code>AddDefaultCharset On</code> enables
160 a default charset of <code>iso-8859-1</code>. Any other value is assumed
161 to be the <var>charset</var> to be used, which should be one of the
162 <a href="http://www.iana.org/assignments/character-sets">IANA registered
163 charset values</a> for use in MIME media types.
167 AddDefaultCharset utf-8
170 <p><code>AddDefaultCharset</code> should only be used when all
171 of the text resources to which it applies are known to be in that
172 character encoding and it is too inconvenient to label their charset
173 individually. One such example is to add the charset parameter
174 to resources containing generated content, such as legacy CGI
175 scripts, that might be vulnerable to cross-site scripting attacks
176 due to user-provided data being included in the output. Note, however,
177 that a better solution is to just fix (or delete) those scripts, since
178 setting a default charset does not protect users that have enabled
179 the "auto-detect character encoding" feature on their browser.</p>
181 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
185 <name>AddOutputFilterByType</name>
186 <description>assigns an output filter to a particular MIME-type</description>
187 <syntax>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
188 <var>MIME-type</var> [<var>MIME-type</var>] ...</syntax>
189 <contextlist><context>server config</context>
190 <context>virtual host</context><context>directory</context>
191 <context>.htaccess</context></contextlist>
192 <override>FileInfo</override>
193 <compatibility>Available in Apache 2.0.33 and later</compatibility>
196 <p>This directive activates a particular output <a
197 href="../filter.html">filter</a> for a request depending on the
198 response MIME-type.</p>
200 <p>The following example uses the <code>DEFLATE</code> filter, which
201 is provided by <module>mod_deflate</module>. It will compress all
202 output (either static or dynamic) which is labeled as
203 <code>text/html</code> or <code>text/plain</code> before it is sent
207 AddOutputFilterByType DEFLATE text/html text/plain
210 <p>If you want the content to be processed by more than one filter, their
211 names have to be separated by semicolons. It's also possible to use one
212 <directive>AddOutputFilterByType</directive> directive for each of
215 <p>The configuration below causes all script output labeled as
216 <code>text/html</code> to be processed at first by the
217 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
221 <Location /cgi-bin/><br />
223 Options Includes<br />
224 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
229 <note type="warning"><title>Note</title>
230 <p>Enabling filters with <directive>AddOutputFilterByType</directive>
231 may fail partially or completely in some cases. For example, no
232 filters are applied if the MIME-type could not be determined and falls
233 back to the <directive module="core">DefaultType</directive> setting,
234 even if the <directive module="core">DefaultType</directive> is the
237 <p>However, if you want to make sure, that the filters will be
238 applied, assign the content type to a resource explicitly, for
239 example with <directive module="mod_mime">AddType</directive> or
240 <directive module="core">ForceType</directive>. Setting the
241 content type within a (non-nph) CGI script is also safe.</p>
243 <p>The by-type output filters are never applied on proxy requests.</p>
247 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
248 <seealso><directive module="core">SetOutputFilter</directive></seealso>
249 <seealso><a href="../filter.html">filters</a></seealso>
253 <name>AllowEncodedSlashes</name>
254 <description>Determines whether encoded path separators in URLs are allowed to
255 be passed through</description>
256 <syntax>AllowEncodedSlashes On|Off</syntax>
257 <default>AllowEncodedSlashes Off</default>
258 <contextlist><context>server config</context><context>virtual host</context>
260 <compatibility>Available in Apache 2.0.46 and later</compatibility>
263 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
264 which contain encoded path separators (<code>%2F</code> for <code>/</code>
265 and additionally <code>%5C</code> for <code>\</code> on according systems)
266 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
268 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
269 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
271 <note><title>Note</title>
272 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
273 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
274 according systems) will be left as such in the otherwise decoded URL
278 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
282 <name>AllowOverride</name>
283 <description>Types of directives that are allowed in
284 <code>.htaccess</code> files</description>
285 <syntax>AllowOverride All|None|<var>directive-type</var>
286 [<var>directive-type</var>] ...</syntax>
287 <default>AllowOverride All</default>
288 <contextlist><context>directory</context></contextlist>
291 <p>When the server finds an <code>.htaccess</code> file (as
292 specified by <directive module="core">AccessFileName</directive>)
293 it needs to know which directives declared in that file can override
294 earlier configuration directives.</p>
296 <note><title>Only available in <Directory> sections</title>
297 <directive>AllowOverride</directive> is valid only in
298 <directive type="section" module="core">Directory</directive>
299 sections specified without regular expressions, not in <directive
300 type="section" module="core">Location</directive>, <directive
301 module="core" type="section">DirectoryMatch</directive> or
302 <directive type="section" module="core">Files</directive> sections.
305 <p>When this directive is set to <code>None</code>, then
306 <a href="#accessfilename">.htaccess</a> files are completely ignored.
307 In this case, the server will not even attempt to read
308 <code>.htaccess</code> files in the filesystem.</p>
310 <p>When this directive is set to <code>All</code>, then any
311 directive which has the .htaccess <a
312 href="directive-dict.html#Context">Context</a> is allowed in
313 <code>.htaccess</code> files.</p>
315 <p>The <var>directive-type</var> can be one of the following
316 groupings of directives.</p>
323 Allow use of the authorization directives (<directive
324 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
325 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
326 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
327 <directive module="core">AuthName</directive>,
328 <directive module="core">AuthType</directive>, <directive
329 module="mod_authn_file">AuthUserFile</directive>, <directive
330 module="core">Require</directive>, <em>etc.</em>).</dd>
335 Allow use of the directives controlling document types (<directive
336 module="core">DefaultType</directive>, <directive
337 module="core">ErrorDocument</directive>, <directive
338 module="core">ForceType</directive>, <directive
339 module="mod_negotiation">LanguagePriority</directive>,
340 <directive module="core">SetHandler</directive>, <directive
341 module="core">SetInputFilter</directive>, <directive
342 module="core">SetOutputFilter</directive>, and
343 <module>mod_mime</module> Add* and Remove*
344 directives, <em>etc.</em>).</dd>
349 Allow use of the directives controlling directory indexing
351 module="mod_autoindex">AddDescription</directive>,
352 <directive module="mod_autoindex">AddIcon</directive>, <directive
353 module="mod_autoindex">AddIconByEncoding</directive>,
354 <directive module="mod_autoindex">AddIconByType</directive>,
355 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
356 module="mod_dir">DirectoryIndex</directive>, <directive
357 module="mod_autoindex">FancyIndexing</directive>, <directive
358 module="mod_autoindex">HeaderName</directive>, <directive
359 module="mod_autoindex">IndexIgnore</directive>, <directive
360 module="mod_autoindex">IndexOptions</directive>, <directive
361 module="mod_autoindex">ReadmeName</directive>,
367 Allow use of the directives controlling host access (<directive
368 module="mod_authz_host">Allow</directive>, <directive
369 module="mod_authz_host">Deny</directive> and <directive
370 module="mod_authz_host">Order</directive>).</dd>
372 <dt>Options[=<var>Option</var>,...]</dt>
375 Allow use of the directives controlling specific directory
376 features (<directive module="core">Options</directive> and
377 <directive module="mod_include">XBitHack</directive>).
378 An equal sign may be given followed by a comma (but no spaces)
379 separated lists of options that may be set using the <directive
380 module="core">Options</directive> command.</dd>
386 AllowOverride AuthConfig Indexes
389 <p>In the example above all directives that are neither in the group
390 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
394 <seealso><directive module="core">AccessFileName</directive></seealso>
395 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
396 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
400 <name>AuthName</name>
401 <description>Authorization realm for use in HTTP
402 authentication</description>
403 <syntax>AuthName <var>auth-domain</var></syntax>
404 <contextlist><context>directory</context><context>.htaccess</context>
406 <override>AuthConfig</override>
409 <p>This directive sets the name of the authorization realm for a
410 directory. This realm is given to the client so that the user
411 knows which username and password to send.
412 <directive>AuthName</directive> takes a single argument; if the
413 realm name contains spaces, it must be enclosed in quotation
414 marks. It must be accompanied by <directive
415 module="core">AuthType</directive> and <directive
416 module="core">Require</directive> directives, and directives such
417 as <directive module="mod_authn_file">AuthUserFile</directive> and
418 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
424 AuthName "Top Secret"
427 <p>The string provided for the <code>AuthName</code> is what will
428 appear in the password dialog provided by most browsers.</p>
431 href="../howto/auth.html">Authentication, Authorization, and
432 Access Control</a></seealso>
436 <name>AuthType</name>
437 <description>Type of user authentication</description>
438 <syntax>AuthType Basic|Digest</syntax>
439 <contextlist><context>directory</context><context>.htaccess</context>
441 <override>AuthConfig</override>
444 <p>This directive selects the type of user authentication for a
445 directory. Only <code>Basic</code> and <code>Digest</code> are
446 currently implemented.
448 It must be accompanied by <directive
449 module="core">AuthName</directive> and <directive
450 module="core">Require</directive> directives, and directives such
451 as <directive module="mod_authn_file">AuthUserFile</directive> and
452 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
455 <seealso><a href="../howto/auth.html">Authentication, Authorization,
456 and Access Control</a></seealso>
460 <name>CGIMapExtension</name>
461 <description>Technique for locating the interpreter for CGI
462 scripts</description>
463 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
464 <contextlist><context>directory</context><context>.htaccess</context>
466 <override>FileInfo</override>
467 <compatibility>NetWare only</compatibility>
470 <p>This directive is used to control how Apache finds the
471 interpreter used to run CGI scripts. For example, setting
472 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
473 cause all CGI script files with a <code>.foo</code> extension to
474 be passed to the FOO interpreter.</p>
479 <name>ContentDigest</name>
480 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
481 headers</description>
482 <syntax>ContentDigest On|Off</syntax>
483 <default>ContentDigest Off</default>
484 <contextlist><context>server config</context><context>virtual host</context>
485 <context>directory</context><context>.htaccess</context>
487 <override>Options</override>
488 <status>Experimental</status>
491 <p>This directive enables the generation of
492 <code>Content-MD5</code> headers as defined in RFC1864
493 respectively RFC2068.</p>
495 <p>MD5 is an algorithm for computing a "message digest"
496 (sometimes called "fingerprint") of arbitrary-length data, with
497 a high degree of confidence that any alterations in the data
498 will be reflected in alterations in the message digest.</p>
500 <p>The <code>Content-MD5</code> header provides an end-to-end
501 message integrity check (MIC) of the entity-body. A proxy or
502 client may check this header for detecting accidental
503 modification of the entity-body in transit. Example header:</p>
506 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
509 <p>Note that this can cause performance problems on your server
510 since the message digest is computed on every request (the
511 values are not cached).</p>
513 <p><code>Content-MD5</code> is only sent for documents served
514 by the <module>core</module>, and not by any module. For example,
515 SSI documents, output from CGI scripts, and byte range responses
516 do not have this header.</p>
521 <name>DefaultType</name>
522 <description>MIME content-type that will be sent if the
523 server cannot determine a type in any other way</description>
524 <syntax>DefaultType <var>MIME-type</var></syntax>
525 <default>DefaultType text/plain</default>
526 <contextlist><context>server config</context><context>virtual host</context>
527 <context>directory</context><context>.htaccess</context>
529 <override>FileInfo</override>
532 <p>There will be times when the server is asked to provide a
533 document whose type cannot be determined by its MIME types
536 <p>The server must inform the client of the content-type of the
537 document, so in the event of an unknown type it uses the
538 <code>DefaultType</code>. For example:</p>
541 DefaultType image/gif
544 <p>would be appropriate for a directory which contained many GIF
545 images with filenames missing the <code>.gif</code> extension.</p>
547 <p>Note that unlike <directive
548 module="core">ForceType</directive>, this directive only
549 provides the default mime-type. All other mime-type definitions,
550 including filename extensions, that might identify the media type
551 will override this default.</p>
555 <directivesynopsis type="section">
556 <name>Directory</name>
557 <description>Enclose a group of directives that apply only to the
558 named file-system directory and sub-directories</description>
559 <syntax><Directory <var>directory-path</var>>
560 ... </Directory></syntax>
561 <contextlist><context>server config</context><context>virtual host</context>
565 <p><directive type="section">Directory</directive> and
566 <code></Directory></code> are used to enclose a group of
567 directives that will apply only to the named directory and
568 sub-directories of that directory. Any directive that is allowed
569 in a directory context may be used. <var>Directory-path</var> is
570 either the full path to a directory, or a wild-card string using
571 Unix shell-style matching. In a wild-card string, <code>?</code> matches
572 any single character, and <code>*</code> matches any sequences of
573 characters. You may also use <code>[]</code> character ranges. None
574 of the wildcards match a `/' character, so <code><Directory
575 /*/public_html></code> will not match
576 <code>/home/user/public_html</code>, but <code><Directory
577 /home/*/public_html></code> will match. Example:</p>
580 <Directory /usr/local/httpd/htdocs><br />
582 Options Indexes FollowSymLinks<br />
588 <p>Be careful with the <var>directory-path</var> arguments:
589 They have to literally match the filesystem path which Apache uses
590 to access the files. Directives applied to a particular
591 <code><Directory></code> will not apply to files accessed from
592 that same directory via a different path, such as via different symbolic
597 expressions can also be used, with the addition of the
598 <code>~</code> character. For example:</p>
601 <Directory ~ "^/www/.*/[0-9]{3}">
604 <p>would match directories in <code>/www/</code> that consisted of
607 <p>If multiple (non-regular expression) <directive
608 type="section">Directory</directive> sections
609 match the directory (or one of its parents) containing a document,
610 then the directives are applied in the order of shortest match
611 first, interspersed with the directives from the <a
612 href="#accessfilename">.htaccess</a> files. For example,
616 <Directory /><br />
618 AllowOverride None<br />
620 </Directory><br />
622 <Directory /home/><br />
624 AllowOverride FileInfo<br />
629 <p>for access to the document <code>/home/web/dir/doc.html</code>
633 <li>Apply directive <code>AllowOverride None</code>
634 (disabling <code>.htaccess</code> files).</li>
636 <li>Apply directive <code>AllowOverride FileInfo</code> (for
637 directory <code>/home</code>).</li>
639 <li>Apply any <code>FileInfo</code> directives in
640 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
641 <code>/home/web/dir/.htaccess</code> in that order.</li>
644 <p>Regular expressions are not considered until after all of the
645 normal sections have been applied. Then all of the regular
646 expressions are tested in the order they appeared in the
647 configuration file. For example, with</p>
650 <Directory ~ abc$><br />
652 # ... directives here ...<br />
657 <p>the regular expression section won't be considered until after
658 all normal <directive type="section">Directory</directive>s and
659 <code>.htaccess</code> files have been applied. Then the regular
660 expression will match on <code>/home/abc/public_html/abc</code> and
661 the corresponding <directive type="section">Directory</directive> will
664 <p><strong>Note that the default Apache access for
665 <code><Directory /></code> is <code>Allow from All</code>.
666 This means that Apache will serve any file mapped from an URL. It is
667 recommended that you change this with a block such
671 <Directory /><br />
673 Order Deny,Allow<br />
679 <p><strong>and then override this for directories you
680 <em>want</em> accessible. See the <a
681 href="../misc/security_tips.html">Security Tips</a> page for more
682 details.</strong></p>
684 <p>The directory sections occur in the <code>httpd.conf</code> file.
685 <directive type="section">Directory</directive> directives
686 cannot nest, and cannot appear in a <directive module="core"
687 type="section">Limit</directive> or <directive module="core"
688 type="section">LimitExcept</directive> section.</p>
690 <seealso><a href="../sections.html">How <Directory>,
691 <Location> and <Files> sections work</a> for an
692 explanation of how these different sections are combined when a
693 request is received</seealso>
696 <directivesynopsis type="section">
697 <name>DirectoryMatch</name>
698 <description>Enclose directives that apply to
699 file-system directories matching a regular expression and their
700 subdirectories</description>
701 <syntax><DirectoryMatch <var>regex</var>>
702 ... </DirectoryMatch></syntax>
703 <contextlist><context>server config</context><context>virtual host</context>
707 <p><directive type="section">DirectoryMatch</directive> and
708 <code></DirectoryMatch></code> are used to enclose a group
709 of directives which will apply only to the named directory and
710 sub-directories of that directory, the same as <directive
711 module="core" type="section">Directory</directive>. However, it
712 takes as an argument a regular expression. For example:</p>
715 <DirectoryMatch "^/www/.*/[0-9]{3}">
718 <p>would match directories in <code>/www/</code> that consisted of three
721 <seealso><directive type="section" module="core">Directory</directive> for
722 a description of how regular expressions are mixed in with normal
723 <directive type="section">Directory</directive>s</seealso>
725 href="../sections.html">How <Directory>, <Location> and
726 <Files> sections work</a> for an explanation of how these different
727 sections are combined when a request is received</seealso>
731 <name>DocumentRoot</name>
732 <description>Directory that forms the main document tree visible
733 from the web</description>
734 <syntax>DocumentRoot <var>directory-path</var></syntax>
735 <default>DocumentRoot /usr/local/apache/htdocs</default>
736 <contextlist><context>server config</context><context>virtual host</context>
740 <p>This directive sets the directory from which <program>httpd</program>
741 will serve files. Unless matched by a directive like <directive
742 module="mod_alias">Alias</directive>, the server appends the
743 path from the requested URL to the document root to make the
744 path to the document. Example:</p>
747 DocumentRoot /usr/web
751 <code>http://www.my.host.com/index.html</code> refers to
752 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
753 not absolute then it is assumed to be relative to the <directive
754 module="core">ServerRoot</directive>.</p>
756 <p>The <directive>DocumentRoot</directive> should be specified without
757 a trailing slash.</p>
759 <seealso><a href="../urlmapping.html">Mapping URLs to Filesystem
760 Location</a></seealso>
764 <name>EnableMMAP</name>
765 <description>Use memory-mapping to read files during delivery</description>
766 <syntax>EnableMMAP On|Off</syntax>
767 <default>EnableMMAP On</default>
768 <contextlist><context>server config</context><context>virtual host</context>
769 <context>directory</context><context>.htaccess</context>
771 <override>FileInfo</override>
774 <p>This directive controls whether the <program>httpd</program> may use
775 memory-mapping if it needs to read the contents of a file during
776 delivery. By default, when the handling of a request requires
777 access to the data within a file -- for example, when delivering a
778 server-parsed file using <module>mod_include</module> -- Apache
779 memory-maps the file if the OS supports it.</p>
781 <p>This memory-mapping sometimes yields a performance improvement.
782 But in some environments, it is better to disable the memory-mapping
783 to prevent operational problems:</p>
786 <li>On some multiprocessor systems, memory-mapping can reduce the
787 performance of the <program>httpd</program>.</li>
788 <li>With an NFS-mounted <directive module="core">DocumentRoot</directive>,
789 the <program>httpd</program> may crash due to a segmentation fault if a file
790 is deleted or truncated while the <program>httpd</program> has it
794 <p>For server configurations that are vulnerable to these problems,
795 you should disable memory-mapping of delivered files by specifying:</p>
801 <p>For NFS mounted files, this feature may be disabled explicitly for
802 the offending files by specifying:</p>
805 <Directory "/path-to-nfs-files">
815 <name>EnableSendfile</name>
816 <description>Use the kernel sendfile support to deliver files to the client</description>
817 <syntax>EnableSendfile On|Off</syntax>
818 <default>EnableSendfile On</default>
819 <contextlist><context>server config</context><context>virtual host</context>
820 <context>directory</context><context>.htaccess</context>
822 <override>FileInfo</override>
823 <compatibility>Available in version 2.0.44 and later</compatibility>
826 <p>This directive controls whether <program>httpd</program> may use the
827 sendfile support from the kernel to transmit file contents to the client.
828 By default, when the handling of a request requires no access
829 to the data within a file -- for example, when delivering a
830 static file -- Apache uses sendfile to deliver the file contents
831 without ever reading the file if the OS supports it.</p>
833 <p>This sendfile mechanism avoids separate read and send operations,
834 and buffer allocations. But on some platforms or within some
835 filesystems, it is better to disable this feature to avoid
836 operational problems:</p>
839 <li>Some platforms may have broken sendfile support that the build
840 system did not detect, especially if the binaries were built on
841 another box and moved to such a machine with broken sendfile
843 <li>On Linux the use of sendfile triggers TCP-checksum
844 offloading bugs on certain networking cards when using IPv6.</li>
845 <li>With a network-mounted <directive
846 module="core">DocumentRoot</directive> (e.g., NFS or SMB),
847 the kernel may be unable to serve the network file through
851 <p>For server configurations that are vulnerable to these problems,
852 you should disable this feature by specifying:</p>
858 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
859 for the offending files by specifying:</p>
862 <Directory "/path-to-nfs-files">
872 <name>ErrorDocument</name>
873 <description>What the server will return to the client
874 in case of an error</description>
875 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
876 <contextlist><context>server config</context><context>virtual host</context>
877 <context>directory</context><context>.htaccess</context>
879 <override>FileInfo</override>
880 <compatibility>Quoting syntax for text messages is different in Apache
884 <p>In the event of a problem or error, Apache can be configured
885 to do one of four things,</p>
888 <li>output a simple hardcoded error message</li>
890 <li>output a customized message</li>
892 <li>redirect to a local <var>URL-path</var> to handle the
895 <li>redirect to an external <var>URL</var> to handle the
899 <p>The first option is the default, while options 2-4 are
900 configured using the <directive>ErrorDocument</directive>
901 directive, which is followed by the HTTP response code and a URL
902 or a message. Apache will sometimes offer additional information
903 regarding the problem/error.</p>
905 <p>URLs can begin with a slash (/) for local URLs, or be a full
906 URL which the client can resolve. Alternatively, a message can
907 be provided to be displayed by the browser. Examples:</p>
910 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
911 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
912 ErrorDocument 401 /subscription_info.html<br />
913 ErrorDocument 403 "Sorry can't allow you access today"
916 <p>Additionally, the special value <code>default</code> can be used
917 to specify Apache's simple hardcoded message. While not required
918 under normal circumstances, <code>default</code> will restore
919 Apache's simple hardcoded message for configurations that would
920 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
923 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
924 <Directory /web/docs><br />
926 ErrorDocument 404 default<br />
931 <p>Note that when you specify an <directive>ErrorDocument</directive>
932 that points to a remote URL (ie. anything with a method such as
933 <code>http</code> in front of it), Apache will send a redirect to the
934 client to tell it where to find the document, even if the
935 document ends up being on the same server. This has several
936 implications, the most important being that the client will not
937 receive the original error status code, but instead will
938 receive a redirect status code. This in turn can confuse web
939 robots and other clients which try to determine if a URL is
940 valid using the status code. In addition, if you use a remote
941 URL in an <code>ErrorDocument 401</code>, the client will not
942 know to prompt the user for a password since it will not
943 receive the 401 status code. Therefore, <strong>if you use an
944 <code>ErrorDocument 401</code> directive then it must refer to a local
945 document.</strong></p>
947 <p>Microsoft Internet Explorer (MSIE) will by default ignore
948 server-generated error messages when they are "too small" and substitute
949 its own "friendly" error messages. The size threshold varies depending on
950 the type of error, but in general, if you make your error document
951 greater than 512 bytes, then MSIE will show the server-generated
952 error rather than masking it. More information is available in
953 Microsoft Knowledge Base article <a
954 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
957 <p>Prior to version 2.0, messages were indicated by prefixing
958 them with a single unmatched double quote character.</p>
961 <seealso><a href="../custom-error.html">documentation of
962 customizable responses</a></seealso>
966 <name>ErrorLog</name>
967 <description>Location where the server will log errors</description>
968 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
969 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
970 <contextlist><context>server config</context><context>virtual host</context>
974 <p>The <directive>ErrorLog</directive> directive sets the name of
975 the file to which the server will log any errors it encounters. If
976 the <var>file-path</var> is not absolute then it is assumed to be
977 relative to the <directive module="core">ServerRoot</directive>.</p>
979 <example><title>Example</title>
980 ErrorLog /var/log/httpd/error_log
983 <p>If the <var>file-path</var>
984 begins with a pipe (|) then it is assumed to be a command to spawn
985 to handle the error log.</p>
987 <example><title>Example</title>
988 ErrorLog "|/usr/local/bin/httpd_errors"
991 <p>Using <code>syslog</code> instead of a filename enables logging
992 via syslogd(8) if the system supports it. The default is to use
993 syslog facility <code>local7</code>, but you can override this by
994 using the <code>syslog:<var>facility</var></code> syntax where
995 <var>facility</var> can be one of the names usually documented in
998 <example><title>Example</title>
1002 <p>SECURITY: See the <a
1003 href="../misc/security_tips.html#serverroot">security tips</a>
1004 document for details on why your security could be compromised
1005 if the directory where log files are stored is writable by
1006 anyone other than the user that starts the server.</p>
1007 <note type="warning"><title>Note</title>
1008 <p>When entering a file path on non-Unix platforms, care should be taken
1009 to make sure that only forward slashed are used even though the platform
1010 may allow the use of back slashes. In general it is a good idea to always
1011 use forward slashes throughout the configuration files.</p>
1014 <seealso><directive module="core">LogLevel</directive></seealso>
1015 <seealso><a href="../logs.html">Apache Log Files</a></seealso>
1016 </directivesynopsis>
1019 <name>FileETag</name>
1020 <description>File attributes used to create the ETag
1021 HTTP response header</description>
1022 <syntax>FileETag <var>component</var> ...</syntax>
1023 <default>FileETag INode MTime Size</default>
1024 <contextlist><context>server config</context><context>virtual host</context>
1025 <context>directory</context><context>.htaccess</context>
1027 <override>FileInfo</override>
1031 The <directive>FileETag</directive> directive configures the file
1032 attributes that are used to create the <code>ETag</code> (entity
1033 tag) response header field when the document is based on a file.
1034 (The <code>ETag</code> value is used in cache management to save
1035 network bandwidth.) In Apache 1.3.22 and earlier, the
1036 <code>ETag</code> value was <em>always</em> formed
1037 from the file's inode, size, and last-modified time (mtime). The
1038 <directive>FileETag</directive> directive allows you to choose
1039 which of these -- if any -- should be used. The recognized keywords are:
1043 <dt><strong>INode</strong></dt>
1044 <dd>The file's i-node number will be included in the calculation</dd>
1045 <dt><strong>MTime</strong></dt>
1046 <dd>The date and time the file was last modified will be included</dd>
1047 <dt><strong>Size</strong></dt>
1048 <dd>The number of bytes in the file will be included</dd>
1049 <dt><strong>All</strong></dt>
1050 <dd>All available fields will be used. This is equivalent to:
1051 <example>FileETag INode MTime Size</example></dd>
1052 <dt><strong>None</strong></dt>
1053 <dd>If a document is file-based, no <code>ETag</code> field will be
1054 included in the response</dd>
1057 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1058 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1059 which allow changes to be made to the default setting inherited
1060 from a broader scope. Any keyword appearing without such a prefix
1061 immediately and completely cancels the inherited setting.</p>
1063 <p>If a directory's configuration includes
1064 <code>FileETag INode MTime Size</code>, and a
1065 subdirectory's includes <code>FileETag -INode</code>,
1066 the setting for that subdirectory (which will be inherited by
1067 any sub-subdirectories that don't override it) will be equivalent to
1068 <code>FileETag MTime Size</code>.</p>
1070 </directivesynopsis>
1072 <directivesynopsis type="section">
1074 <description>Contains directives that apply to matched
1075 filenames</description>
1076 <syntax><Files <var>filename</var>> ... </Files></syntax>
1077 <contextlist><context>server config</context><context>virtual host</context>
1078 <context>directory</context><context>.htaccess</context>
1080 <override>All</override>
1083 <p>The <directive type="section">Files</directive> directive
1084 limits the scope of the enclosed directives by filename. It is comparable
1085 to the <directive module="core" type="section">Directory</directive>
1086 and <directive module="core" type="section">Location</directive>
1087 directives. It should be matched with a <code></Files></code>
1088 directive. The directives given within this section will be applied to
1089 any object with a basename (last component of filename) matching the
1090 specified filename. <directive type="section">Files</directive>
1091 sections are processed in the order they appear in the
1092 configuration file, after the <directive module="core"
1093 type="section">Directory</directive> sections and
1094 <code>.htaccess</code> files are read, but before <directive
1095 type="section" module="core">Location</directive> sections. Note
1096 that <directive type="section">Files</directive> can be nested
1097 inside <directive type="section"
1098 module="core">Directory</directive> sections to restrict the
1099 portion of the filesystem they apply to.</p>
1101 <p>The <var>filename</var> argument should include a filename, or
1102 a wild-card string, where <code>?</code> matches any single character,
1103 and <code>*</code> matches any sequences of characters. Extended regular
1104 expressions can also be used, with the addition of the
1105 <code>~</code> character. For example:</p>
1108 <Files ~ "\.(gif|jpe?g|png)$">
1111 <p>would match most common Internet graphics formats. <directive
1112 module="core" type="section">FilesMatch</directive> is preferred,
1115 <p>Note that unlike <directive type="section"
1116 module="core">Directory</directive> and <directive type="section"
1117 module="core">Location</directive> sections, <directive
1118 type="section">Files</directive> sections can be used inside
1119 <code>.htaccess</code> files. This allows users to control access to
1120 their own files, at a file-by-file level.</p>
1123 <seealso><a href="../sections.html">How <Directory>, <Location>
1124 and <Files> sections work</a> for an explanation of how these
1125 different sections are combined when a request is received</seealso>
1126 </directivesynopsis>
1128 <directivesynopsis type="section">
1129 <name>FilesMatch</name>
1130 <description>Contains directives that apply to regular-expression matched
1131 filenames</description>
1132 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1133 <contextlist><context>server config</context><context>virtual host</context>
1134 <context>directory</context><context>.htaccess</context>
1136 <override>All</override>
1139 <p>The <directive type="section">FilesMatch</directive> directive
1140 limits the scope of the enclosed directives by filename, just as the
1141 <directive module="core" type="section">Files</directive> directive
1142 does. However, it accepts a regular expression. For example:</p>
1145 <FilesMatch "\.(gif|jpe?g|png)$">
1148 <p>would match most common Internet graphics formats.</p>
1151 <seealso><a href="../sections.html">How <Directory>, <Location>
1152 and <Files> sections work</a> for an explanation of how these
1153 different sections are combined when a request is received</seealso>
1154 </directivesynopsis>
1157 <name>ForceType</name>
1158 <description>Forces all matching files to be served with the specified
1159 MIME content-type</description>
1160 <syntax>ForceType <var>MIME-type</var>|None</syntax>
1161 <contextlist><context>directory</context><context>.htaccess</context>
1163 <override>FileInfo</override>
1164 <compatibility>Moved to the core in Apache 2.0</compatibility>
1167 <p>When placed into an <code>.htaccess</code> file or a
1168 <directive type="section" module="core">Directory</directive>, or
1169 <directive type="section" module="core">Location</directive> or
1170 <directive type="section" module="core">Files</directive>
1171 section, this directive forces all matching files to be served
1172 with the content type identification given by
1173 <var>MIME-type</var>. For example, if you had a directory full of
1174 GIF files, but did not want to label them all with <code>.gif</code>,
1175 you might want to use:</p>
1181 <p>Note that unlike <directive module="core">DefaultType</directive>,
1182 this directive overrides all mime-type associations, including
1183 filename extensions, that might identify the media type.</p>
1185 <p>You can override any <directive>ForceType</directive> setting
1186 by using the value of <code>None</code>:</p>
1189 # force all files to be image/gif:<br />
1190 <Location /images><br />
1192 ForceType image/gif<br />
1194 </Location><br />
1196 # but normal mime-type associations here:<br />
1197 <Location /images/mixed><br />
1199 ForceType None<br />
1204 </directivesynopsis>
1207 <name>HostnameLookups</name>
1208 <description>Enables DNS lookups on client IP addresses</description>
1209 <syntax>HostnameLookups On|Off|Double</syntax>
1210 <default>HostnameLookups Off</default>
1211 <contextlist><context>server config</context><context>virtual host</context>
1212 <context>directory</context></contextlist>
1215 <p>This directive enables DNS lookups so that host names can be
1216 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1217 The value <code>Double</code> refers to doing double-reverse
1218 DNS lookup. That is, after a reverse lookup is performed, a forward
1219 lookup is then performed on that result. At least one of the IP
1220 addresses in the forward lookup must match the original
1221 address. (In "tcpwrappers" terminology this is called
1222 <code>PARANOID</code>.)</p>
1224 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1225 used for controlling access by hostname, a double reverse lookup
1226 will be performed. This is necessary for security. Note that the
1227 result of this double-reverse isn't generally available unless you
1228 set <code>HostnameLookups Double</code>. For example, if only
1229 <code>HostnameLookups On</code> and a request is made to an object
1230 that is protected by hostname restrictions, regardless of whether
1231 the double-reverse fails or not, CGIs will still be passed the
1232 single-reverse result in <code>REMOTE_HOST</code>.</p>
1234 <p>The default is <code>Off</code> in order to save the network
1235 traffic for those sites that don't truly need the reverse
1236 lookups done. It is also better for the end users because they
1237 don't have to suffer the extra latency that a lookup entails.
1238 Heavily loaded sites should leave this directive
1239 <code>Off</code>, since DNS lookups can take considerable
1240 amounts of time. The utility <program>logresolve</program>, compiled by
1241 default to the <code>bin</code> subdirectory of your installation
1242 directory, can be used to look up host names from logged IP addresses
1245 </directivesynopsis>
1247 <directivesynopsis type="section">
1248 <name>IfDefine</name>
1249 <description>Encloses directives that will be processed only
1250 if a test is true at startup</description>
1251 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1252 </IfDefine></syntax>
1253 <contextlist><context>server config</context><context>virtual host</context>
1254 <context>directory</context><context>.htaccess</context>
1256 <override>All</override>
1259 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1260 </code> section is used to mark directives that are conditional. The
1261 directives within an <directive type="section">IfDefine</directive>
1262 section are only processed if the <var>test</var> is true. If <var>
1263 test</var> is false, everything between the start and end markers is
1266 <p>The <var>test</var> in the <directive type="section"
1267 >IfDefine</directive> section directive can be one of two forms:</p>
1270 <li><var>parameter-name</var></li>
1272 <li><code>!</code><var>parameter-name</var></li>
1275 <p>In the former case, the directives between the start and end
1276 markers are only processed if the parameter named
1277 <var>parameter-name</var> is defined. The second format reverses
1278 the test, and only processes the directives if
1279 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1281 <p>The <var>parameter-name</var> argument is a define as given on
1282 the <program>httpd</program> command line via <code>-D<var>parameter-</var>
1283 </code>, at the time the server was started.</p>
1285 <p><directive type="section">IfDefine</directive> sections are
1286 nest-able, which can be used to implement simple
1287 multiple-parameter tests. Example:</p>
1290 httpd -DReverseProxy ...<br />
1293 <IfDefine ReverseProxy><br />
1295 LoadModule rewrite_module modules/mod_rewrite.so<br />
1296 LoadModule proxy_module modules/libproxy.so<br />
1301 </directivesynopsis>
1303 <directivesynopsis type="section">
1304 <name>IfModule</name>
1305 <description>Encloses directives that are processed conditional on the
1306 presence or absence of a specific module</description>
1307 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1308 </IfModule></syntax>
1309 <contextlist><context>server config</context><context>virtual host</context>
1310 <context>directory</context><context>.htaccess</context>
1312 <override>All</override>
1313 <compatibility>Module identifiers are available in version 2.1 and
1314 later.</compatibility>
1317 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1318 section is used to mark directives that are conditional on the presence of
1319 a specific module. The directives within an <directive type="section"
1320 >IfModule</directive> section are only processed if the <var>test</var>
1321 is true. If <var>test</var> is false, everything between the start and
1322 end markers is ignored.</p>
1324 <p>The <var>test</var> in the <directive type="section"
1325 >IfModule</directive> section directive can be one of two forms:</p>
1328 <li><var>module</var></li>
1330 <li>!<var>module</var></li>
1333 <p>In the former case, the directives between the start and end
1334 markers are only processed if the module named <var>module</var>
1335 is included in Apache -- either compiled in or
1336 dynamically loaded using <directive module="mod_so"
1337 >LoadModule</directive>. The second format reverses the test,
1338 and only processes the directives if <var>module</var> is
1339 <strong>not</strong> included.</p>
1341 <p>The <var>module</var> argument can be either the module identifier or
1342 the file name of the module, at the time it was compiled. For example,
1343 <code>rewrite_module</code> is the identifier and
1344 <code>mod_rewrite.c</code> is the file name. If a module consists of
1345 several source files, use the name of the file containing the string
1346 <code>STANDARD20_MODULE_STUFF</code>.</p>
1348 <p><directive type="section">IfModule</directive> sections are
1349 nest-able, which can be used to implement simple multiple-module
1352 <note>This section should only be used if you need to have one
1353 configuration file that works whether or not a specific module
1354 is available. In normal operation, directives need not be
1355 placed in <directive type="section">IfModule</directive>
1358 </directivesynopsis>
1361 <name>Include</name>
1362 <description>Includes other configuration files from within
1363 the server configuration files</description>
1364 <syntax>Include <var>file-path</var>|<var>directory-path</var></syntax>
1365 <contextlist><context>server config</context><context>virtual host</context>
1366 <context>directory</context>
1368 <compatibility>Wildcard matching available in 2.0.41 and later</compatibility>
1371 <p>This directive allows inclusion of other configuration files
1372 from within the server configuration files.</p>
1374 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1375 include several files at once, in alphabetical order. In
1376 addition, if <directive>Include</directive> points to a directory,
1377 rather than a file, Apache will read all files in that directory
1378 and any subdirectory. But including entire directories is not
1379 recommended, because it is easy to accidentally leave temporary
1380 files in a directory that can cause <program>httpd</program> to
1383 <p>The file path specified may be an absolute path, or may be relative
1384 to the <directive module="core">ServerRoot</directive> directory.</p>
1389 Include /usr/local/apache2/conf/ssl.conf<br />
1390 Include /usr/local/apache2/conf/vhosts/*.conf
1393 <p>Or, providing paths relative to your <directive
1394 module="core">ServerRoot</directive> directory:</p>
1397 Include conf/ssl.conf<br />
1398 Include conf/vhosts/*.conf
1401 <p>Running <code>apachectl configtest</code> will give you a list
1402 of the files that are being processed during the configuration
1406 root@host# apachectl configtest<br />
1407 Processing config file: /usr/local/apache2/conf/ssl.conf<br />
1408 Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf<br />
1409 Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf<br />
1414 <seealso><program>apachectl</program></seealso>
1415 </directivesynopsis>
1418 <name>KeepAlive</name>
1419 <description>Enables HTTP persistent connections</description>
1420 <syntax>KeepAlive On|Off</syntax>
1421 <default>KeepAlive On</default>
1422 <contextlist><context>server config</context><context>virtual host</context>
1426 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1427 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1428 which allow multiple requests to be sent over the same TCP
1429 connection. In some cases this has been shown to result in an
1430 almost 50% speedup in latency times for HTML documents with
1431 many images. To enable Keep-Alive connections, set
1432 <code>KeepAlive On</code>.</p>
1434 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1435 used if they are specifically requested by a client. In
1436 addition, a Keep-Alive connection with an HTTP/1.0 client can
1437 only be used when the length of the content is known in
1438 advance. This implies that dynamic content such as CGI output,
1439 SSI pages, and server-generated directory listings will
1440 generally not use Keep-Alive connections to HTTP/1.0 clients.
1441 For HTTP/1.1 clients, persistent connections are the default
1442 unless otherwise specified. If the client requests it, chunked
1443 encoding will be used in order to send content of unknown
1444 length over persistent connections.</p>
1447 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1448 </directivesynopsis>
1451 <name>KeepAliveTimeout</name>
1452 <description>Amount of time the server will wait for subsequent
1453 requests on a persistent connection</description>
1454 <syntax>KeepAliveTimeout <var>seconds</var></syntax>
1455 <default>KeepAliveTimeout 15</default>
1456 <contextlist><context>server config</context><context>virtual host</context>
1460 <p>The number of seconds Apache will wait for a subsequent
1461 request before closing the connection. Once a request has been
1462 received, the timeout value specified by the
1463 <directive module="core">Timeout</directive> directive applies.</p>
1465 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1466 may cause performance problems in heavily loaded servers. The
1467 higher the timeout, the more server processes will be kept
1468 occupied waiting on connections with idle clients.</p>
1470 </directivesynopsis>
1472 <directivesynopsis type="section">
1474 <description>Restrict enclosed access controls to only certain HTTP
1475 methods</description>
1476 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1477 </Limit></syntax>
1478 <contextlist><context>server config</context><context>virtual host</context>
1479 <context>directory</context><context>.htaccess</context>
1481 <override>All</override>
1484 <p>Access controls are normally effective for
1485 <strong>all</strong> access methods, and this is the usual
1486 desired behavior. <strong>In the general case, access control
1487 directives should not be placed within a
1488 <directive type="section">Limit</directive> section.</strong></p>
1490 <p>The purpose of the <directive type="section">Limit</directive>
1491 directive is to restrict the effect of the access controls to the
1492 nominated HTTP methods. For all other methods, the access
1493 restrictions that are enclosed in the <directive
1494 type="section">Limit</directive> bracket <strong>will have no
1495 effect</strong>. The following example applies the access control
1496 only to the methods <code>POST</code>, <code>PUT</code>, and
1497 <code>DELETE</code>, leaving all other methods unprotected:</p>
1500 <Limit POST PUT DELETE><br />
1502 Require valid-user<br />
1507 <p>The method names listed can be one or more of: <code>GET</code>,
1508 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1509 <code>CONNECT</code>, <code>OPTIONS</code>,
1510 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1511 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1512 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1513 case-sensitive.</strong> If <code>GET</code> is used it will also
1514 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1515 cannot be limited.</p>
1517 <note type="warning">A <directive type="section"
1518 module="core">LimitExcept</directive> section should always be
1519 used in preference to a <directive type="section"
1520 module="core">Limit</directive> section when restricting access,
1521 since a <directive type="section"
1522 module="core">LimitExcept</directive> section provides protection
1523 against arbitrary methods.</note>
1526 </directivesynopsis>
1528 <directivesynopsis type="section">
1529 <name>LimitExcept</name>
1530 <description>Restrict access controls to all HTTP methods
1531 except the named ones</description>
1532 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1533 </LimitExcept></syntax>
1534 <contextlist><context>server config</context><context>virtual host</context>
1535 <context>directory</context><context>.htaccess</context>
1537 <override>All</override>
1540 <p><directive type="section">LimitExcept</directive> and
1541 <code></LimitExcept></code> are used to enclose
1542 a group of access control directives which will then apply to any
1543 HTTP access method <strong>not</strong> listed in the arguments;
1544 i.e., it is the opposite of a <directive type="section"
1545 module="core">Limit</directive> section and can be used to control
1546 both standard and nonstandard/unrecognized methods. See the
1547 documentation for <directive module="core"
1548 type="section">Limit</directive> for more details.</p>
1553 <LimitExcept POST GET><br />
1555 Require valid-user<br />
1557 </LimitExcept>
1561 </directivesynopsis>
1564 <name>LimitInternalRecursion</name>
1565 <description>Determine maximum number of internal redirects and nested
1566 subrequests</description>
1567 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
1568 <default>LimitInternalRecursion 10</default>
1569 <contextlist><context>server config</context><context>virtual host</context>
1571 <compatibility>Available in Apache 2.0.47 and later</compatibility>
1574 <p>An internal redirect happens, for example, when using the <directive
1575 module="mod_actions">Action</directive> directive, which internally
1576 redirects the original request to a CGI script. A subrequest is Apache's
1577 mechanism to find out what would happen for some URI if it were requested.
1578 For example, <module>mod_dir</module> uses subrequests to look for the
1579 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
1582 <p><directive>LimitInternalRecursion</directive> prevents the server
1583 from crashing when entering an infinite loop of internal redirects or
1584 subrequests. Such loops are usually caused by misconfigurations.</p>
1586 <p>The directive stores two different limits, which are evaluated on
1587 per-request basis. The first <var>number</var> is the maximum number of
1588 internal redirects, that may follow each other. The second <var>number</var>
1589 determines, how deep subrequests may be nested. If you specify only one
1590 <var>number</var>, it will be assigned to both limits.</p>
1592 <example><title>Example</title>
1593 LimitInternalRecursion 5
1596 </directivesynopsis>
1599 <name>LimitRequestBody</name>
1600 <description>Restricts the total size of the HTTP request body sent
1601 from the client</description>
1602 <syntax>LimitRequestBody <var>bytes</var></syntax>
1603 <default>LimitRequestBody 0</default>
1604 <contextlist><context>server config</context><context>virtual host</context>
1605 <context>directory</context><context>.htaccess</context>
1607 <override>All</override>
1610 <p>This directive specifies the number of <var>bytes</var> from 0
1611 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1614 <p>The <directive>LimitRequestBody</directive> directive allows
1615 the user to set a limit on the allowed size of an HTTP request
1616 message body within the context in which the directive is given
1617 (server, per-directory, per-file or per-location). If the client
1618 request exceeds that limit, the server will return an error
1619 response instead of servicing the request. The size of a normal
1620 request message body will vary greatly depending on the nature of
1621 the resource and the methods allowed on that resource. CGI scripts
1622 typically use the message body for retrieving form information.
1623 Implementations of the <code>PUT</code> method will require
1624 a value at least as large as any representation that the server
1625 wishes to accept for that resource.</p>
1627 <p>This directive gives the server administrator greater
1628 control over abnormal client request behavior, which may be
1629 useful for avoiding some forms of denial-of-service
1632 <p>If, for example, you are permitting file upload to a particular
1633 location, and wish to limit the size of the uploaded file to 100K,
1634 you might use the following directive:</p>
1637 LimitRequestBody 102400
1641 </directivesynopsis>
1644 <name>LimitRequestFields</name>
1645 <description>Limits the number of HTTP request header fields that
1646 will be accepted from the client</description>
1647 <syntax>LimitRequestFields <var>number</var></syntax>
1648 <default>LimitRequestFields 100</default>
1649 <contextlist><context>server config</context></contextlist>
1652 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1653 32767. The default value is defined by the compile-time
1654 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1657 <p>The <directive>LimitRequestFields</directive> directive allows
1658 the server administrator to modify the limit on the number of
1659 request header fields allowed in an HTTP request. A server needs
1660 this value to be larger than the number of fields that a normal
1661 client request might include. The number of request header fields
1662 used by a client rarely exceeds 20, but this may vary among
1663 different client implementations, often depending upon the extent
1664 to which a user has configured their browser to support detailed
1665 content negotiation. Optional HTTP extensions are often expressed
1666 using request header fields.</p>
1668 <p>This directive gives the server administrator greater
1669 control over abnormal client request behavior, which may be
1670 useful for avoiding some forms of denial-of-service attacks.
1671 The value should be increased if normal clients see an error
1672 response from the server that indicates too many fields were
1673 sent in the request.</p>
1678 LimitRequestFields 50
1682 </directivesynopsis>
1685 <name>LimitRequestFieldSize</name>
1686 <description>Limits the size of the HTTP request header allowed from the
1687 client</description>
1688 <syntax>LimitRequestFieldsize <var>bytes</var></syntax>
1689 <default>LimitRequestFieldsize 8190</default>
1690 <contextlist><context>server config</context></contextlist>
1693 <p>This directive specifies the number of <var>bytes</var> from 0
1694 to the value of the compile-time constant
1695 <code>DEFAULT_LIMIT_REQUEST_FIELDSIZE</code> (8190 as
1696 distributed) that will be allowed in an HTTP request
1699 <p>The <directive>LimitRequestFieldSize</directive> directive
1700 allows the server administrator to reduce the limit on the allowed
1701 size of an HTTP request header field below the normal input buffer
1702 size compiled with the server. A server needs this value to be
1703 large enough to hold any one header field from a normal client
1704 request. The size of a normal request header field will vary
1705 greatly among different client implementations, often depending
1706 upon the extent to which a user has configured their browser to
1707 support detailed content negotiation.</p>
1709 <p>This directive gives the server administrator greater
1710 control over abnormal client request behavior, which may be
1711 useful for avoiding some forms of denial-of-service attacks.</p>
1716 LimitRequestFieldSize 4094
1719 <note>Under normal conditions, the value should not be changed from
1723 </directivesynopsis>
1726 <name>LimitRequestLine</name>
1727 <description>Limit the size of the HTTP request line that will be accepted
1728 from the client</description>
1729 <syntax>LimitRequestLine <var>bytes</var></syntax>
1730 <default>LimitRequestLine 8190</default>
1731 <contextlist><context>server config</context></contextlist>
1734 <p>This directive sets the number of <var>bytes</var> from 0 to
1735 the value of the compile-time constant
1736 <code>DEFAULT_LIMIT_REQUEST_LINE</code> (8190 as distributed)
1737 that will be allowed on the HTTP request-line.</p>
1739 <p>The <directive>LimitRequestLine</directive> directive allows
1740 the server administrator to reduce the limit on the allowed size
1741 of a client's HTTP request-line below the normal input buffer size
1742 compiled with the server. Since the request-line consists of the
1743 HTTP method, URI, and protocol version, the
1744 <directive>LimitRequestLine</directive> directive places a
1745 restriction on the length of a request-URI allowed for a request
1746 on the server. A server needs this value to be large enough to
1747 hold any of its resource names, including any information that
1748 might be passed in the query part of a <code>GET</code> request.</p>
1750 <p>This directive gives the server administrator greater
1751 control over abnormal client request behavior, which may be
1752 useful for avoiding some forms of denial-of-service attacks.</p>
1757 LimitRequestLine 4094
1760 <note>Under normal conditions, the value should not be changed from
1763 </directivesynopsis>
1766 <name>LimitXMLRequestBody</name>
1767 <description>Limits the size of an XML-based request body</description>
1768 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
1769 <default>LimitXMLRequestBody 1000000</default>
1770 <contextlist><context>server config</context><context>virtual host</context>
1771 <context>directory</context><context>.htaccess</context></contextlist>
1772 <override>All</override>
1775 <p>Limit (in bytes) on maximum size of an XML-based request
1776 body. A value of <code>0</code> will disable any checking.</p>
1781 LimitXMLRequestBody 0
1785 </directivesynopsis>
1787 <directivesynopsis type="section">
1788 <name>Location</name>
1789 <description>Applies the enclosed directives only to matching
1791 <syntax><Location
1792 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
1793 <contextlist><context>server config</context><context>virtual host</context>
1797 <p>The <directive type="section">Location</directive> directive
1798 limits the scope of the enclosed directives by URL. It is similar to the
1799 <directive type="section" module="core">Directory</directive>
1800 directive, and starts a subsection which is terminated with a
1801 <code></Location></code> directive. <directive
1802 type="section">Location</directive> sections are processed in the
1803 order they appear in the configuration file, after the <directive
1804 type="section" module="core">Directory</directive> sections and
1805 <code>.htaccess</code> files are read, and after the <directive
1806 type="section" module="core">Files</directive> sections.</p>
1808 <p><directive type="section">Location</directive> sections operate
1809 completely outside the filesystem. This has several consequences.
1810 Most importantly, <directive type="section">Location</directive>
1811 directives should not be used to control access to filesystem
1812 locations. Since several different URLs may map to the same
1813 filesystem location, such access controls may by circumvented.</p>
1815 <note><title>When to use <directive
1816 type="section">Location</directive></title>
1818 <p>Use <directive type="section">Location</directive> to apply
1819 directives to content that lives outside the filesystem. For
1820 content that lives in the filesystem, use <directive
1821 type="section" module="core">Directory</directive> and <directive
1822 type="section" module="core">Files</directive>. An exception is
1823 <code><Location /></code>, which is an easy way to
1824 apply a configuration to the entire server.</p>
1827 <p>For all origin (non-proxy) requests, the URL to be matched is a
1828 URL-path of the form <code>/path/</code>. No scheme, hostname,
1829 port, or query string may be included. For proxy requests, the
1830 URL to be matched is of the form
1831 <code>scheme://servername/path</code>, and you must include the
1834 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1835 any single character, and <code>*</code> matches any sequences of
1839 expressions can also be used, with the addition of the
1840 <code>~</code> character. For example:</p>
1843 <Location ~ "/(extra|special)/data">
1846 <p>would match URLs that contained the substring <code>/extra/data</code>
1847 or <code>/special/data</code>. The directive <directive
1848 type="section" module="core">LocationMatch</directive> behaves
1849 identical to the regex version of <directive
1850 type="section">Location</directive>.</p>
1852 <p>The <directive type="section">Location</directive>
1853 functionality is especially useful when combined with the
1854 <directive module="core">SetHandler</directive>
1855 directive. For example, to enable status requests, but allow them
1856 only from browsers at <code>foo.com</code>, you might use:</p>
1859 <Location /status><br />
1861 SetHandler server-status<br />
1862 Order Deny,Allow<br />
1864 Allow from .foo.com<br />
1869 <note><title>Note about / (slash)</title>
1870 <p>The slash character has special meaning depending on where in a
1871 URL it appears. People may be used to its behavior in the filesystem
1872 where multiple adjacent slashes are frequently collapsed to a single
1873 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
1874 <code>/home/foo</code>). In URL-space this is not necessarily true.
1875 The <directive type="section" module="core">LocationMatch</directive>
1876 directive and the regex version of <directive type="section"
1877 >Location</directive> require you to explicitly specify multiple
1878 slashes if that is your intention.</p>
1880 <p>For example, <code><LocationMatch ^/abc></code> would match
1881 the request URL <code>/abc</code> but not the request URL <code>
1882 //abc</code>. The (non-regex) <directive type="section"
1883 >Location</directive> directive behaves similarly when used for
1884 proxy requests. But when (non-regex) <directive type="section"
1885 >Location</directive> is used for non-proxy requests it will
1886 implicitly match multiple slashes with a single slash. For example,
1887 if you specify <code><Location /abc/def></code> and the
1888 request is to <code>/abc//def</code> then it will match.</p>
1891 <seealso><a href="../sections.html">How <Directory>, <Location>
1892 and <Files> sections work</a> for an explanation of how these
1893 different sections are combined when a request is received</seealso>
1894 </directivesynopsis>
1896 <directivesynopsis type="section">
1897 <name>LocationMatch</name>
1898 <description>Applies the enclosed directives only to regular-expression
1899 matching URLs</description>
1900 <syntax><LocationMatch
1901 <var>regex</var>> ... </LocationMatch></syntax>
1902 <contextlist><context>server config</context><context>virtual host</context>
1906 <p>The <directive type="section">LocationMatch</directive> directive
1907 limits the scope of the enclosed directives by URL, in an identical manner
1908 to <directive module="core" type="section">Location</directive>. However,
1909 it takes a regular expression as an argument instead of a simple
1910 string. For example:</p>
1913 <LocationMatch "/(extra|special)/data">
1916 <p>would match URLs that contained the substring <code>/extra/data</code>
1917 or <code>/special/data</code>.</p>
1920 <seealso><a href="../sections.html">How <Directory>, <Location>
1921 and <Files> sections work</a> for an explanation of how these
1922 different sections are combined when a request is received</seealso>
1923 </directivesynopsis>
1926 <name>LogLevel</name>
1927 <description>Controls the verbosity of the ErrorLog</description>
1928 <syntax>LogLevel <var>level</var></syntax>
1929 <default>LogLevel warn</default>
1930 <contextlist><context>server config</context><context>virtual host</context>
1934 <p><directive>LogLevel</directive> adjusts the verbosity of the
1935 messages recorded in the error logs (see <directive
1936 module="core">ErrorLog</directive> directive). The following
1937 <var>level</var>s are available, in order of decreasing
1941 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
1944 <th><strong>Level</strong> </th>
1946 <th><strong>Description</strong> </th>
1948 <th><strong>Example</strong> </th>
1952 <td><code>emerg</code> </td>
1954 <td>Emergencies - system is unusable.</td>
1956 <td>"Child cannot open lock file. Exiting"</td>
1960 <td><code>alert</code> </td>
1962 <td>Action must be taken immediately.</td>
1964 <td>"getpwuid: couldn't determine user name from uid"</td>
1968 <td><code>crit</code> </td>
1970 <td>Critical Conditions.</td>
1972 <td>"socket: Failed to get a socket, exiting child"</td>
1976 <td><code>error</code> </td>
1978 <td>Error conditions.</td>
1980 <td>"Premature end of script headers"</td>
1984 <td><code>warn</code> </td>
1986 <td>Warning conditions.</td>
1988 <td>"child process 1234 did not exit, sending another
1993 <td><code>notice</code> </td>
1995 <td>Normal but significant condition.</td>
1997 <td>"httpd: caught SIGBUS, attempting to dump core in
2002 <td><code>info</code> </td>
2004 <td>Informational.</td>
2006 <td>"Server seems busy, (you may need to increase
2007 StartServers, or Min/MaxSpareServers)..."</td>
2011 <td><code>debug</code> </td>
2013 <td>Debug-level messages</td>
2015 <td>"Opening config file ..."</td>
2019 <p>When a particular level is specified, messages from all
2020 other levels of higher significance will be reported as well.
2021 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2022 then messages with log levels of <code>notice</code> and
2023 <code>warn</code> will also be posted.</p>
2025 <p>Using a level of at least <code>crit</code> is
2034 <note><title>Note</title>
2035 <p>When logging to a regular file messages of the level
2036 <code>notice</code> cannot be suppressed and thus are always
2037 logged. However, this doesn't apply when logging is done
2038 using <code>syslog</code>.</p>
2041 </directivesynopsis>
2044 <name>MaxKeepAliveRequests</name>
2045 <description>Number of requests allowed on a persistent
2046 connection</description>
2047 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2048 <default>MaxKeepAliveRequests 100</default>
2049 <contextlist><context>server config</context><context>virtual host</context>
2053 <p>The <directive>MaxKeepAliveRequests</directive> directive
2054 limits the number of requests allowed per connection when
2055 <directive module="core" >KeepAlive</directive> is on. If it is
2056 set to <code>0</code>, unlimited requests will be allowed. We
2057 recommend that this setting be kept to a high value for maximum
2058 server performance.</p>
2063 MaxKeepAliveRequests 500
2066 </directivesynopsis>
2069 <name>NameVirtualHost</name>
2070 <description>Designates an IP address for name-virtual
2071 hosting</description>
2072 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2073 <contextlist><context>server config</context></contextlist>
2076 <p>The <directive>NameVirtualHost</directive> directive is a
2077 required directive if you want to configure <a
2078 href="../vhosts/">name-based virtual hosts</a>.</p>
2080 <p>Although <var>addr</var> can be hostname it is recommended
2081 that you always use an IP address, e.g.</p>
2084 NameVirtualHost 111.22.33.44
2087 <p>With the <directive>NameVirtualHost</directive> directive you
2088 specify the IP address on which the server will receive requests
2089 for the name-based virtual hosts. This will usually be the address
2090 to which your name-based virtual host names resolve. In cases
2091 where a firewall or other proxy receives the requests and forwards
2092 them on a different IP address to the server, you must specify the
2093 IP address of the physical interface on the machine which will be
2094 servicing the requests. If you have multiple name-based hosts on
2095 multiple addresses, repeat the directive for each address.</p>
2097 <note><title>Note</title>
2098 <p>Note, that the "main server" and any <code>_default_</code> servers
2099 will <strong>never</strong> be served for a request to a
2100 <directive>NameVirtualHost</directive> IP address (unless for some
2101 reason you specify <directive>NameVirtualHost</directive> but then
2102 don't define any <directive>VirtualHost</directive>s for that
2106 <p>Optionally you can specify a port number on which the
2107 name-based virtual hosts should be used, e.g.</p>
2110 NameVirtualHost 111.22.33.44:8080
2113 <p>IPv6 addresses must be enclosed in square brackets, as shown
2114 in the following example:</p>
2117 NameVirtualHost [fe80::a00:20ff:fea7:ccea]:8080
2120 <p>To receive requests on all interfaces, you can use an argument of
2127 <note><title>Argument to <directive type="section">VirtualHost</directive>
2129 <p>Note that the argument to the <directive
2130 type="section">VirtualHost</directive> directive must
2131 exactly match the argument to the <directive
2132 >NameVirtualHost</directive> directive.</p>
2135 NameVirtualHost 1.2.3.4<br />
2136 <VirtualHost 1.2.3.4><br />
2138 </VirtualHost><br />
2143 <seealso><a href="../vhosts/">Virtual Hosts
2144 documentation</a></seealso>
2146 </directivesynopsis>
2149 <name>Options</name>
2150 <description>Configures what features are available in a particular
2151 directory</description>
2153 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2154 <default>Options All</default>
2155 <contextlist><context>server config</context><context>virtual host</context>
2156 <context>directory</context><context>.htaccess</context>
2158 <override>Options</override>
2161 <p>The <directive>Options</directive> directive controls which
2162 server features are available in a particular directory.</p>
2164 <p><var>option</var> can be set to <code>None</code>, in which
2165 case none of the extra features are enabled, or one or more of
2169 <dt><code>All</code></dt>
2171 <dd>All options except for <code>MultiViews</code>. This is the default
2174 <dt><code>ExecCGI</code></dt>
2177 Execution of CGI scripts using <module>mod_cgi</module>
2180 <dt><code>FollowSymLinks</code></dt>
2184 The server will follow symbolic links in this directory.
2186 <p>Even though the server follows the symlink it does <em>not</em>
2187 change the pathname used to match against <directive type="section"
2188 module="core">Directory</directive> sections.</p>
2189 <p>Note also, that this option <strong>gets ignored</strong> if set
2190 inside a <directive type="section" module="core">Location</directive>
2194 <dt><code>Includes</code></dt>
2197 Server-side includes provided by <module>mod_include</module>
2200 <dt><code>IncludesNOEXEC</code></dt>
2204 Server-side includes are permitted, but the <code>#exec
2205 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2206 possible to <code>#include virtual</code> CGI scripts from
2207 <directive module="mod_alias">ScriptAlias</directive>ed
2210 <dt><code>Indexes</code></dt>
2213 If a URL which maps to a directory is requested, and there
2214 is no <directive module="mod_dir">DirectoryIndex</directive>
2215 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2216 <module>mod_autoindex</module> will return a formatted listing
2217 of the directory.</dd>
2219 <dt><code>MultiViews</code></dt>
2222 <a href="../content-negotiation.html">Content negotiated</a>
2223 "MultiViews" are allowed using
2224 <module>mod_negotiation</module>.</dd>
2226 <dt><code>SymLinksIfOwnerMatch</code></dt>
2228 <dd>The server will only follow symbolic links for which the
2229 target file or directory is owned by the same user id as the
2232 <note><title>Note</title> This option gets ignored if
2233 set inside a <directive module="core"
2234 type="section">Location</directive> section.</note>
2238 <p>Normally, if multiple <directive>Options</directive> could
2239 apply to a directory, then the most specific one is used and
2240 others are ignored; the options are not merged. (See <a
2241 href="../sections.html#mergin">how sections are merged</a>.)
2242 However if <em>all</em> the options on the
2243 <directive>Options</directive> directive are preceded by a
2244 <code>+</code> or <code>-</code> symbol, the options are
2245 merged. Any options preceded by a <code>+</code> are added to the
2246 options currently in force, and any options preceded by a
2247 <code>-</code> are removed from the options currently in
2250 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2253 <Directory /web/docs><br />
2255 Options Indexes FollowSymLinks<br />
2257 </Directory><br />
2259 <Directory /web/docs/spec><br />
2261 Options Includes<br />
2266 <p>then only <code>Includes</code> will be set for the
2267 <code>/web/docs/spec</code> directory. However if the second
2268 <directive>Options</directive> directive uses the <code>+</code> and
2269 <code>-</code> symbols:</p>
2272 <Directory /web/docs><br />
2274 Options Indexes FollowSymLinks<br />
2276 </Directory><br />
2278 <Directory /web/docs/spec><br />
2280 Options +Includes -Indexes<br />
2285 <p>then the options <code>FollowSymLinks</code> and
2286 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2289 <note><title>Note</title>
2290 <p>Using <code>-IncludesNOEXEC</code> or
2291 <code>-Includes</code> disables server-side includes completely
2292 regardless of the previous setting.</p>
2295 <p>The default in the absence of any other settings is
2296 <code>All</code>.</p>
2298 </directivesynopsis>
2301 <name>Require</name>
2302 <description>Selects which authenticated users can access
2303 a resource</description>
2304 <syntax>Require <var>entity-name</var> [<var>entity-name</var>] ...</syntax>
2305 <contextlist><context>directory</context><context>.htaccess</context>
2307 <override>AuthConfig</override>
2310 <p>This directive selects which authenticated users can access
2311 a directory. The allowed syntaxes are:</p>
2314 <dt><code>Require user <var>userid</var> [<var>userid</var>]
2316 <dd>Only the named users can access the resource.</dd>
2318 <dt><code>Require group <var>group-name</var> [<var>group-name</var>]
2320 <dd>Only users in the named groups can access the resource.</dd>
2322 <dt><code>Require valid-user</code></dt>
2323 <dd>All valid users can access the resource.</dd>
2326 <p><directive>Require</directive> must be accompanied by
2327 <directive module="core">AuthName</directive> and <directive
2328 module="core">AuthType</directive> directives, and directives such
2329 as <directive module="mod_authn_file">AuthUserFile</directive>
2330 and <directive module="mod_authz_groupfile">AuthGroupFile</directive> (to
2331 define users and groups) in order to work correctly. Example:</p>
2334 AuthType Basic<br />
2335 AuthName "Restricted Directory"<br />
2336 AuthUserFile /web/users<br />
2337 AuthGroupFile /web/groups<br />
2341 <p>Access controls which are applied in this way are effective for
2342 <strong>all</strong> methods. <strong>This is what is normally
2343 desired.</strong> If you wish to apply access controls only to
2344 specific methods, while leaving other methods unprotected, then
2345 place the <directive>Require</directive> statement into a
2346 <directive module="core" type="section">Limit</directive>
2349 <seealso><directive module="core">Satisfy</directive></seealso>
2350 <seealso><module>mod_authz_host</module></seealso>
2351 </directivesynopsis>
2354 <name>RLimitCPU</name>
2355 <description>Limits the CPU consumption of processes launched
2356 by Apache children</description>
2357 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
2358 <default>Unset; uses operating system defaults</default>
2359 <contextlist><context>server config</context><context>virtual host</context>
2360 <context>directory</context><context>.htaccess</context></contextlist>
2361 <override>All</override>
2364 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2365 resource limit for all processes and the second parameter sets
2366 the maximum resource limit. Either parameter can be a number,
2367 or <code>max</code> to indicate to the server that the limit should
2368 be set to the maximum allowed by the operating system
2369 configuration. Raising the maximum resource limit requires that
2370 the server is running as <code>root</code>, or in the initial startup
2373 <p>This applies to processes forked off from Apache children
2374 servicing requests, not the Apache children themselves. This
2375 includes CGI scripts and SSI exec commands, but not any
2376 processes forked off from the Apache parent such as piped
2379 <p>CPU resource limits are expressed in seconds per
2382 <seealso><directive module="core">RLimitMEM</directive></seealso>
2383 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2384 </directivesynopsis>
2387 <name>RLimitMEM</name>
2388 <description>Limits the memory consumption of processes launched
2389 by Apache children</description>
2390 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
2391 <default>Unset; uses operating system defaults</default>
2392 <contextlist><context>server config</context><context>virtual host</context>
2393 <context>directory</context><context>.htaccess</context></contextlist>
2394 <override>All</override>
2397 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2398 resource limit for all processes and the second parameter sets
2399 the maximum resource limit. Either parameter can be a number,
2400 or <code>max</code> to indicate to the server that the limit should
2401 be set to the maximum allowed by the operating system
2402 configuration. Raising the maximum resource limit requires that
2403 the server is running as <code>root</code>, or in the initial startup
2406 <p>This applies to processes forked off from Apache children
2407 servicing requests, not the Apache children themselves. This
2408 includes CGI scripts and SSI exec commands, but not any
2409 processes forked off from the Apache parent such as piped
2412 <p>Memory resource limits are expressed in bytes per
2415 <seealso><directive module="core">RLimitCPU</directive></seealso>
2416 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2417 </directivesynopsis>
2420 <name>RLimitNPROC</name>
2421 <description>Limits the number of processes that can be launched by
2422 processes launched by Apache children</description>
2423 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
2424 <default>Unset; uses operating system defaults</default>
2425 <contextlist><context>server config</context><context>virtual host</context>
2426 <context>directory</context><context>.htaccess</context></contextlist>
2427 <override>All</override>
2430 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2431 resource limit for all processes and the second parameter sets
2432 the maximum resource limit. Either parameter can be a number,
2433 or <code>max</code> to indicate to the server that the limit
2434 should be set to the maximum allowed by the operating system
2435 configuration. Raising the maximum resource limit requires that
2436 the server is running as <code>root</code>, or in the initial startup
2439 <p>This applies to processes forked off from Apache children
2440 servicing requests, not the Apache children themselves. This
2441 includes CGI scripts and SSI exec commands, but not any
2442 processes forked off from the Apache parent such as piped
2445 <p>Process limits control the number of processes per user.</p>
2447 <note><title>Note</title>
2448 <p>If CGI processes are <strong>not</strong> running
2449 under user ids other than the web server user id, this directive
2450 will limit the number of processes that the server itself can
2451 create. Evidence of this situation will be indicated by
2452 <strong><code>cannot fork</code></strong> messages in the
2453 <code>error_log</code>.</p>
2456 <seealso><directive module="core">RLimitMEM</directive></seealso>
2457 <seealso><directive module="core">RLimitCPU</directive></seealso>
2458 </directivesynopsis>
2461 <name>Satisfy</name>
2462 <description>Interaction between host-level access control and
2463 user authentication</description>
2464 <syntax>Satisfy Any|All</syntax>
2465 <default>Satisfy All</default>
2466 <contextlist><context>directory</context><context>.htaccess</context>
2468 <override>AuthConfig</override>
2469 <compatibility>Influenced by <directive module="core" type="section"
2470 >Limit</directive> and <directive module="core"
2471 type="section">LimitExcept</directive> in version 2.0.51 and
2472 later</compatibility>
2475 <p>Access policy if both <directive
2476 module="mod_authz_host">Allow</directive> and <directive
2477 module="core">Require</directive> used. The parameter can be
2478 either <code>All</code> or <code>Any</code>. This directive is only
2479 useful if access to a particular area is being restricted by both
2480 username/password <em>and</em> client host address. In this case
2481 the default behavior (<code>All</code>) is to require that the client
2482 passes the address access restriction <em>and</em> enters a valid
2483 username and password. With the <code>Any</code> option the client will be
2484 granted access if they either pass the host restriction or enter a
2485 valid username and password. This can be used to password restrict
2486 an area, but to let clients from particular addresses in without
2487 prompting for a password.</p>
2489 <p>For example, if you wanted to let people on your network have
2490 unrestricted access to a portion of your website, but require that
2491 people outside of your network provide a password, you could use a
2492 configuration similar to the following:</p>
2495 Require valid-user<br />
2496 Allow from 192.168.1<br />
2500 <p>Since version 2.0.51 <directive>Satisfy</directive> directives can
2501 be restricted to particular methods by <directive module="core"
2502 type="section">Limit</directive> and <directive module="core" type="section"
2503 >LimitExcept</directive> sections.</p>
2505 <seealso><directive module="mod_authz_host">Allow</directive></seealso>
2506 <seealso><directive module="core">Require</directive></seealso>
2507 </directivesynopsis>
2510 <name>ScriptInterpreterSource</name>
2511 <description>Technique for locating the interpreter for CGI
2512 scripts</description>
2513 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
2514 <default>ScriptInterpreterSource Script</default>
2515 <contextlist><context>server config</context><context>virtual host</context>
2516 <context>directory</context><context>.htaccess</context></contextlist>
2517 <override>FileInfo</override>
2518 <compatibility>Win32 only;
2519 option <code>Registry-Strict</code> is available in Apache 2.0 and
2520 later</compatibility>
2523 <p>This directive is used to control how Apache finds the
2524 interpreter used to run CGI scripts. The default setting is
2525 <code>Script</code>. This causes Apache to use the interpreter pointed to
2526 by the shebang line (first line, starting with <code>#!</code>) in the
2527 script. On Win32 systems this line usually looks like:</p>
2530 #!C:/Perl/bin/perl.exe
2533 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2539 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2540 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2541 searched using the script file extension (e.g., <code>.pl</code>) as a
2542 search key. The command defined by the registry subkey
2543 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2544 <code>Shell\Open\Command</code> is used to open the script file. If the
2545 registry keys cannot be found, Apache falls back to the behavior of the
2546 <code>Script</code> option.</p>
2548 <note type="warning"><title>Security</title>
2549 <p>Be careful when using <code>ScriptInterpreterSource
2550 Registry</code> with <directive
2551 module="mod_alias">ScriptAlias</directive>'ed directories, because
2552 Apache will try to execute <strong>every</strong> file within this
2553 directory. The <code>Registry</code> setting may cause undesired
2554 program calls on files which are typically not executed. For
2555 example, the default open command on <code>.htm</code> files on
2556 most Windows systems will execute Microsoft Internet Explorer, so
2557 any HTTP request for an <code>.htm</code> file existing within the
2558 script directory would start the browser in the background on the
2559 server. This is a good way to crash your system within a minute or
2563 <p>The option <code>Registry-Strict</code> which is new in Apache
2564 2.0 does the same thing as <code>Registry</code> but uses only the
2565 subkey <code>Shell\ExecCGI\Command</code>. The
2566 <code>ExecCGI</code> key is not a common one. It must be
2567 configured manually in the windows registry and hence prevents
2568 accidental program calls on your system.</p>
2570 </directivesynopsis>
2573 <name>ServerAdmin</name>
2574 <description>Email address that the server includes in error
2575 messages sent to the client</description>
2576 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
2577 <contextlist><context>server config</context><context>virtual host</context>
2581 <p>The <directive>ServerAdmin</directive> sets the contact address
2582 that the server includes in any error messages it returns to the
2583 client. If the <code>httpd</code> doesn't recognize the supplied argument
2585 assumes, that it's an <var>email-address</var> and prepends it with
2586 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2587 actually use an email address, since there are a lot of CGI scripts that
2588 make that assumption. If you want to use an URL, it should point to another
2589 server under your control. Otherwise users may not be able to contact you in
2592 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2595 ServerAdmin www-admin@foo.example.com
2597 <p>as users do not always mention that they are talking about the
2600 </directivesynopsis>
2603 <name>ServerAlias</name>
2604 <description>Alternate names for a host used when matching requests
2605 to name-virtual hosts</description>
2606 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
2607 <contextlist><context>virtual host</context></contextlist>
2610 <p>The <directive>ServerAlias</directive> directive sets the
2611 alternate names for a host, for use with <a
2612 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
2615 <VirtualHost *><br />
2616 ServerName server.domain.com<br />
2617 ServerAlias server server2.domain.com server2<br />
2619 </VirtualHost>
2622 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2623 </directivesynopsis>
2626 <name>ServerName</name>
2627 <description>Hostname and port that the server uses to identify
2628 itself</description>
2629 <syntax>ServerName <var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
2630 <contextlist><context>server config</context><context>virtual host</context>
2632 <compatibility>In version 2.0, this
2633 directive supersedes the functionality of the <directive>Port</directive>
2634 directive from version 1.3.</compatibility>
2637 <p>The <directive>ServerName</directive> directive sets the hostname and
2638 port that the server uses to identify itself. This is used when
2639 creating redirection URLs. For example, if the name of the
2640 machine hosting the web server is <code>simple.example.com</code>,
2641 but the machine also has the DNS alias <code>www.example.com</code>
2642 and you wish the web server to be so identified, the following
2643 directive should be used:</p>
2646 ServerName www.example.com:80
2649 <p>If no <directive>ServerName</directive> is specified, then the
2650 server attempts to deduce the hostname by performing a reverse
2651 lookup on the IP address. If no port is specified in the
2652 <directive>ServerName</directive>, then the server will use the port
2654 request. For optimal reliability and predictability, you should
2655 specify an explicit hostname and port using the
2656 <directive>ServerName</directive> directive.</p>
2658 <p>If you are using <a
2659 href="../vhosts/name-based.html">name-based virtual hosts</a>,
2660 the <directive>ServerName</directive> inside a
2661 <directive type="section" module="core">VirtualHost</directive>
2662 section specifies what hostname must appear in the request's
2663 <code>Host:</code> header to match this virtual host.</p>
2665 <p>See the description of the
2666 <directive module="core">UseCanonicalName</directive> directive for
2667 settings which determine whether self-referential URL's (e.g., by the
2668 <module>mod_dir</module> module) will refer to the
2669 specified port, or to the port number given in the client's request.
2673 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
2674 Apache</a></seealso>
2675 <seealso><a href="../vhosts/">Apache virtual host
2676 documentation</a></seealso>
2677 <seealso><directive module="core">UseCanonicalName</directive></seealso>
2678 <seealso><directive module="core">NameVirtualHost</directive></seealso>
2679 <seealso><directive module="core">ServerAlias</directive></seealso>
2680 </directivesynopsis>
2683 <name>ServerPath</name>
2684 <description>Legacy URL pathname for a name-based virtual host that
2685 is accessed by an incompatible browser</description>
2686 <syntax>ServerPath <var>URL-path</var></syntax>
2687 <contextlist><context>virtual host</context></contextlist>
2690 <p>The <directive>ServerPath</directive> directive sets the legacy
2691 URL pathname for a host, for use with <a
2692 href="../vhosts/">name-based virtual hosts</a>.</p>
2694 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2695 </directivesynopsis>
2698 <name>ServerRoot</name>
2699 <description>Base directory for the server installation</description>
2700 <syntax>ServerRoot <var>directory-path</var></syntax>
2701 <default>ServerRoot /usr/local/apache</default>
2702 <contextlist><context>server config</context></contextlist>
2705 <p>The <directive>ServerRoot</directive> directive sets the
2706 directory in which the server lives. Typically it will contain the
2707 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2708 paths in other configuration directives (such as <directive
2709 module="core">Include</directive> or <directive
2710 module="mod_so">LoadModule</directive>, for example) are taken as
2711 relative to this directory.</p>
2713 <example><title>Example</title>
2714 ServerRoot /home/httpd
2718 <seealso><a href="../invoking.html">the <code>-d</code>
2719 option to <code>httpd</code></a></seealso>
2720 <seealso><a href="../misc/security_tips.html#serverroot">the
2721 security tips</a> for information on how to properly set
2722 permissions on the <directive>ServerRoot</directive></seealso>
2723 </directivesynopsis>
2726 <name>ServerSignature</name>
2727 <description>Configures the footer on server-generated documents</description>
2728 <syntax>ServerSignature On|Off|EMail</syntax>
2729 <default>ServerSignature Off</default>
2730 <contextlist><context>server config</context><context>virtual host</context>
2731 <context>directory</context><context>.htaccess</context>
2733 <override>All</override>
2736 <p>The <directive>ServerSignature</directive> directive allows the
2737 configuration of a trailing footer line under server-generated
2738 documents (error messages, <module>mod_proxy</module> ftp directory
2739 listings, <module>mod_info</module> output, ...). The reason why you
2740 would want to enable such a footer line is that in a chain of proxies,
2741 the user often has no possibility to tell which of the chained servers
2742 actually produced a returned error message.</p>
2744 <p>The <code>Off</code>
2745 setting, which is the default, suppresses the footer line (and is
2746 therefore compatible with the behavior of Apache-1.2 and
2747 below). The <code>On</code> setting simply adds a line with the
2748 server version number and <directive
2749 module="core">ServerName</directive> of the serving virtual host,
2750 and the <code>EMail</code> setting additionally creates a
2751 "mailto:" reference to the <directive
2752 module="core">ServerAdmin</directive> of the referenced
2755 <p>After version 2.0.44, the details of the server version number
2756 presented are controlled by the <directive
2757 module="core">ServerTokens</directive> directive.</p>
2759 <seealso><directive module="core">ServerTokens</directive></seealso>
2760 </directivesynopsis>
2763 <name>ServerTokens</name>
2764 <description>Configures the <code>Server</code> HTTP response
2765 header</description>
2766 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
2767 <default>ServerTokens Full</default>
2768 <contextlist><context>server config</context></contextlist>
2771 <p>This directive controls whether <code>Server</code> response
2772 header field which is sent back to clients includes a
2773 description of the generic OS-type of the server as well as
2774 information about compiled-in modules.</p>
2777 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2779 <dd>Server sends (<em>e.g.</em>): <code>Server:
2782 <dt><code>ServerTokens Major</code></dt>
2784 <dd>Server sends (<em>e.g.</em>): <code>Server:
2785 Apache/2</code></dd>
2787 <dt><code>ServerTokens Minor</code></dt>
2789 <dd>Server sends (<em>e.g.</em>): <code>Server:
2790 Apache/2.0</code></dd>
2792 <dt><code>ServerTokens Min[imal]</code></dt>
2794 <dd>Server sends (<em>e.g.</em>): <code>Server:
2795 Apache/2.0.41</code></dd>
2797 <dt><code>ServerTokens OS</code></dt>
2799 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2802 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2804 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2805 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2808 <p>This setting applies to the entire server, and cannot be
2809 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2811 <p>After version 2.0.44, this directive also controls the
2812 information presented by the <directive
2813 module="core">ServerSignature</directive> directive.</p>
2815 <seealso><directive module="core">ServerSignature</directive></seealso>
2816 </directivesynopsis>
2819 <name>SetHandler</name>
2820 <description>Forces all matching files to be processed by a
2821 handler</description>
2822 <syntax>SetHandler <var>handler-name</var>|None</syntax>
2823 <contextlist><context>server config</context><context>virtual host</context>
2824 <context>directory</context><context>.htaccess</context>
2826 <override>FileInfo</override>
2827 <compatibility>Moved into the core in Apache 2.0</compatibility>
2830 <p>When placed into an <code>.htaccess</code> file or a
2831 <directive type="section" module="core">Directory</directive> or
2832 <directive type="section" module="core">Location</directive>
2833 section, this directive forces all matching files to be parsed
2834 through the <a href="../handler.html">handler</a> given by
2835 <var>handler-name</var>. For example, if you had a directory you
2836 wanted to be parsed entirely as imagemap rule files, regardless
2837 of extension, you might put the following into an
2838 <code>.htaccess</code> file in that directory:</p>
2841 SetHandler imap-file
2844 <p>Another example: if you wanted to have the server display a
2845 status report whenever a URL of
2846 <code>http://servername/status</code> was called, you might put
2847 the following into <code>httpd.conf</code>:</p>
2850 <Location /status><br />
2852 SetHandler server-status<br />
2857 <p>You can override an earlier defined <directive>SetHandler</directive>
2858 directive by using the value <code>None</code>.</p>
2861 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
2863 </directivesynopsis>
2866 <name>SetInputFilter</name>
2867 <description>Sets the filters that will process client requests and POST
2869 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2870 <contextlist><context>server config</context><context>virtual host</context>
2871 <context>directory</context><context>.htaccess</context>
2873 <override>FileInfo</override>
2876 <p>The <directive>SetInputFilter</directive> directive sets the
2877 filter or filters which will process client requests and POST
2878 input when they are received by the server. This is in addition to
2879 any filters defined elsewhere, including the
2880 <directive module="mod_mime">AddInputFilter</directive>
2883 <p>If more than one filter is specified, they must be separated
2884 by semicolons in the order in which they should process the
2887 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
2888 </directivesynopsis>
2891 <name>SetOutputFilter</name>
2892 <description>Sets the filters that will process responses from the
2893 server</description>
2894 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2895 <contextlist><context>server config</context><context>virtual host</context>
2896 <context>directory</context><context>.htaccess</context>
2898 <override>FileInfo</override>
2901 <p>The <directive>SetOutputFilter</directive> directive sets the filters
2902 which will process responses from the server before they are
2903 sent to the client. This is in addition to any filters defined
2904 elsewhere, including the
2905 <directive module="mod_mime">AddOutputFilter</directive>
2908 <p>For example, the following configuration will process all files
2909 in the <code>/www/data/</code> directory for server-side
2913 <Directory /www/data/><br />
2915 SetOutputFilter INCLUDES<br />
2920 <p>If more than one filter is specified, they must be separated
2921 by semicolons in the order in which they should process the
2924 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
2925 </directivesynopsis>
2928 <name>TimeOut</name>
2929 <description>Amount of time the server will wait for
2930 certain events before failing a request</description>
2931 <syntax>TimeOut <var>seconds</var></syntax>
2932 <default>TimeOut 300</default>
2933 <contextlist><context>server config</context></contextlist>
2936 <p>The <directive>TimeOut</directive> directive currently defines
2937 the amount of time Apache will wait for three things:</p>
2940 <li>The total amount of time it takes to receive a GET
2943 <li>The amount of time between receipt of TCP packets on a
2944 POST or PUT request.</li>
2946 <li>The amount of time between ACKs on transmissions of TCP
2947 packets in responses.</li>
2950 <p>We plan on making these separately configurable at some point
2951 down the road. The timer used to default to 1200 before 1.2,
2952 but has been lowered to 300 which is still far more than
2953 necessary in most situations. It is not set any lower by
2954 default because there may still be odd places in the code where
2955 the timer is not reset when a packet is sent. </p>
2957 </directivesynopsis>
2960 <name>UseCanonicalName</name>
2961 <description>Configures how the server determines its own name and
2963 <syntax>UseCanonicalName On|Off|DNS</syntax>
2964 <default>UseCanonicalName On</default>
2965 <contextlist><context>server config</context><context>virtual host</context>
2966 <context>directory</context></contextlist>
2969 <p>In many situations Apache must construct a <em>self-referential</em>
2970 URL -- that is, a URL that refers back to the same server. With
2971 <code>UseCanonicalName On</code> Apache will use the hostname and port
2972 specified in the <directive module="core">ServerName</directive>
2973 directive to construct the canonical name for the server. This name
2974 is used in all self-referential URLs, and for the values of
2975 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
2977 <p>With <code>UseCanonicalName Off</code> Apache will form
2978 self-referential URLs using the hostname and port supplied by
2979 the client if any are supplied (otherwise it will use the
2980 canonical name, as defined above). These values are the same
2981 that are used to implement <a
2982 href="../vhosts/name-based.html">name based virtual hosts</a>,
2983 and are available with the same clients. The CGI variables
2984 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
2985 constructed from the client supplied values as well.</p>
2987 <p>An example where this may be useful is on an intranet server
2988 where you have users connecting to the machine using short
2989 names such as <code>www</code>. You'll notice that if the users
2990 type a shortname, and a URL which is a directory, such as
2991 <code>http://www/splat</code>, <em>without the trailing
2992 slash</em> then Apache will redirect them to
2993 <code>http://www.domain.com/splat/</code>. If you have
2994 authentication enabled, this will cause the user to have to
2995 authenticate twice (once for <code>www</code> and once again
2996 for <code>www.domain.com</code> -- see <a
2997 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
2998 FAQ on this subject for more information</a>). But if
2999 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3000 Apache will redirect to <code>http://www/splat/</code>.</p>
3002 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3003 which is intended for use with mass IP-based virtual hosting to
3004 support ancient clients that do not provide a
3005 <code>Host:</code> header. With this option Apache does a
3006 reverse DNS lookup on the server IP address that the client
3007 connected to in order to work out self-referential URLs.</p>
3009 <note type="warning"><title>Warning</title>
3010 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3011 they may be broken by this option. The client is essentially free
3012 to give whatever value they want as a hostname. But if the CGI is
3013 only using <code>SERVER_NAME</code> to construct self-referential URLs
3014 then it should be just fine.</p>
3017 <seealso><directive module="core">ServerName</directive></seealso>
3018 <seealso><directive module="mpm_common">Listen</directive></seealso>
3019 </directivesynopsis>
3021 <directivesynopsis type="section">
3022 <name>VirtualHost</name>
3023 <description>Contains directives that apply only to a specific
3024 hostname or IP address</description>
3025 <syntax><VirtualHost
3026 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3027 ...> ... </VirtualHost></syntax>
3028 <contextlist><context>server config</context></contextlist>
3031 <p><directive type="section">VirtualHost</directive> and
3032 <code></VirtualHost></code> are used to enclose a group of
3033 directives that will apply only to a particular virtual host. Any
3034 directive that is allowed in a virtual host context may be
3035 used. When the server receives a request for a document on a
3036 particular virtual host, it uses the configuration directives
3037 enclosed in the <directive type="section">VirtualHost</directive>
3038 section. <var>Addr</var> can be:</p>
3041 <li>The IP address of the virtual host;</li>
3043 <li>A fully qualified domain name for the IP address of the
3046 <li>The character <code>*</code>, which is used only in combination with
3047 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3049 <li>The string <code>_default_</code>, which is used only
3050 with IP virtual hosting to catch unmatched IP addresses.</li>
3053 <example><title>Example</title>
3054 <VirtualHost 10.1.2.3><br />
3056 ServerAdmin webmaster@host.foo.com<br />
3057 DocumentRoot /www/docs/host.foo.com<br />
3058 ServerName host.foo.com<br />
3059 ErrorLog logs/host.foo.com-error_log<br />
3060 TransferLog logs/host.foo.com-access_log<br />
3062 </VirtualHost>
3066 <p>IPv6 addresses must be specified in square brackets because
3067 the optional port number could not be determined otherwise. An
3068 IPv6 example is shown below:</p>
3071 <VirtualHost [fe80::a00:20ff:fea7:ccea]><br />
3073 ServerAdmin webmaster@host.example.com<br />
3074 DocumentRoot /www/docs/host.example.com<br />
3075 ServerName host.example.com<br />
3076 ErrorLog logs/host.example.com-error_log<br />
3077 TransferLog logs/host.example.com-access_log<br />
3079 </VirtualHost>
3082 <p>Each Virtual Host must correspond to a different IP address,
3083 different port number or a different host name for the server,
3084 in the former case the server machine must be configured to
3085 accept IP packets for multiple addresses. (If the machine does
3086 not have multiple network interfaces, then this can be
3087 accomplished with the <code>ifconfig alias</code> command -- if
3088 your OS supports it).</p>
3090 <note><title>Note</title>
3091 <p>The use of <directive type="section">VirtualHost</directive> does
3092 <strong>not</strong> affect what addresses Apache listens on. You
3093 may need to ensure that Apache is listening on the correct addresses
3094 using <directive module="mpm_common">Listen</directive>.</p>
3097 <p>When using IP-based virtual hosting, the special name
3098 <code>_default_</code> can be specified in
3099 which case this virtual host will match any IP address that is
3100 not explicitly listed in another virtual host. In the absence
3101 of any <code>_default_</code> virtual host the "main" server config,
3102 consisting of all those definitions outside any VirtualHost
3103 section, is used when no IP-match occurs. (But note that any IP
3104 address that matches a <directive
3105 module="core">NameVirtualHost</directive> directive will use neither
3106 the "main" server config nor the <code>_default_</code> virtual host.
3107 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
3108 documentation for further details.)</p>
3110 <p>You can specify a <code>:port</code> to change the port that is
3111 matched. If unspecified then it defaults to the same port as the
3112 most recent <directive module="mpm_common">Listen</directive>
3113 statement of the main server. You may also specify <code>:*</code>
3114 to match all ports on that address. (This is recommended when used
3115 with <code>_default_</code>.)</p>
3117 <note type="warning"><title>Security</title>
3118 <p>See the <a href="../misc/security_tips.html">security tips</a>
3119 document for details on why your security could be compromised if the
3120 directory where log files are stored is writable by anyone other
3121 than the user that starts the server.</p>
3124 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
3125 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3126 Apache</a></seealso>
3127 <seealso><a href="../bind.html">Setting
3128 which addresses and ports Apache uses</a></seealso>
3129 <seealso><a href="../sections.html">How <Directory>, <Location>
3130 and <Files> sections work</a> for an explanation of how these
3131 different sections are combined when a request is received</seealso>
3132 </directivesynopsis>