2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2002-2005 The Apache Software Foundation or its licensors, as
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Core Apache HTTP Server features that are always
27 available</description>
31 <name>AcceptFilter</name>
32 <description>Configures optimizations for a Protocol's Listener Sockets</description>
33 <syntax>AcceptFilter <var>protocol</var> <var>accept_filter</var></syntax>
34 <contextlist><context>server config</context></contextlist>
35 <compatibility>Available in Apache 2.1.5 and later</compatibility>
38 <p>This directive enables operating system specific optimizations for a
39 listening socket by the Protocol type. The basic premise is for the
40 kernel to not send a socket to the server process until either data
41 is received or an entire HTTP Request is buffered. Only
42 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
43 FreeBSD's Accept Filters</a> and Linux's more primitive
44 <code>TCP_DEFER_ACCEPT</code> are currently supported.</p>
46 <p>The default values on FreeBSD are:</p>
48 AcceptFilter http httpready <br/>
49 AcceptFilter https dataready
52 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
53 the kernel level. Once an entire request is recieved, the kernel then
54 sends it to the server. See the
55 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
56 accf_http(9)</a> man page for more details. Since HTTPS requests are
57 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
58 accf_data(9)</a> filter is used.</p>
60 <p>The default values on Linux are:</p>
62 AcceptFilter http data <br/>
63 AcceptFilter https data
66 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
67 requests. Any value besides <code>none</code> will enable
68 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
70 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
71 tcp(7)</a> man page.</p>
73 <p>Using <code>none</code> for an argument will disable any accept filters
74 for that protocol. This is useful for protocols that require a server
75 send data first, such as <code>nntp</code>:</p>
76 <example>AcceptFilter nttp none</example>
82 <name>AcceptPathInfo</name>
83 <description>Resources accept trailing pathname information</description>
84 <syntax>AcceptPathInfo On|Off|Default</syntax>
85 <default>AcceptPathInfo Default</default>
86 <contextlist><context>server config</context>
87 <context>virtual host</context><context>directory</context>
88 <context>.htaccess</context></contextlist>
89 <override>FileInfo</override>
90 <compatibility>Available in Apache 2.0.30 and later</compatibility>
94 <p>This directive controls whether requests that contain trailing
95 pathname information that follows an actual filename (or
96 non-existent file in an existing directory) will be accepted or
97 rejected. The trailing pathname information can be made
98 available to scripts in the <code>PATH_INFO</code> environment
101 <p>For example, assume the location <code>/test/</code> points to
102 a directory that contains only the single file
103 <code>here.html</code>. Then requests for
104 <code>/test/here.html/more</code> and
105 <code>/test/nothere.html/more</code> both collect
106 <code>/more</code> as <code>PATH_INFO</code>.</p>
108 <p>The three possible arguments for the
109 <directive>AcceptPathInfo</directive> directive are:</p>
111 <dt><code>Off</code></dt><dd>A request will only be accepted if it
112 maps to a literal path that exists. Therefore a request with
113 trailing pathname information after the true filename such as
114 <code>/test/here.html/more</code> in the above example will return
115 a 404 NOT FOUND error.</dd>
117 <dt><code>On</code></dt><dd>A request will be accepted if a
118 leading path component maps to a file that exists. The above
119 example <code>/test/here.html/more</code> will be accepted if
120 <code>/test/here.html</code> maps to a valid file.</dd>
122 <dt><code>Default</code></dt><dd>The treatment of requests with
123 trailing pathname information is determined by the <a
124 href="../handler.html">handler</a> responsible for the request.
125 The core handler for normal files defaults to rejecting
126 <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a
127 href="mod_cgi.html">cgi-script</a> and <a
128 href="mod_isapi.html">isapi-isa</a>, generally accept
129 <code>PATH_INFO</code> by default.</dd>
132 <p>The primary purpose of the <code>AcceptPathInfo</code>
133 directive is to allow you to override the handler's choice of
134 accepting or rejecting <code>PATH_INFO</code>. This override is required,
135 for example, when you use a <a href="../filter.html">filter</a>, such
136 as <a href="mod_include.html">INCLUDES</a>, to generate content
137 based on <code>PATH_INFO</code>. The core handler would usually reject
138 the request, so you can use the following configuration to enable
142 <Files "mypaths.shtml"><br />
144 Options +Includes<br />
145 SetOutputFilter INCLUDES<br />
146 AcceptPathInfo On<br />
155 <name>AccessFileName</name>
156 <description>Name of the distributed configuration file</description>
157 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
158 <default>AccessFileName .htaccess</default>
159 <contextlist><context>server config</context><context>virtual host</context>
163 <p>While processing a request the server looks for
164 the first existing configuration file from this list of names in
165 every directory of the path to the document, if distributed
166 configuration files are <a href="#allowoverride">enabled for that
167 directory</a>. For example:</p>
173 <p>before returning the document
174 <code>/usr/local/web/index.html</code>, the server will read
175 <code>/.acl</code>, <code>/usr/.acl</code>,
176 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
177 for directives, unless they have been disabled with</p>
180 <Directory /><br />
182 AllowOverride None<br />
187 <seealso><directive module="core">AllowOverride</directive></seealso>
188 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
189 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
193 <name>AddDefaultCharset</name>
194 <description>Default charset parameter to be added when a response
195 content-type is <code>text/plain</code> or <code>text/html</code></description>
196 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
197 <default>AddDefaultCharset Off</default>
198 <contextlist><context>server config</context>
199 <context>virtual host</context><context>directory</context>
200 <context>.htaccess</context></contextlist>
201 <override>FileInfo</override>
204 <p>This directive specifies a default value for the media type
205 charset parameter (the name of a character encoding) to be added
206 to a response if and only if the response's content-type is either
207 <code>text/plain</code> or <code>text/html</code>. This should override
208 any charset specified in the body of the response via a <code>META</code>
209 element, though the exact behavior is often dependent on the user's client
210 configuration. A setting of <code>AddDefaultCharset Off</code>
211 disables this functionality. <code>AddDefaultCharset On</code> enables
212 a default charset of <code>iso-8859-1</code>. Any other value is assumed
213 to be the <var>charset</var> to be used, which should be one of the
214 <a href="http://www.iana.org/assignments/character-sets">IANA registered
215 charset values</a> for use in MIME media types.
219 AddDefaultCharset utf-8
222 <p><directive>AddDefaultCharset</directive> should only be used when all
223 of the text resources to which it applies are known to be in that
224 character encoding and it is too inconvenient to label their charset
225 individually. One such example is to add the charset parameter
226 to resources containing generated content, such as legacy CGI
227 scripts, that might be vulnerable to cross-site scripting attacks
228 due to user-provided data being included in the output. Note, however,
229 that a better solution is to just fix (or delete) those scripts, since
230 setting a default charset does not protect users that have enabled
231 the "auto-detect character encoding" feature on their browser.</p>
233 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
237 <name>AddOutputFilterByType</name>
238 <description>assigns an output filter to a particular MIME-type</description>
239 <syntax>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
240 <var>MIME-type</var> [<var>MIME-type</var>] ...</syntax>
241 <contextlist><context>server config</context>
242 <context>virtual host</context><context>directory</context>
243 <context>.htaccess</context></contextlist>
244 <override>FileInfo</override>
245 <compatibility>Available in Apache 2.0.33 and later</compatibility>
248 <p>This directive activates a particular output <a
249 href="../filter.html">filter</a> for a request depending on the
250 response <glossary>MIME-type</glossary>.</p>
252 <p>The following example uses the <code>DEFLATE</code> filter, which
253 is provided by <module>mod_deflate</module>. It will compress all
254 output (either static or dynamic) which is labeled as
255 <code>text/html</code> or <code>text/plain</code> before it is sent
259 AddOutputFilterByType DEFLATE text/html text/plain
262 <p>If you want the content to be processed by more than one filter, their
263 names have to be separated by semicolons. It's also possible to use one
264 <directive>AddOutputFilterByType</directive> directive for each of
267 <p>The configuration below causes all script output labeled as
268 <code>text/html</code> to be processed at first by the
269 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
273 <Location /cgi-bin/><br />
275 Options Includes<br />
276 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
281 <note type="warning"><title>Note</title>
282 <p>Enabling filters with <directive>AddOutputFilterByType</directive>
283 may fail partially or completely in some cases. For example, no
284 filters are applied if the <glossary>MIME-type</glossary> could not be determined and falls
285 back to the <directive module="core">DefaultType</directive> setting,
286 even if the <directive module="core">DefaultType</directive> is the
289 <p>However, if you want to make sure, that the filters will be
290 applied, assign the content type to a resource explicitly, for
291 example with <directive module="mod_mime">AddType</directive> or
292 <directive module="core">ForceType</directive>. Setting the
293 content type within a (non-nph) CGI script is also safe.</p>
295 <p>The by-type output filters are never applied on proxy requests.</p>
299 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
300 <seealso><directive module="core">SetOutputFilter</directive></seealso>
301 <seealso><a href="../filter.html">filters</a></seealso>
305 <name>AllowEncodedSlashes</name>
306 <description>Determines whether encoded path separators in URLs are allowed to
307 be passed through</description>
308 <syntax>AllowEncodedSlashes On|Off</syntax>
309 <default>AllowEncodedSlashes Off</default>
310 <contextlist><context>server config</context><context>virtual host</context>
312 <compatibility>Available in Apache 2.0.46 and later</compatibility>
315 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
316 which contain encoded path separators (<code>%2F</code> for <code>/</code>
317 and additionally <code>%5C</code> for <code>\</code> on according systems)
318 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
320 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
321 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
323 <note><title>Note</title>
324 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
325 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
326 according systems) will be left as such in the otherwise decoded URL
330 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
334 <name>AllowOverride</name>
335 <description>Types of directives that are allowed in
336 <code>.htaccess</code> files</description>
337 <syntax>AllowOverride All|None|<var>directive-type</var>
338 [<var>directive-type</var>] ...</syntax>
339 <default>AllowOverride All</default>
340 <contextlist><context>directory</context></contextlist>
343 <p>When the server finds an <code>.htaccess</code> file (as
344 specified by <directive module="core">AccessFileName</directive>)
345 it needs to know which directives declared in that file can override
346 earlier configuration directives.</p>
348 <note><title>Only available in <Directory> sections</title>
349 <directive>AllowOverride</directive> is valid only in
350 <directive type="section" module="core">Directory</directive>
351 sections specified without regular expressions, not in <directive
352 type="section" module="core">Location</directive>, <directive
353 module="core" type="section">DirectoryMatch</directive> or
354 <directive type="section" module="core">Files</directive> sections.
357 <p>When this directive is set to <code>None</code>, then
358 <a href="#accessfilename">.htaccess</a> files are completely ignored.
359 In this case, the server will not even attempt to read
360 <code>.htaccess</code> files in the filesystem.</p>
362 <p>When this directive is set to <code>All</code>, then any
363 directive which has the .htaccess <a
364 href="directive-dict.html#Context">Context</a> is allowed in
365 <code>.htaccess</code> files.</p>
367 <p>The <var>directive-type</var> can be one of the following
368 groupings of directives.</p>
375 Allow use of the authorization directives (<directive
376 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
377 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
378 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
379 <directive module="core">AuthName</directive>,
380 <directive module="core">AuthType</directive>, <directive
381 module="mod_authn_file">AuthUserFile</directive>, <directive
382 module="core">Require</directive>, <em>etc.</em>).</dd>
387 Allow use of the directives controlling document types (<directive
388 module="core">DefaultType</directive>, <directive
389 module="core">ErrorDocument</directive>, <directive
390 module="core">ForceType</directive>, <directive
391 module="mod_negotiation">LanguagePriority</directive>,
392 <directive module="core">SetHandler</directive>, <directive
393 module="core">SetInputFilter</directive>, <directive
394 module="core">SetOutputFilter</directive>, and
395 <module>mod_mime</module> Add* and Remove*
396 directives, <em>etc.</em>), document meta data (<directive
397 module="mod_headers">Header</directive>, <directive
398 module="mod_headers">RequestHeader</directive>, <directive
399 module="mod_setenvif">SetEnvIf</directive>, <directive
400 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
401 module="mod_setenvif">BrowserMatch</directive>, <directive
402 module="mod_usertrack">CookieExpires</directive>, <directive
403 module="mod_usertrack">CookieDomain</directive>, <directive
404 module="mod_usertrack">CookieStyle</directive>, <directive
405 module="mod_usertrack">CookieTracking</directive>, <directive
406 module="mod_usertrack">CookieName</directive>),
407 <module>mod_rewrite</module> directives <directive
408 module="mod_rewrite">RewriteEngine</directive>, <directive
409 module="mod_rewrite">RewriteOptions</directive>, <directive
410 module="mod_rewrite">RewriteBase</directive>, <directive
411 module="mod_rewrite">RewriteCond</directive>, <directive
412 module="mod_rewrite">RewriteRule</directive>) and
413 <directive module="mod_actions">Action</directive> from
414 <module>mod_actions</module>.
420 Allow use of the directives controlling directory indexing
422 module="mod_autoindex">AddDescription</directive>,
423 <directive module="mod_autoindex">AddIcon</directive>, <directive
424 module="mod_autoindex">AddIconByEncoding</directive>,
425 <directive module="mod_autoindex">AddIconByType</directive>,
426 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
427 module="mod_dir">DirectoryIndex</directive>, <directive
428 module="mod_autoindex">FancyIndexing</directive>, <directive
429 module="mod_autoindex">HeaderName</directive>, <directive
430 module="mod_autoindex">IndexIgnore</directive>, <directive
431 module="mod_autoindex">IndexOptions</directive>, <directive
432 module="mod_autoindex">ReadmeName</directive>,
438 Allow use of the directives controlling host access (<directive
439 module="mod_authz_host">Allow</directive>, <directive
440 module="mod_authz_host">Deny</directive> and <directive
441 module="mod_authz_host">Order</directive>).</dd>
443 <dt>Options[=<var>Option</var>,...]</dt>
446 Allow use of the directives controlling specific directory
447 features (<directive module="core">Options</directive> and
448 <directive module="mod_include">XBitHack</directive>).
449 An equal sign may be given followed by a comma (but no spaces)
450 separated lists of options that may be set using the <directive
451 module="core">Options</directive> command.</dd>
457 AllowOverride AuthConfig Indexes
460 <p>In the example above all directives that are neither in the group
461 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
465 <seealso><directive module="core">AccessFileName</directive></seealso>
466 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
467 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
471 <name>AuthName</name>
472 <description>Authorization realm for use in HTTP
473 authentication</description>
474 <syntax>AuthName <var>auth-domain</var></syntax>
475 <contextlist><context>directory</context><context>.htaccess</context>
477 <override>AuthConfig</override>
480 <p>This directive sets the name of the authorization realm for a
481 directory. This realm is given to the client so that the user
482 knows which username and password to send.
483 <directive>AuthName</directive> takes a single argument; if the
484 realm name contains spaces, it must be enclosed in quotation
485 marks. It must be accompanied by <directive
486 module="core">AuthType</directive> and <directive
487 module="core">Require</directive> directives, and directives such
488 as <directive module="mod_authn_file">AuthUserFile</directive> and
489 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
495 AuthName "Top Secret"
498 <p>The string provided for the <code>AuthName</code> is what will
499 appear in the password dialog provided by most browsers.</p>
502 href="../howto/auth.html">Authentication, Authorization, and
503 Access Control</a></seealso>
507 <name>AuthType</name>
508 <description>Type of user authentication</description>
509 <syntax>AuthType Basic|Digest</syntax>
510 <contextlist><context>directory</context><context>.htaccess</context>
512 <override>AuthConfig</override>
515 <p>This directive selects the type of user authentication for a
516 directory. Only <code>Basic</code> and <code>Digest</code> are
517 currently implemented.
519 It must be accompanied by <directive
520 module="core">AuthName</directive> and <directive
521 module="core">Require</directive> directives, and directives such
522 as <directive module="mod_authn_file">AuthUserFile</directive> and
523 <directive module="mod_authz_groupfile">AuthGroupFile</directive> to
526 <seealso><a href="../howto/auth.html">Authentication, Authorization,
527 and Access Control</a></seealso>
531 <name>CGIMapExtension</name>
532 <description>Technique for locating the interpreter for CGI
533 scripts</description>
534 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
535 <contextlist><context>directory</context><context>.htaccess</context>
537 <override>FileInfo</override>
538 <compatibility>NetWare only</compatibility>
541 <p>This directive is used to control how Apache finds the
542 interpreter used to run CGI scripts. For example, setting
543 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
544 cause all CGI script files with a <code>.foo</code> extension to
545 be passed to the FOO interpreter.</p>
550 <name>ContentDigest</name>
551 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
552 headers</description>
553 <syntax>ContentDigest On|Off</syntax>
554 <default>ContentDigest Off</default>
555 <contextlist><context>server config</context><context>virtual host</context>
556 <context>directory</context><context>.htaccess</context>
558 <override>Options</override>
559 <status>Experimental</status>
562 <p>This directive enables the generation of
563 <code>Content-MD5</code> headers as defined in RFC1864
564 respectively RFC2068.</p>
566 <p>MD5 is an algorithm for computing a "message digest"
567 (sometimes called "fingerprint") of arbitrary-length data, with
568 a high degree of confidence that any alterations in the data
569 will be reflected in alterations in the message digest.</p>
571 <p>The <code>Content-MD5</code> header provides an end-to-end
572 message integrity check (MIC) of the entity-body. A proxy or
573 client may check this header for detecting accidental
574 modification of the entity-body in transit. Example header:</p>
577 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
580 <p>Note that this can cause performance problems on your server
581 since the message digest is computed on every request (the
582 values are not cached).</p>
584 <p><code>Content-MD5</code> is only sent for documents served
585 by the <module>core</module>, and not by any module. For example,
586 SSI documents, output from CGI scripts, and byte range responses
587 do not have this header.</p>
592 <name>DefaultType</name>
593 <description>MIME content-type that will be sent if the
594 server cannot determine a type in any other way</description>
595 <syntax>DefaultType <var>MIME-type</var></syntax>
596 <default>DefaultType text/plain</default>
597 <contextlist><context>server config</context><context>virtual host</context>
598 <context>directory</context><context>.htaccess</context>
600 <override>FileInfo</override>
603 <p>There will be times when the server is asked to provide a
604 document whose type cannot be determined by its <glossary
605 ref="mime-type">MIME types</glossary> mappings.</p>
607 <p>The server must inform the client of the content-type of the
608 document, so in the event of an unknown type it uses the
609 <code>DefaultType</code>. For example:</p>
612 DefaultType image/gif
615 <p>would be appropriate for a directory which contained many GIF
616 images with filenames missing the <code>.gif</code> extension.</p>
618 <p>Note that unlike <directive
619 module="core">ForceType</directive>, this directive only
620 provides the default mime-type. All other mime-type definitions,
621 including filename extensions, that might identify the media type
622 will override this default.</p>
626 <directivesynopsis type="section">
627 <name>Directory</name>
628 <description>Enclose a group of directives that apply only to the
629 named file-system directory and sub-directories</description>
630 <syntax><Directory <var>directory-path</var>>
631 ... </Directory></syntax>
632 <contextlist><context>server config</context><context>virtual host</context>
636 <p><directive type="section">Directory</directive> and
637 <code></Directory></code> are used to enclose a group of
638 directives that will apply only to the named directory and
639 sub-directories of that directory. Any directive that is allowed
640 in a directory context may be used. <var>Directory-path</var> is
641 either the full path to a directory, or a wild-card string using
642 Unix shell-style matching. In a wild-card string, <code>?</code> matches
643 any single character, and <code>*</code> matches any sequences of
644 characters. You may also use <code>[]</code> character ranges. None
645 of the wildcards match a `/' character, so <code><Directory
646 /*/public_html></code> will not match
647 <code>/home/user/public_html</code>, but <code><Directory
648 /home/*/public_html></code> will match. Example:</p>
651 <Directory /usr/local/httpd/htdocs><br />
653 Options Indexes FollowSymLinks<br />
659 <p>Be careful with the <var>directory-path</var> arguments:
660 They have to literally match the filesystem path which Apache uses
661 to access the files. Directives applied to a particular
662 <code><Directory></code> will not apply to files accessed from
663 that same directory via a different path, such as via different symbolic
667 <p><glossary ref="regex">Regular
668 expressions</glossary> can also be used, with the addition of the
669 <code>~</code> character. For example:</p>
672 <Directory ~ "^/www/.*/[0-9]{3}">
675 <p>would match directories in <code>/www/</code> that consisted of
678 <p>If multiple (non-regular expression) <directive
679 type="section">Directory</directive> sections
680 match the directory (or one of its parents) containing a document,
681 then the directives are applied in the order of shortest match
682 first, interspersed with the directives from the <a
683 href="#accessfilename">.htaccess</a> files. For example,
687 <Directory /><br />
689 AllowOverride None<br />
691 </Directory><br />
693 <Directory /home/><br />
695 AllowOverride FileInfo<br />
700 <p>for access to the document <code>/home/web/dir/doc.html</code>
704 <li>Apply directive <code>AllowOverride None</code>
705 (disabling <code>.htaccess</code> files).</li>
707 <li>Apply directive <code>AllowOverride FileInfo</code> (for
708 directory <code>/home</code>).</li>
710 <li>Apply any <code>FileInfo</code> directives in
711 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
712 <code>/home/web/dir/.htaccess</code> in that order.</li>
715 <p>Regular expressions are not considered until after all of the
716 normal sections have been applied. Then all of the regular
717 expressions are tested in the order they appeared in the
718 configuration file. For example, with</p>
721 <Directory ~ abc$><br />
723 # ... directives here ...<br />
728 <p>the regular expression section won't be considered until after
729 all normal <directive type="section">Directory</directive>s and
730 <code>.htaccess</code> files have been applied. Then the regular
731 expression will match on <code>/home/abc/public_html/abc</code> and
732 the corresponding <directive type="section">Directory</directive> will
735 <p><strong>Note that the default Apache access for
736 <code><Directory /></code> is <code>Allow from All</code>.
737 This means that Apache will serve any file mapped from an URL. It is
738 recommended that you change this with a block such
742 <Directory /><br />
744 Order Deny,Allow<br />
750 <p><strong>and then override this for directories you
751 <em>want</em> accessible. See the <a
752 href="../misc/security_tips.html">Security Tips</a> page for more
753 details.</strong></p>
755 <p>The directory sections occur in the <code>httpd.conf</code> file.
756 <directive type="section">Directory</directive> directives
757 cannot nest, and cannot appear in a <directive module="core"
758 type="section">Limit</directive> or <directive module="core"
759 type="section">LimitExcept</directive> section.</p>
761 <seealso><a href="../sections.html">How <Directory>,
762 <Location> and <Files> sections work</a> for an
763 explanation of how these different sections are combined when a
764 request is received</seealso>
767 <directivesynopsis type="section">
768 <name>DirectoryMatch</name>
769 <description>Enclose directives that apply to
770 file-system directories matching a regular expression and their
771 subdirectories</description>
772 <syntax><DirectoryMatch <var>regex</var>>
773 ... </DirectoryMatch></syntax>
774 <contextlist><context>server config</context><context>virtual host</context>
778 <p><directive type="section">DirectoryMatch</directive> and
779 <code></DirectoryMatch></code> are used to enclose a group
780 of directives which will apply only to the named directory and
781 sub-directories of that directory, the same as <directive
782 module="core" type="section">Directory</directive>. However, it
783 takes as an argument a <glossary ref="regex">regular
784 expression</glossary>. For example:</p>
787 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
790 <p>would match directories in <code>/www/</code> that consisted of three
793 <seealso><directive type="section" module="core">Directory</directive> for
794 a description of how regular expressions are mixed in with normal
795 <directive type="section">Directory</directive>s</seealso>
797 href="../sections.html">How <Directory>, <Location> and
798 <Files> sections work</a> for an explanation of how these different
799 sections are combined when a request is received</seealso>
803 <name>DocumentRoot</name>
804 <description>Directory that forms the main document tree visible
805 from the web</description>
806 <syntax>DocumentRoot <var>directory-path</var></syntax>
807 <default>DocumentRoot /usr/local/apache/htdocs</default>
808 <contextlist><context>server config</context><context>virtual host</context>
812 <p>This directive sets the directory from which <program>httpd</program>
813 will serve files. Unless matched by a directive like <directive
814 module="mod_alias">Alias</directive>, the server appends the
815 path from the requested URL to the document root to make the
816 path to the document. Example:</p>
819 DocumentRoot /usr/web
823 <code>http://www.my.host.com/index.html</code> refers to
824 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
825 not absolute then it is assumed to be relative to the <directive
826 module="core">ServerRoot</directive>.</p>
828 <p>The <directive>DocumentRoot</directive> should be specified without
829 a trailing slash.</p>
831 <seealso><a href="../urlmapping.html">Mapping URLs to Filesystem
832 Location</a></seealso>
836 <name>EnableMMAP</name>
837 <description>Use memory-mapping to read files during delivery</description>
838 <syntax>EnableMMAP On|Off</syntax>
839 <default>EnableMMAP On</default>
840 <contextlist><context>server config</context><context>virtual host</context>
841 <context>directory</context><context>.htaccess</context>
843 <override>FileInfo</override>
846 <p>This directive controls whether the <program>httpd</program> may use
847 memory-mapping if it needs to read the contents of a file during
848 delivery. By default, when the handling of a request requires
849 access to the data within a file -- for example, when delivering a
850 server-parsed file using <module>mod_include</module> -- Apache
851 memory-maps the file if the OS supports it.</p>
853 <p>This memory-mapping sometimes yields a performance improvement.
854 But in some environments, it is better to disable the memory-mapping
855 to prevent operational problems:</p>
858 <li>On some multiprocessor systems, memory-mapping can reduce the
859 performance of the <program>httpd</program>.</li>
860 <li>With an NFS-mounted <directive module="core">DocumentRoot</directive>,
861 the <program>httpd</program> may crash due to a segmentation fault if a file
862 is deleted or truncated while the <program>httpd</program> has it
866 <p>For server configurations that are vulnerable to these problems,
867 you should disable memory-mapping of delivered files by specifying:</p>
873 <p>For NFS mounted files, this feature may be disabled explicitly for
874 the offending files by specifying:</p>
877 <Directory "/path-to-nfs-files">
887 <name>EnableSendfile</name>
888 <description>Use the kernel sendfile support to deliver files to the client</description>
889 <syntax>EnableSendfile On|Off</syntax>
890 <default>EnableSendfile On</default>
891 <contextlist><context>server config</context><context>virtual host</context>
892 <context>directory</context><context>.htaccess</context>
894 <override>FileInfo</override>
895 <compatibility>Available in version 2.0.44 and later</compatibility>
898 <p>This directive controls whether <program>httpd</program> may use the
899 sendfile support from the kernel to transmit file contents to the client.
900 By default, when the handling of a request requires no access
901 to the data within a file -- for example, when delivering a
902 static file -- Apache uses sendfile to deliver the file contents
903 without ever reading the file if the OS supports it.</p>
905 <p>This sendfile mechanism avoids separate read and send operations,
906 and buffer allocations. But on some platforms or within some
907 filesystems, it is better to disable this feature to avoid
908 operational problems:</p>
911 <li>Some platforms may have broken sendfile support that the build
912 system did not detect, especially if the binaries were built on
913 another box and moved to such a machine with broken sendfile
915 <li>On Linux the use of sendfile triggers TCP-checksum
916 offloading bugs on certain networking cards when using IPv6.</li>
917 <li>On Linux on Itanium, sendfile may be unable to handle files
918 over 2GB in size.</li>
919 <li>With a network-mounted <directive
920 module="core">DocumentRoot</directive> (e.g., NFS or SMB),
921 the kernel may be unable to serve the network file through
925 <p>For server configurations that are vulnerable to these problems,
926 you should disable this feature by specifying:</p>
932 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
933 for the offending files by specifying:</p>
936 <Directory "/path-to-nfs-files">
946 <name>ErrorDocument</name>
947 <description>What the server will return to the client
948 in case of an error</description>
949 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
950 <contextlist><context>server config</context><context>virtual host</context>
951 <context>directory</context><context>.htaccess</context>
953 <override>FileInfo</override>
954 <compatibility>Quoting syntax for text messages is different in Apache
958 <p>In the event of a problem or error, Apache can be configured
959 to do one of four things,</p>
962 <li>output a simple hardcoded error message</li>
964 <li>output a customized message</li>
966 <li>redirect to a local <var>URL-path</var> to handle the
969 <li>redirect to an external <var>URL</var> to handle the
973 <p>The first option is the default, while options 2-4 are
974 configured using the <directive>ErrorDocument</directive>
975 directive, which is followed by the HTTP response code and a URL
976 or a message. Apache will sometimes offer additional information
977 regarding the problem/error.</p>
979 <p>URLs can begin with a slash (/) for local web-paths (relative
980 to the <directive module="core">DocumentRoot</directive>), or be a
981 full URL which the client can resolve. Alternatively, a message
982 can be provided to be displayed by the browser. Examples:</p>
985 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
986 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
987 ErrorDocument 401 /subscription_info.html<br />
988 ErrorDocument 403 "Sorry can't allow you access today"
991 <p>Additionally, the special value <code>default</code> can be used
992 to specify Apache's simple hardcoded message. While not required
993 under normal circumstances, <code>default</code> will restore
994 Apache's simple hardcoded message for configurations that would
995 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
998 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
999 <Directory /web/docs><br />
1001 ErrorDocument 404 default<br />
1006 <p>Note that when you specify an <directive>ErrorDocument</directive>
1007 that points to a remote URL (ie. anything with a method such as
1008 <code>http</code> in front of it), Apache will send a redirect to the
1009 client to tell it where to find the document, even if the
1010 document ends up being on the same server. This has several
1011 implications, the most important being that the client will not
1012 receive the original error status code, but instead will
1013 receive a redirect status code. This in turn can confuse web
1014 robots and other clients which try to determine if a URL is
1015 valid using the status code. In addition, if you use a remote
1016 URL in an <code>ErrorDocument 401</code>, the client will not
1017 know to prompt the user for a password since it will not
1018 receive the 401 status code. Therefore, <strong>if you use an
1019 <code>ErrorDocument 401</code> directive then it must refer to a local
1020 document.</strong></p>
1022 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1023 server-generated error messages when they are "too small" and substitute
1024 its own "friendly" error messages. The size threshold varies depending on
1025 the type of error, but in general, if you make your error document
1026 greater than 512 bytes, then MSIE will show the server-generated
1027 error rather than masking it. More information is available in
1028 Microsoft Knowledge Base article <a
1029 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1032 <p>Although most error messages can be overriden, there are certain
1033 circumstances where the internal messages are used regardless of the
1034 setting of <directive module="core">ErrorDocument</directive>. In
1035 particular, if a malformed request is detected, normal request processing
1036 will be immediately halted and the internal error message returned.
1037 This is necessary to guard against security problems caused by
1040 <p>Prior to version 2.0, messages were indicated by prefixing
1041 them with a single unmatched double quote character.</p>
1044 <seealso><a href="../custom-error.html">documentation of
1045 customizable responses</a></seealso>
1046 </directivesynopsis>
1049 <name>ErrorLog</name>
1050 <description>Location where the server will log errors</description>
1051 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1052 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1053 <contextlist><context>server config</context><context>virtual host</context>
1057 <p>The <directive>ErrorLog</directive> directive sets the name of
1058 the file to which the server will log any errors it encounters. If
1059 the <var>file-path</var> is not absolute then it is assumed to be
1060 relative to the <directive module="core">ServerRoot</directive>.</p>
1062 <example><title>Example</title>
1063 ErrorLog /var/log/httpd/error_log
1066 <p>If the <var>file-path</var>
1067 begins with a pipe (|) then it is assumed to be a command to spawn
1068 to handle the error log.</p>
1070 <example><title>Example</title>
1071 ErrorLog "|/usr/local/bin/httpd_errors"
1074 <p>Using <code>syslog</code> instead of a filename enables logging
1075 via syslogd(8) if the system supports it. The default is to use
1076 syslog facility <code>local7</code>, but you can override this by
1077 using the <code>syslog:<var>facility</var></code> syntax where
1078 <var>facility</var> can be one of the names usually documented in
1081 <example><title>Example</title>
1082 ErrorLog syslog:user
1085 <p>SECURITY: See the <a
1086 href="../misc/security_tips.html#serverroot">security tips</a>
1087 document for details on why your security could be compromised
1088 if the directory where log files are stored is writable by
1089 anyone other than the user that starts the server.</p>
1090 <note type="warning"><title>Note</title>
1091 <p>When entering a file path on non-Unix platforms, care should be taken
1092 to make sure that only forward slashed are used even though the platform
1093 may allow the use of back slashes. In general it is a good idea to always
1094 use forward slashes throughout the configuration files.</p>
1097 <seealso><directive module="core">LogLevel</directive></seealso>
1098 <seealso><a href="../logs.html">Apache Log Files</a></seealso>
1099 </directivesynopsis>
1102 <name>FileETag</name>
1103 <description>File attributes used to create the ETag
1104 HTTP response header</description>
1105 <syntax>FileETag <var>component</var> ...</syntax>
1106 <default>FileETag INode MTime Size</default>
1107 <contextlist><context>server config</context><context>virtual host</context>
1108 <context>directory</context><context>.htaccess</context>
1110 <override>FileInfo</override>
1114 The <directive>FileETag</directive> directive configures the file
1115 attributes that are used to create the <code>ETag</code> (entity
1116 tag) response header field when the document is based on a file.
1117 (The <code>ETag</code> value is used in cache management to save
1118 network bandwidth.) In Apache 1.3.22 and earlier, the
1119 <code>ETag</code> value was <em>always</em> formed
1120 from the file's inode, size, and last-modified time (mtime). The
1121 <directive>FileETag</directive> directive allows you to choose
1122 which of these -- if any -- should be used. The recognized keywords are:
1126 <dt><strong>INode</strong></dt>
1127 <dd>The file's i-node number will be included in the calculation</dd>
1128 <dt><strong>MTime</strong></dt>
1129 <dd>The date and time the file was last modified will be included</dd>
1130 <dt><strong>Size</strong></dt>
1131 <dd>The number of bytes in the file will be included</dd>
1132 <dt><strong>All</strong></dt>
1133 <dd>All available fields will be used. This is equivalent to:
1134 <example>FileETag INode MTime Size</example></dd>
1135 <dt><strong>None</strong></dt>
1136 <dd>If a document is file-based, no <code>ETag</code> field will be
1137 included in the response</dd>
1140 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1141 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1142 which allow changes to be made to the default setting inherited
1143 from a broader scope. Any keyword appearing without such a prefix
1144 immediately and completely cancels the inherited setting.</p>
1146 <p>If a directory's configuration includes
1147 <code>FileETag INode MTime Size</code>, and a
1148 subdirectory's includes <code>FileETag -INode</code>,
1149 the setting for that subdirectory (which will be inherited by
1150 any sub-subdirectories that don't override it) will be equivalent to
1151 <code>FileETag MTime Size</code>.</p>
1153 </directivesynopsis>
1155 <directivesynopsis type="section">
1157 <description>Contains directives that apply to matched
1158 filenames</description>
1159 <syntax><Files <var>filename</var>> ... </Files></syntax>
1160 <contextlist><context>server config</context><context>virtual host</context>
1161 <context>directory</context><context>.htaccess</context>
1163 <override>All</override>
1166 <p>The <directive type="section">Files</directive> directive
1167 limits the scope of the enclosed directives by filename. It is comparable
1168 to the <directive module="core" type="section">Directory</directive>
1169 and <directive module="core" type="section">Location</directive>
1170 directives. It should be matched with a <code></Files></code>
1171 directive. The directives given within this section will be applied to
1172 any object with a basename (last component of filename) matching the
1173 specified filename. <directive type="section">Files</directive>
1174 sections are processed in the order they appear in the
1175 configuration file, after the <directive module="core"
1176 type="section">Directory</directive> sections and
1177 <code>.htaccess</code> files are read, but before <directive
1178 type="section" module="core">Location</directive> sections. Note
1179 that <directive type="section">Files</directive> can be nested
1180 inside <directive type="section"
1181 module="core">Directory</directive> sections to restrict the
1182 portion of the filesystem they apply to.</p>
1184 <p>The <var>filename</var> argument should include a filename, or
1185 a wild-card string, where <code>?</code> matches any single character,
1186 and <code>*</code> matches any sequences of characters.
1187 <glossary ref="regex">Regular expressions</glossary>
1188 can also be used, with the addition of the
1189 <code>~</code> character. For example:</p>
1192 <Files ~ "\.(gif|jpe?g|png)$">
1195 <p>would match most common Internet graphics formats. <directive
1196 module="core" type="section">FilesMatch</directive> is preferred,
1199 <p>Note that unlike <directive type="section"
1200 module="core">Directory</directive> and <directive type="section"
1201 module="core">Location</directive> sections, <directive
1202 type="section">Files</directive> sections can be used inside
1203 <code>.htaccess</code> files. This allows users to control access to
1204 their own files, at a file-by-file level.</p>
1207 <seealso><a href="../sections.html">How <Directory>, <Location>
1208 and <Files> sections work</a> for an explanation of how these
1209 different sections are combined when a request is received</seealso>
1210 </directivesynopsis>
1212 <directivesynopsis type="section">
1213 <name>FilesMatch</name>
1214 <description>Contains directives that apply to regular-expression matched
1215 filenames</description>
1216 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1217 <contextlist><context>server config</context><context>virtual host</context>
1218 <context>directory</context><context>.htaccess</context>
1220 <override>All</override>
1223 <p>The <directive type="section">FilesMatch</directive> directive
1224 limits the scope of the enclosed directives by filename, just as the
1225 <directive module="core" type="section">Files</directive> directive
1226 does. However, it accepts a <glossary ref="regex">regular
1227 expression</glossary>. For example:</p>
1230 <FilesMatch "\.(gif|jpe?g|png)$">
1233 <p>would match most common Internet graphics formats.</p>
1236 <seealso><a href="../sections.html">How <Directory>, <Location>
1237 and <Files> sections work</a> for an explanation of how these
1238 different sections are combined when a request is received</seealso>
1239 </directivesynopsis>
1242 <name>ForceType</name>
1243 <description>Forces all matching files to be served with the specified
1244 MIME content-type</description>
1245 <syntax>ForceType <var>MIME-type</var>|None</syntax>
1246 <contextlist><context>directory</context><context>.htaccess</context>
1248 <override>FileInfo</override>
1249 <compatibility>Moved to the core in Apache 2.0</compatibility>
1252 <p>When placed into an <code>.htaccess</code> file or a
1253 <directive type="section" module="core">Directory</directive>, or
1254 <directive type="section" module="core">Location</directive> or
1255 <directive type="section" module="core">Files</directive>
1256 section, this directive forces all matching files to be served
1257 with the content type identification given by
1258 <var>MIME-type</var>. For example, if you had a directory full of
1259 GIF files, but did not want to label them all with <code>.gif</code>,
1260 you might want to use:</p>
1266 <p>Note that unlike <directive module="core">DefaultType</directive>,
1267 this directive overrides all mime-type associations, including
1268 filename extensions, that might identify the media type.</p>
1270 <p>You can override any <directive>ForceType</directive> setting
1271 by using the value of <code>None</code>:</p>
1274 # force all files to be image/gif:<br />
1275 <Location /images><br />
1277 ForceType image/gif<br />
1279 </Location><br />
1281 # but normal mime-type associations here:<br />
1282 <Location /images/mixed><br />
1284 ForceType None<br />
1289 </directivesynopsis>
1292 <name>HostnameLookups</name>
1293 <description>Enables DNS lookups on client IP addresses</description>
1294 <syntax>HostnameLookups On|Off|Double</syntax>
1295 <default>HostnameLookups Off</default>
1296 <contextlist><context>server config</context><context>virtual host</context>
1297 <context>directory</context></contextlist>
1300 <p>This directive enables DNS lookups so that host names can be
1301 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1302 The value <code>Double</code> refers to doing double-reverse
1303 DNS lookup. That is, after a reverse lookup is performed, a forward
1304 lookup is then performed on that result. At least one of the IP
1305 addresses in the forward lookup must match the original
1306 address. (In "tcpwrappers" terminology this is called
1307 <code>PARANOID</code>.)</p>
1309 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1310 used for controlling access by hostname, a double reverse lookup
1311 will be performed. This is necessary for security. Note that the
1312 result of this double-reverse isn't generally available unless you
1313 set <code>HostnameLookups Double</code>. For example, if only
1314 <code>HostnameLookups On</code> and a request is made to an object
1315 that is protected by hostname restrictions, regardless of whether
1316 the double-reverse fails or not, CGIs will still be passed the
1317 single-reverse result in <code>REMOTE_HOST</code>.</p>
1319 <p>The default is <code>Off</code> in order to save the network
1320 traffic for those sites that don't truly need the reverse
1321 lookups done. It is also better for the end users because they
1322 don't have to suffer the extra latency that a lookup entails.
1323 Heavily loaded sites should leave this directive
1324 <code>Off</code>, since DNS lookups can take considerable
1325 amounts of time. The utility <program>logresolve</program>, compiled by
1326 default to the <code>bin</code> subdirectory of your installation
1327 directory, can be used to look up host names from logged IP addresses
1330 </directivesynopsis>
1332 <directivesynopsis type="section">
1333 <name>IfDefine</name>
1334 <description>Encloses directives that will be processed only
1335 if a test is true at startup</description>
1336 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1337 </IfDefine></syntax>
1338 <contextlist><context>server config</context><context>virtual host</context>
1339 <context>directory</context><context>.htaccess</context>
1341 <override>All</override>
1344 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1345 </code> section is used to mark directives that are conditional. The
1346 directives within an <directive type="section">IfDefine</directive>
1347 section are only processed if the <var>test</var> is true. If <var>
1348 test</var> is false, everything between the start and end markers is
1351 <p>The <var>test</var> in the <directive type="section"
1352 >IfDefine</directive> section directive can be one of two forms:</p>
1355 <li><var>parameter-name</var></li>
1357 <li><code>!</code><var>parameter-name</var></li>
1360 <p>In the former case, the directives between the start and end
1361 markers are only processed if the parameter named
1362 <var>parameter-name</var> is defined. The second format reverses
1363 the test, and only processes the directives if
1364 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1366 <p>The <var>parameter-name</var> argument is a define as given on
1367 the <program>httpd</program> command line via <code>-D<var>parameter-</var>
1368 </code>, at the time the server was started.</p>
1370 <p><directive type="section">IfDefine</directive> sections are
1371 nest-able, which can be used to implement simple
1372 multiple-parameter tests. Example:</p>
1375 httpd -DReverseProxy ...<br />
1378 <IfDefine ReverseProxy><br />
1380 LoadModule rewrite_module modules/mod_rewrite.so<br />
1381 LoadModule proxy_module modules/libproxy.so<br />
1386 </directivesynopsis>
1388 <directivesynopsis type="section">
1389 <name>IfModule</name>
1390 <description>Encloses directives that are processed conditional on the
1391 presence or absence of a specific module</description>
1392 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1393 </IfModule></syntax>
1394 <contextlist><context>server config</context><context>virtual host</context>
1395 <context>directory</context><context>.htaccess</context>
1397 <override>All</override>
1398 <compatibility>Module identifiers are available in version 2.1 and
1399 later.</compatibility>
1402 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1403 section is used to mark directives that are conditional on the presence of
1404 a specific module. The directives within an <directive type="section"
1405 >IfModule</directive> section are only processed if the <var>test</var>
1406 is true. If <var>test</var> is false, everything between the start and
1407 end markers is ignored.</p>
1409 <p>The <var>test</var> in the <directive type="section"
1410 >IfModule</directive> section directive can be one of two forms:</p>
1413 <li><var>module</var></li>
1415 <li>!<var>module</var></li>
1418 <p>In the former case, the directives between the start and end
1419 markers are only processed if the module named <var>module</var>
1420 is included in Apache -- either compiled in or
1421 dynamically loaded using <directive module="mod_so"
1422 >LoadModule</directive>. The second format reverses the test,
1423 and only processes the directives if <var>module</var> is
1424 <strong>not</strong> included.</p>
1426 <p>The <var>module</var> argument can be either the module identifier or
1427 the file name of the module, at the time it was compiled. For example,
1428 <code>rewrite_module</code> is the identifier and
1429 <code>mod_rewrite.c</code> is the file name. If a module consists of
1430 several source files, use the name of the file containing the string
1431 <code>STANDARD20_MODULE_STUFF</code>.</p>
1433 <p><directive type="section">IfModule</directive> sections are
1434 nest-able, which can be used to implement simple multiple-module
1437 <note>This section should only be used if you need to have one
1438 configuration file that works whether or not a specific module
1439 is available. In normal operation, directives need not be
1440 placed in <directive type="section">IfModule</directive>
1443 </directivesynopsis>
1446 <name>Include</name>
1447 <description>Includes other configuration files from within
1448 the server configuration files</description>
1449 <syntax>Include <var>file-path</var>|<var>directory-path</var></syntax>
1450 <contextlist><context>server config</context><context>virtual host</context>
1451 <context>directory</context>
1453 <compatibility>Wildcard matching available in 2.0.41 and later</compatibility>
1456 <p>This directive allows inclusion of other configuration files
1457 from within the server configuration files.</p>
1459 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1460 include several files at once, in alphabetical order. In
1461 addition, if <directive>Include</directive> points to a directory,
1462 rather than a file, Apache will read all files in that directory
1463 and any subdirectory. But including entire directories is not
1464 recommended, because it is easy to accidentally leave temporary
1465 files in a directory that can cause <program>httpd</program> to
1468 <p>The file path specified may be an absolute path, or may be relative
1469 to the <directive module="core">ServerRoot</directive> directory.</p>
1474 Include /usr/local/apache2/conf/ssl.conf<br />
1475 Include /usr/local/apache2/conf/vhosts/*.conf
1478 <p>Or, providing paths relative to your <directive
1479 module="core">ServerRoot</directive> directory:</p>
1482 Include conf/ssl.conf<br />
1483 Include conf/vhosts/*.conf
1486 <p>Running <code>apachectl configtest</code> will give you a list
1487 of the files that are being processed during the configuration
1491 root@host# apachectl configtest<br />
1492 Processing config file: /usr/local/apache2/conf/ssl.conf<br />
1493 Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf<br />
1494 Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf<br />
1499 <seealso><program>apachectl</program></seealso>
1500 </directivesynopsis>
1503 <name>KeepAlive</name>
1504 <description>Enables HTTP persistent connections</description>
1505 <syntax>KeepAlive On|Off</syntax>
1506 <default>KeepAlive On</default>
1507 <contextlist><context>server config</context><context>virtual host</context>
1511 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1512 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1513 which allow multiple requests to be sent over the same TCP
1514 connection. In some cases this has been shown to result in an
1515 almost 50% speedup in latency times for HTML documents with
1516 many images. To enable Keep-Alive connections, set
1517 <code>KeepAlive On</code>.</p>
1519 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1520 used if they are specifically requested by a client. In
1521 addition, a Keep-Alive connection with an HTTP/1.0 client can
1522 only be used when the length of the content is known in
1523 advance. This implies that dynamic content such as CGI output,
1524 SSI pages, and server-generated directory listings will
1525 generally not use Keep-Alive connections to HTTP/1.0 clients.
1526 For HTTP/1.1 clients, persistent connections are the default
1527 unless otherwise specified. If the client requests it, chunked
1528 encoding will be used in order to send content of unknown
1529 length over persistent connections.</p>
1532 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1533 </directivesynopsis>
1536 <name>KeepAliveTimeout</name>
1537 <description>Amount of time the server will wait for subsequent
1538 requests on a persistent connection</description>
1539 <syntax>KeepAliveTimeout <var>seconds</var></syntax>
1540 <default>KeepAliveTimeout 5</default>
1541 <contextlist><context>server config</context><context>virtual host</context>
1545 <p>The number of seconds Apache will wait for a subsequent
1546 request before closing the connection. Once a request has been
1547 received, the timeout value specified by the
1548 <directive module="core">Timeout</directive> directive applies.</p>
1550 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1551 may cause performance problems in heavily loaded servers. The
1552 higher the timeout, the more server processes will be kept
1553 occupied waiting on connections with idle clients.</p>
1555 </directivesynopsis>
1557 <directivesynopsis type="section">
1559 <description>Restrict enclosed access controls to only certain HTTP
1560 methods</description>
1561 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1562 </Limit></syntax>
1563 <contextlist><context>server config</context><context>virtual host</context>
1564 <context>directory</context><context>.htaccess</context>
1566 <override>All</override>
1569 <p>Access controls are normally effective for
1570 <strong>all</strong> access methods, and this is the usual
1571 desired behavior. <strong>In the general case, access control
1572 directives should not be placed within a
1573 <directive type="section">Limit</directive> section.</strong></p>
1575 <p>The purpose of the <directive type="section">Limit</directive>
1576 directive is to restrict the effect of the access controls to the
1577 nominated HTTP methods. For all other methods, the access
1578 restrictions that are enclosed in the <directive
1579 type="section">Limit</directive> bracket <strong>will have no
1580 effect</strong>. The following example applies the access control
1581 only to the methods <code>POST</code>, <code>PUT</code>, and
1582 <code>DELETE</code>, leaving all other methods unprotected:</p>
1585 <Limit POST PUT DELETE><br />
1587 Require valid-user<br />
1592 <p>The method names listed can be one or more of: <code>GET</code>,
1593 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1594 <code>CONNECT</code>, <code>OPTIONS</code>,
1595 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1596 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1597 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1598 case-sensitive.</strong> If <code>GET</code> is used it will also
1599 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1600 cannot be limited.</p>
1602 <note type="warning">A <directive type="section"
1603 module="core">LimitExcept</directive> section should always be
1604 used in preference to a <directive type="section"
1605 module="core">Limit</directive> section when restricting access,
1606 since a <directive type="section"
1607 module="core">LimitExcept</directive> section provides protection
1608 against arbitrary methods.</note>
1611 </directivesynopsis>
1613 <directivesynopsis type="section">
1614 <name>LimitExcept</name>
1615 <description>Restrict access controls to all HTTP methods
1616 except the named ones</description>
1617 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1618 </LimitExcept></syntax>
1619 <contextlist><context>server config</context><context>virtual host</context>
1620 <context>directory</context><context>.htaccess</context>
1622 <override>All</override>
1625 <p><directive type="section">LimitExcept</directive> and
1626 <code></LimitExcept></code> are used to enclose
1627 a group of access control directives which will then apply to any
1628 HTTP access method <strong>not</strong> listed in the arguments;
1629 i.e., it is the opposite of a <directive type="section"
1630 module="core">Limit</directive> section and can be used to control
1631 both standard and nonstandard/unrecognized methods. See the
1632 documentation for <directive module="core"
1633 type="section">Limit</directive> for more details.</p>
1638 <LimitExcept POST GET><br />
1640 Require valid-user<br />
1642 </LimitExcept>
1646 </directivesynopsis>
1649 <name>LimitInternalRecursion</name>
1650 <description>Determine maximum number of internal redirects and nested
1651 subrequests</description>
1652 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
1653 <default>LimitInternalRecursion 10</default>
1654 <contextlist><context>server config</context><context>virtual host</context>
1656 <compatibility>Available in Apache 2.0.47 and later</compatibility>
1659 <p>An internal redirect happens, for example, when using the <directive
1660 module="mod_actions">Action</directive> directive, which internally
1661 redirects the original request to a CGI script. A subrequest is Apache's
1662 mechanism to find out what would happen for some URI if it were requested.
1663 For example, <module>mod_dir</module> uses subrequests to look for the
1664 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
1667 <p><directive>LimitInternalRecursion</directive> prevents the server
1668 from crashing when entering an infinite loop of internal redirects or
1669 subrequests. Such loops are usually caused by misconfigurations.</p>
1671 <p>The directive stores two different limits, which are evaluated on
1672 per-request basis. The first <var>number</var> is the maximum number of
1673 internal redirects, that may follow each other. The second <var>number</var>
1674 determines, how deep subrequests may be nested. If you specify only one
1675 <var>number</var>, it will be assigned to both limits.</p>
1677 <example><title>Example</title>
1678 LimitInternalRecursion 5
1681 </directivesynopsis>
1684 <name>LimitRequestBody</name>
1685 <description>Restricts the total size of the HTTP request body sent
1686 from the client</description>
1687 <syntax>LimitRequestBody <var>bytes</var></syntax>
1688 <default>LimitRequestBody 0</default>
1689 <contextlist><context>server config</context><context>virtual host</context>
1690 <context>directory</context><context>.htaccess</context>
1692 <override>All</override>
1695 <p>This directive specifies the number of <var>bytes</var> from 0
1696 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1699 <p>The <directive>LimitRequestBody</directive> directive allows
1700 the user to set a limit on the allowed size of an HTTP request
1701 message body within the context in which the directive is given
1702 (server, per-directory, per-file or per-location). If the client
1703 request exceeds that limit, the server will return an error
1704 response instead of servicing the request. The size of a normal
1705 request message body will vary greatly depending on the nature of
1706 the resource and the methods allowed on that resource. CGI scripts
1707 typically use the message body for retrieving form information.
1708 Implementations of the <code>PUT</code> method will require
1709 a value at least as large as any representation that the server
1710 wishes to accept for that resource.</p>
1712 <p>This directive gives the server administrator greater
1713 control over abnormal client request behavior, which may be
1714 useful for avoiding some forms of denial-of-service
1717 <p>If, for example, you are permitting file upload to a particular
1718 location, and wish to limit the size of the uploaded file to 100K,
1719 you might use the following directive:</p>
1722 LimitRequestBody 102400
1726 </directivesynopsis>
1729 <name>LimitRequestFields</name>
1730 <description>Limits the number of HTTP request header fields that
1731 will be accepted from the client</description>
1732 <syntax>LimitRequestFields <var>number</var></syntax>
1733 <default>LimitRequestFields 100</default>
1734 <contextlist><context>server config</context></contextlist>
1737 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1738 32767. The default value is defined by the compile-time
1739 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1742 <p>The <directive>LimitRequestFields</directive> directive allows
1743 the server administrator to modify the limit on the number of
1744 request header fields allowed in an HTTP request. A server needs
1745 this value to be larger than the number of fields that a normal
1746 client request might include. The number of request header fields
1747 used by a client rarely exceeds 20, but this may vary among
1748 different client implementations, often depending upon the extent
1749 to which a user has configured their browser to support detailed
1750 content negotiation. Optional HTTP extensions are often expressed
1751 using request header fields.</p>
1753 <p>This directive gives the server administrator greater
1754 control over abnormal client request behavior, which may be
1755 useful for avoiding some forms of denial-of-service attacks.
1756 The value should be increased if normal clients see an error
1757 response from the server that indicates too many fields were
1758 sent in the request.</p>
1763 LimitRequestFields 50
1767 </directivesynopsis>
1770 <name>LimitRequestFieldSize</name>
1771 <description>Limits the size of the HTTP request header allowed from the
1772 client</description>
1773 <syntax>LimitRequestFieldsize <var>bytes</var></syntax>
1774 <default>LimitRequestFieldsize 8190</default>
1775 <contextlist><context>server config</context></contextlist>
1778 <p>This directive specifies the number of <var>bytes</var>
1779 that will be allowed in an HTTP request header.</p>
1781 <p>The <directive>LimitRequestFieldSize</directive> directive
1782 allows the server administrator to reduce or increase the limit
1783 on the allowed size of an HTTP request header field. A server
1784 needs this value to be large enough to hold any one header field
1785 from a normal client request. The size of a normal request header
1786 field will vary greatly among different client implementations,
1787 often depending upon the extent to which a user has configured
1788 their browser to support detailed content negotiation. SPNEGO
1789 authentication headers can be up to 12392 bytes.</p>
1791 <p>This directive gives the server administrator greater
1792 control over abnormal client request behavior, which may be
1793 useful for avoiding some forms of denial-of-service attacks.</p>
1798 LimitRequestFieldSize 4094
1801 <note>Under normal conditions, the value should not be changed from
1805 </directivesynopsis>
1808 <name>LimitRequestLine</name>
1809 <description>Limit the size of the HTTP request line that will be accepted
1810 from the client</description>
1811 <syntax>LimitRequestLine <var>bytes</var></syntax>
1812 <default>LimitRequestLine 8190</default>
1813 <contextlist><context>server config</context></contextlist>
1816 <p>This directive sets the number of <var>bytes</var> that will be
1817 allowed on the HTTP request-line.</p>
1819 <p>The <directive>LimitRequestLine</directive> directive allows
1820 the server administrator to reduce or increase the limit on the allowed size
1821 of a client's HTTP request-line. Since the request-line consists of the
1822 HTTP method, URI, and protocol version, the
1823 <directive>LimitRequestLine</directive> directive places a
1824 restriction on the length of a request-URI allowed for a request
1825 on the server. A server needs this value to be large enough to
1826 hold any of its resource names, including any information that
1827 might be passed in the query part of a <code>GET</code> request.</p>
1829 <p>This directive gives the server administrator greater
1830 control over abnormal client request behavior, which may be
1831 useful for avoiding some forms of denial-of-service attacks.</p>
1836 LimitRequestLine 4094
1839 <note>Under normal conditions, the value should not be changed from
1842 </directivesynopsis>
1845 <name>LimitXMLRequestBody</name>
1846 <description>Limits the size of an XML-based request body</description>
1847 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
1848 <default>LimitXMLRequestBody 1000000</default>
1849 <contextlist><context>server config</context><context>virtual host</context>
1850 <context>directory</context><context>.htaccess</context></contextlist>
1851 <override>All</override>
1854 <p>Limit (in bytes) on maximum size of an XML-based request
1855 body. A value of <code>0</code> will disable any checking.</p>
1860 LimitXMLRequestBody 0
1864 </directivesynopsis>
1866 <directivesynopsis type="section">
1867 <name>Location</name>
1868 <description>Applies the enclosed directives only to matching
1870 <syntax><Location
1871 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
1872 <contextlist><context>server config</context><context>virtual host</context>
1876 <p>The <directive type="section">Location</directive> directive
1877 limits the scope of the enclosed directives by URL. It is similar to the
1878 <directive type="section" module="core">Directory</directive>
1879 directive, and starts a subsection which is terminated with a
1880 <code></Location></code> directive. <directive
1881 type="section">Location</directive> sections are processed in the
1882 order they appear in the configuration file, after the <directive
1883 type="section" module="core">Directory</directive> sections and
1884 <code>.htaccess</code> files are read, and after the <directive
1885 type="section" module="core">Files</directive> sections.</p>
1887 <p><directive type="section">Location</directive> sections operate
1888 completely outside the filesystem. This has several consequences.
1889 Most importantly, <directive type="section">Location</directive>
1890 directives should not be used to control access to filesystem
1891 locations. Since several different URLs may map to the same
1892 filesystem location, such access controls may by circumvented.</p>
1894 <note><title>When to use <directive
1895 type="section">Location</directive></title>
1897 <p>Use <directive type="section">Location</directive> to apply
1898 directives to content that lives outside the filesystem. For
1899 content that lives in the filesystem, use <directive
1900 type="section" module="core">Directory</directive> and <directive
1901 type="section" module="core">Files</directive>. An exception is
1902 <code><Location /></code>, which is an easy way to
1903 apply a configuration to the entire server.</p>
1906 <p>For all origin (non-proxy) requests, the URL to be matched is a
1907 URL-path of the form <code>/path/</code>. No scheme, hostname,
1908 port, or query string may be included. For proxy requests, the
1909 URL to be matched is of the form
1910 <code>scheme://servername/path</code>, and you must include the
1913 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1914 any single character, and <code>*</code> matches any sequences of
1917 <p><glossary ref="regex">Regular expressions</glossary>
1918 can also be used, with the addition of the
1919 <code>~</code> character. For example:</p>
1922 <Location ~ "/(extra|special)/data">
1925 <p>would match URLs that contained the substring <code>/extra/data</code>
1926 or <code>/special/data</code>. The directive <directive
1927 type="section" module="core">LocationMatch</directive> behaves
1928 identical to the regex version of <directive
1929 type="section">Location</directive>.</p>
1931 <p>The <directive type="section">Location</directive>
1932 functionality is especially useful when combined with the
1933 <directive module="core">SetHandler</directive>
1934 directive. For example, to enable status requests, but allow them
1935 only from browsers at <code>foo.com</code>, you might use:</p>
1938 <Location /status><br />
1940 SetHandler server-status<br />
1941 Order Deny,Allow<br />
1943 Allow from .foo.com<br />
1948 <note><title>Note about / (slash)</title>
1949 <p>The slash character has special meaning depending on where in a
1950 URL it appears. People may be used to its behavior in the filesystem
1951 where multiple adjacent slashes are frequently collapsed to a single
1952 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
1953 <code>/home/foo</code>). In URL-space this is not necessarily true.
1954 The <directive type="section" module="core">LocationMatch</directive>
1955 directive and the regex version of <directive type="section"
1956 >Location</directive> require you to explicitly specify multiple
1957 slashes if that is your intention.</p>
1959 <p>For example, <code><LocationMatch ^/abc></code> would match
1960 the request URL <code>/abc</code> but not the request URL <code>
1961 //abc</code>. The (non-regex) <directive type="section"
1962 >Location</directive> directive behaves similarly when used for
1963 proxy requests. But when (non-regex) <directive type="section"
1964 >Location</directive> is used for non-proxy requests it will
1965 implicitly match multiple slashes with a single slash. For example,
1966 if you specify <code><Location /abc/def></code> and the
1967 request is to <code>/abc//def</code> then it will match.</p>
1970 <seealso><a href="../sections.html">How <Directory>, <Location>
1971 and <Files> sections work</a> for an explanation of how these
1972 different sections are combined when a request is received</seealso>
1973 </directivesynopsis>
1975 <directivesynopsis type="section">
1976 <name>LocationMatch</name>
1977 <description>Applies the enclosed directives only to regular-expression
1978 matching URLs</description>
1979 <syntax><LocationMatch
1980 <var>regex</var>> ... </LocationMatch></syntax>
1981 <contextlist><context>server config</context><context>virtual host</context>
1985 <p>The <directive type="section">LocationMatch</directive> directive
1986 limits the scope of the enclosed directives by URL, in an identical manner
1987 to <directive module="core" type="section">Location</directive>. However,
1988 it takes a <glossary ref="regex">regular expression</glossary>
1989 as an argument instead of a simple string. For example:</p>
1992 <LocationMatch "/(extra|special)/data">
1995 <p>would match URLs that contained the substring <code>/extra/data</code>
1996 or <code>/special/data</code>.</p>
1999 <seealso><a href="../sections.html">How <Directory>, <Location>
2000 and <Files> sections work</a> for an explanation of how these
2001 different sections are combined when a request is received</seealso>
2002 </directivesynopsis>
2005 <name>LogLevel</name>
2006 <description>Controls the verbosity of the ErrorLog</description>
2007 <syntax>LogLevel <var>level</var></syntax>
2008 <default>LogLevel warn</default>
2009 <contextlist><context>server config</context><context>virtual host</context>
2013 <p><directive>LogLevel</directive> adjusts the verbosity of the
2014 messages recorded in the error logs (see <directive
2015 module="core">ErrorLog</directive> directive). The following
2016 <var>level</var>s are available, in order of decreasing
2020 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2023 <th><strong>Level</strong> </th>
2025 <th><strong>Description</strong> </th>
2027 <th><strong>Example</strong> </th>
2031 <td><code>emerg</code> </td>
2033 <td>Emergencies - system is unusable.</td>
2035 <td>"Child cannot open lock file. Exiting"</td>
2039 <td><code>alert</code> </td>
2041 <td>Action must be taken immediately.</td>
2043 <td>"getpwuid: couldn't determine user name from uid"</td>
2047 <td><code>crit</code> </td>
2049 <td>Critical Conditions.</td>
2051 <td>"socket: Failed to get a socket, exiting child"</td>
2055 <td><code>error</code> </td>
2057 <td>Error conditions.</td>
2059 <td>"Premature end of script headers"</td>
2063 <td><code>warn</code> </td>
2065 <td>Warning conditions.</td>
2067 <td>"child process 1234 did not exit, sending another
2072 <td><code>notice</code> </td>
2074 <td>Normal but significant condition.</td>
2076 <td>"httpd: caught SIGBUS, attempting to dump core in
2081 <td><code>info</code> </td>
2083 <td>Informational.</td>
2085 <td>"Server seems busy, (you may need to increase
2086 StartServers, or Min/MaxSpareServers)..."</td>
2090 <td><code>debug</code> </td>
2092 <td>Debug-level messages</td>
2094 <td>"Opening config file ..."</td>
2098 <p>When a particular level is specified, messages from all
2099 other levels of higher significance will be reported as well.
2100 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2101 then messages with log levels of <code>notice</code> and
2102 <code>warn</code> will also be posted.</p>
2104 <p>Using a level of at least <code>crit</code> is
2113 <note><title>Note</title>
2114 <p>When logging to a regular file messages of the level
2115 <code>notice</code> cannot be suppressed and thus are always
2116 logged. However, this doesn't apply when logging is done
2117 using <code>syslog</code>.</p>
2120 </directivesynopsis>
2123 <name>MaxKeepAliveRequests</name>
2124 <description>Number of requests allowed on a persistent
2125 connection</description>
2126 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2127 <default>MaxKeepAliveRequests 100</default>
2128 <contextlist><context>server config</context><context>virtual host</context>
2132 <p>The <directive>MaxKeepAliveRequests</directive> directive
2133 limits the number of requests allowed per connection when
2134 <directive module="core" >KeepAlive</directive> is on. If it is
2135 set to <code>0</code>, unlimited requests will be allowed. We
2136 recommend that this setting be kept to a high value for maximum
2137 server performance.</p>
2142 MaxKeepAliveRequests 500
2145 </directivesynopsis>
2148 <name>NameVirtualHost</name>
2149 <description>Designates an IP address for name-virtual
2150 hosting</description>
2151 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2152 <contextlist><context>server config</context></contextlist>
2155 <p>The <directive>NameVirtualHost</directive> directive is a
2156 required directive if you want to configure <a
2157 href="../vhosts/">name-based virtual hosts</a>.</p>
2159 <p>Although <var>addr</var> can be hostname it is recommended
2160 that you always use an IP address, e.g.</p>
2163 NameVirtualHost 111.22.33.44
2166 <p>With the <directive>NameVirtualHost</directive> directive you
2167 specify the IP address on which the server will receive requests
2168 for the name-based virtual hosts. This will usually be the address
2169 to which your name-based virtual host names resolve. In cases
2170 where a firewall or other proxy receives the requests and forwards
2171 them on a different IP address to the server, you must specify the
2172 IP address of the physical interface on the machine which will be
2173 servicing the requests. If you have multiple name-based hosts on
2174 multiple addresses, repeat the directive for each address.</p>
2176 <note><title>Note</title>
2177 <p>Note, that the "main server" and any <code>_default_</code> servers
2178 will <strong>never</strong> be served for a request to a
2179 <directive>NameVirtualHost</directive> IP address (unless for some
2180 reason you specify <directive>NameVirtualHost</directive> but then
2181 don't define any <directive>VirtualHost</directive>s for that
2185 <p>Optionally you can specify a port number on which the
2186 name-based virtual hosts should be used, e.g.</p>
2189 NameVirtualHost 111.22.33.44:8080
2192 <p>IPv6 addresses must be enclosed in square brackets, as shown
2193 in the following example:</p>
2196 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2199 <p>To receive requests on all interfaces, you can use an argument of
2206 <note><title>Argument to <directive type="section">VirtualHost</directive>
2208 <p>Note that the argument to the <directive
2209 type="section">VirtualHost</directive> directive must
2210 exactly match the argument to the <directive
2211 >NameVirtualHost</directive> directive.</p>
2214 NameVirtualHost 1.2.3.4<br />
2215 <VirtualHost 1.2.3.4><br />
2217 </VirtualHost><br />
2222 <seealso><a href="../vhosts/">Virtual Hosts
2223 documentation</a></seealso>
2225 </directivesynopsis>
2228 <name>Options</name>
2229 <description>Configures what features are available in a particular
2230 directory</description>
2232 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2233 <default>Options All</default>
2234 <contextlist><context>server config</context><context>virtual host</context>
2235 <context>directory</context><context>.htaccess</context>
2237 <override>Options</override>
2240 <p>The <directive>Options</directive> directive controls which
2241 server features are available in a particular directory.</p>
2243 <p><var>option</var> can be set to <code>None</code>, in which
2244 case none of the extra features are enabled, or one or more of
2248 <dt><code>All</code></dt>
2250 <dd>All options except for <code>MultiViews</code>. This is the default
2253 <dt><code>ExecCGI</code></dt>
2256 Execution of CGI scripts using <module>mod_cgi</module>
2259 <dt><code>FollowSymLinks</code></dt>
2263 The server will follow symbolic links in this directory.
2265 <p>Even though the server follows the symlink it does <em>not</em>
2266 change the pathname used to match against <directive type="section"
2267 module="core">Directory</directive> sections.</p>
2268 <p>Note also, that this option <strong>gets ignored</strong> if set
2269 inside a <directive type="section" module="core">Location</directive>
2273 <dt><code>Includes</code></dt>
2276 Server-side includes provided by <module>mod_include</module>
2279 <dt><code>IncludesNOEXEC</code></dt>
2283 Server-side includes are permitted, but the <code>#exec
2284 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2285 possible to <code>#include virtual</code> CGI scripts from
2286 <directive module="mod_alias">ScriptAlias</directive>ed
2289 <dt><code>Indexes</code></dt>
2292 If a URL which maps to a directory is requested, and there
2293 is no <directive module="mod_dir">DirectoryIndex</directive>
2294 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2295 <module>mod_autoindex</module> will return a formatted listing
2296 of the directory.</dd>
2298 <dt><code>MultiViews</code></dt>
2301 <a href="../content-negotiation.html">Content negotiated</a>
2302 "MultiViews" are allowed using
2303 <module>mod_negotiation</module>.</dd>
2305 <dt><code>SymLinksIfOwnerMatch</code></dt>
2307 <dd>The server will only follow symbolic links for which the
2308 target file or directory is owned by the same user id as the
2311 <note><title>Note</title> This option gets ignored if
2312 set inside a <directive module="core"
2313 type="section">Location</directive> section.</note>
2317 <p>Normally, if multiple <directive>Options</directive> could
2318 apply to a directory, then the most specific one is used and
2319 others are ignored; the options are not merged. (See <a
2320 href="../sections.html#mergin">how sections are merged</a>.)
2321 However if <em>all</em> the options on the
2322 <directive>Options</directive> directive are preceded by a
2323 <code>+</code> or <code>-</code> symbol, the options are
2324 merged. Any options preceded by a <code>+</code> are added to the
2325 options currently in force, and any options preceded by a
2326 <code>-</code> are removed from the options currently in
2329 <note type="warning"><title>Warning</title>
2330 <p>Mixing <directive>Options</directive> with a <code>+</code> or
2331 <code>-</code> with those without is not valid syntax, and is likely
2332 to cause unexpected results.</p>
2335 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2338 <Directory /web/docs><br />
2340 Options Indexes FollowSymLinks<br />
2342 </Directory><br />
2344 <Directory /web/docs/spec><br />
2346 Options Includes<br />
2351 <p>then only <code>Includes</code> will be set for the
2352 <code>/web/docs/spec</code> directory. However if the second
2353 <directive>Options</directive> directive uses the <code>+</code> and
2354 <code>-</code> symbols:</p>
2357 <Directory /web/docs><br />
2359 Options Indexes FollowSymLinks<br />
2361 </Directory><br />
2363 <Directory /web/docs/spec><br />
2365 Options +Includes -Indexes<br />
2370 <p>then the options <code>FollowSymLinks</code> and
2371 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2374 <note><title>Note</title>
2375 <p>Using <code>-IncludesNOEXEC</code> or
2376 <code>-Includes</code> disables server-side includes completely
2377 regardless of the previous setting.</p>
2380 <p>The default in the absence of any other settings is
2381 <code>All</code>.</p>
2383 </directivesynopsis>
2386 <name>Require</name>
2387 <description>Selects which authenticated users can access
2388 a resource</description>
2389 <syntax>Require <var>entity-name</var> [<var>entity-name</var>] ...</syntax>
2390 <contextlist><context>directory</context><context>.htaccess</context>
2392 <override>AuthConfig</override>
2395 <p>This directive selects which authenticated users can access
2396 a resource. The allowed syntaxes are:</p>
2399 <dt><code>Require user <var>userid</var> [<var>userid</var>]
2401 <dd>Only the named users can access the resource.</dd>
2403 <dt><code>Require group <var>group-name</var> [<var>group-name</var>]
2405 <dd>Only users in the named groups can access the resource.</dd>
2407 <dt><code>Require valid-user</code></dt>
2408 <dd>All valid users can access the resource.</dd>
2411 <p><directive>Require</directive> must be accompanied by
2412 <directive module="core">AuthName</directive> and <directive
2413 module="core">AuthType</directive> directives, and directives such
2414 as <directive module="mod_authn_file">AuthUserFile</directive>
2415 and <directive module="mod_authz_groupfile">AuthGroupFile</directive> (to
2416 define users and groups) in order to work correctly. Example:</p>
2419 AuthType Basic<br />
2420 AuthName "Restricted Resource"<br />
2421 AuthUserFile /web/users<br />
2422 AuthGroupFile /web/groups<br />
2426 <p>Access controls which are applied in this way are effective for
2427 <strong>all</strong> methods. <strong>This is what is normally
2428 desired.</strong> If you wish to apply access controls only to
2429 specific methods, while leaving other methods unprotected, then
2430 place the <directive>Require</directive> statement into a
2431 <directive module="core" type="section">Limit</directive>
2434 <seealso><directive module="core">Satisfy</directive></seealso>
2435 <seealso><module>mod_authz_host</module></seealso>
2436 </directivesynopsis>
2439 <name>RLimitCPU</name>
2440 <description>Limits the CPU consumption of processes launched
2441 by Apache children</description>
2442 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
2443 <default>Unset; uses operating system defaults</default>
2444 <contextlist><context>server config</context><context>virtual host</context>
2445 <context>directory</context><context>.htaccess</context></contextlist>
2446 <override>All</override>
2449 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2450 resource limit for all processes and the second parameter sets
2451 the maximum resource limit. Either parameter can be a number,
2452 or <code>max</code> to indicate to the server that the limit should
2453 be set to the maximum allowed by the operating system
2454 configuration. Raising the maximum resource limit requires that
2455 the server is running as <code>root</code>, or in the initial startup
2458 <p>This applies to processes forked off from Apache children
2459 servicing requests, not the Apache children themselves. This
2460 includes CGI scripts and SSI exec commands, but not any
2461 processes forked off from the Apache parent such as piped
2464 <p>CPU resource limits are expressed in seconds per
2467 <seealso><directive module="core">RLimitMEM</directive></seealso>
2468 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2469 </directivesynopsis>
2472 <name>RLimitMEM</name>
2473 <description>Limits the memory consumption of processes launched
2474 by Apache children</description>
2475 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
2476 <default>Unset; uses operating system defaults</default>
2477 <contextlist><context>server config</context><context>virtual host</context>
2478 <context>directory</context><context>.htaccess</context></contextlist>
2479 <override>All</override>
2482 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2483 resource limit for all processes and the second parameter sets
2484 the maximum resource limit. Either parameter can be a number,
2485 or <code>max</code> to indicate to the server that the limit should
2486 be set to the maximum allowed by the operating system
2487 configuration. Raising the maximum resource limit requires that
2488 the server is running as <code>root</code>, or in the initial startup
2491 <p>This applies to processes forked off from Apache children
2492 servicing requests, not the Apache children themselves. This
2493 includes CGI scripts and SSI exec commands, but not any
2494 processes forked off from the Apache parent such as piped
2497 <p>Memory resource limits are expressed in bytes per
2500 <seealso><directive module="core">RLimitCPU</directive></seealso>
2501 <seealso><directive module="core">RLimitNPROC</directive></seealso>
2502 </directivesynopsis>
2505 <name>RLimitNPROC</name>
2506 <description>Limits the number of processes that can be launched by
2507 processes launched by Apache children</description>
2508 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
2509 <default>Unset; uses operating system defaults</default>
2510 <contextlist><context>server config</context><context>virtual host</context>
2511 <context>directory</context><context>.htaccess</context></contextlist>
2512 <override>All</override>
2515 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2516 resource limit for all processes and the second parameter sets
2517 the maximum resource limit. Either parameter can be a number,
2518 or <code>max</code> to indicate to the server that the limit
2519 should be set to the maximum allowed by the operating system
2520 configuration. Raising the maximum resource limit requires that
2521 the server is running as <code>root</code>, or in the initial startup
2524 <p>This applies to processes forked off from Apache children
2525 servicing requests, not the Apache children themselves. This
2526 includes CGI scripts and SSI exec commands, but not any
2527 processes forked off from the Apache parent such as piped
2530 <p>Process limits control the number of processes per user.</p>
2532 <note><title>Note</title>
2533 <p>If CGI processes are <strong>not</strong> running
2534 under user ids other than the web server user id, this directive
2535 will limit the number of processes that the server itself can
2536 create. Evidence of this situation will be indicated by
2537 <strong><code>cannot fork</code></strong> messages in the
2538 <code>error_log</code>.</p>
2541 <seealso><directive module="core">RLimitMEM</directive></seealso>
2542 <seealso><directive module="core">RLimitCPU</directive></seealso>
2543 </directivesynopsis>
2546 <name>Satisfy</name>
2547 <description>Interaction between host-level access control and
2548 user authentication</description>
2549 <syntax>Satisfy Any|All</syntax>
2550 <default>Satisfy All</default>
2551 <contextlist><context>directory</context><context>.htaccess</context>
2553 <override>AuthConfig</override>
2554 <compatibility>Influenced by <directive module="core" type="section"
2555 >Limit</directive> and <directive module="core"
2556 type="section">LimitExcept</directive> in version 2.0.51 and
2557 later</compatibility>
2560 <p>Access policy if both <directive
2561 module="mod_authz_host">Allow</directive> and <directive
2562 module="core">Require</directive> used. The parameter can be
2563 either <code>All</code> or <code>Any</code>. This directive is only
2564 useful if access to a particular area is being restricted by both
2565 username/password <em>and</em> client host address. In this case
2566 the default behavior (<code>All</code>) is to require that the client
2567 passes the address access restriction <em>and</em> enters a valid
2568 username and password. With the <code>Any</code> option the client will be
2569 granted access if they either pass the host restriction or enter a
2570 valid username and password. This can be used to password restrict
2571 an area, but to let clients from particular addresses in without
2572 prompting for a password.</p>
2574 <p>For example, if you wanted to let people on your network have
2575 unrestricted access to a portion of your website, but require that
2576 people outside of your network provide a password, you could use a
2577 configuration similar to the following:</p>
2580 Require valid-user<br />
2581 Allow from 192.168.1<br />
2585 <p>Since version 2.0.51 <directive>Satisfy</directive> directives can
2586 be restricted to particular methods by <directive module="core"
2587 type="section">Limit</directive> and <directive module="core" type="section"
2588 >LimitExcept</directive> sections.</p>
2590 <seealso><directive module="mod_authz_host">Allow</directive></seealso>
2591 <seealso><directive module="core">Require</directive></seealso>
2592 </directivesynopsis>
2595 <name>ScriptInterpreterSource</name>
2596 <description>Technique for locating the interpreter for CGI
2597 scripts</description>
2598 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
2599 <default>ScriptInterpreterSource Script</default>
2600 <contextlist><context>server config</context><context>virtual host</context>
2601 <context>directory</context><context>.htaccess</context></contextlist>
2602 <override>FileInfo</override>
2603 <compatibility>Win32 only;
2604 option <code>Registry-Strict</code> is available in Apache 2.0 and
2605 later</compatibility>
2608 <p>This directive is used to control how Apache finds the
2609 interpreter used to run CGI scripts. The default setting is
2610 <code>Script</code>. This causes Apache to use the interpreter pointed to
2611 by the shebang line (first line, starting with <code>#!</code>) in the
2612 script. On Win32 systems this line usually looks like:</p>
2615 #!C:/Perl/bin/perl.exe
2618 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2624 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2625 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2626 searched using the script file extension (e.g., <code>.pl</code>) as a
2627 search key. The command defined by the registry subkey
2628 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2629 <code>Shell\Open\Command</code> is used to open the script file. If the
2630 registry keys cannot be found, Apache falls back to the behavior of the
2631 <code>Script</code> option.</p>
2633 <note type="warning"><title>Security</title>
2634 <p>Be careful when using <code>ScriptInterpreterSource
2635 Registry</code> with <directive
2636 module="mod_alias">ScriptAlias</directive>'ed directories, because
2637 Apache will try to execute <strong>every</strong> file within this
2638 directory. The <code>Registry</code> setting may cause undesired
2639 program calls on files which are typically not executed. For
2640 example, the default open command on <code>.htm</code> files on
2641 most Windows systems will execute Microsoft Internet Explorer, so
2642 any HTTP request for an <code>.htm</code> file existing within the
2643 script directory would start the browser in the background on the
2644 server. This is a good way to crash your system within a minute or
2648 <p>The option <code>Registry-Strict</code> which is new in Apache
2649 2.0 does the same thing as <code>Registry</code> but uses only the
2650 subkey <code>Shell\ExecCGI\Command</code>. The
2651 <code>ExecCGI</code> key is not a common one. It must be
2652 configured manually in the windows registry and hence prevents
2653 accidental program calls on your system.</p>
2655 </directivesynopsis>
2658 <name>ServerAdmin</name>
2659 <description>Email address that the server includes in error
2660 messages sent to the client</description>
2661 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
2662 <contextlist><context>server config</context><context>virtual host</context>
2666 <p>The <directive>ServerAdmin</directive> sets the contact address
2667 that the server includes in any error messages it returns to the
2668 client. If the <code>httpd</code> doesn't recognize the supplied argument
2670 assumes, that it's an <var>email-address</var> and prepends it with
2671 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2672 actually use an email address, since there are a lot of CGI scripts that
2673 make that assumption. If you want to use an URL, it should point to another
2674 server under your control. Otherwise users may not be able to contact you in
2677 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2680 ServerAdmin www-admin@foo.example.com
2682 <p>as users do not always mention that they are talking about the
2685 </directivesynopsis>
2688 <name>ServerAlias</name>
2689 <description>Alternate names for a host used when matching requests
2690 to name-virtual hosts</description>
2691 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
2692 <contextlist><context>virtual host</context></contextlist>
2695 <p>The <directive>ServerAlias</directive> directive sets the
2696 alternate names for a host, for use with <a
2697 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
2700 <VirtualHost *><br />
2701 ServerName server.domain.com<br />
2702 ServerAlias server server2.domain.com server2<br />
2704 </VirtualHost>
2707 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2708 </directivesynopsis>
2711 <name>ServerName</name>
2712 <description>Hostname and port that the server uses to identify
2713 itself</description>
2714 <syntax>ServerName <var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
2715 <contextlist><context>server config</context><context>virtual host</context>
2717 <compatibility>In version 2.0, this
2718 directive supersedes the functionality of the <directive>Port</directive>
2719 directive from version 1.3.</compatibility>
2722 <p>The <directive>ServerName</directive> directive sets the hostname and
2723 port that the server uses to identify itself. This is used when
2724 creating redirection URLs. For example, if the name of the
2725 machine hosting the web server is <code>simple.example.com</code>,
2726 but the machine also has the DNS alias <code>www.example.com</code>
2727 and you wish the web server to be so identified, the following
2728 directive should be used:</p>
2731 ServerName www.example.com:80
2734 <p>If no <directive>ServerName</directive> is specified, then the
2735 server attempts to deduce the hostname by performing a reverse
2736 lookup on the IP address. If no port is specified in the
2737 <directive>ServerName</directive>, then the server will use the port
2739 request. For optimal reliability and predictability, you should
2740 specify an explicit hostname and port using the
2741 <directive>ServerName</directive> directive.</p>
2743 <p>If you are using <a
2744 href="../vhosts/name-based.html">name-based virtual hosts</a>,
2745 the <directive>ServerName</directive> inside a
2746 <directive type="section" module="core">VirtualHost</directive>
2747 section specifies what hostname must appear in the request's
2748 <code>Host:</code> header to match this virtual host.</p>
2750 <p>See the description of the
2751 <directive module="core">UseCanonicalName</directive> and
2752 <directive module="core">UseCanonicalPhysicalPort</directive>directives for
2753 settings which determine whether self-referential URL's (e.g., by the
2754 <module>mod_dir</module> module) will refer to the
2755 specified port, or to the port number given in the client's request.
2759 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
2760 Apache</a></seealso>
2761 <seealso><a href="../vhosts/">Apache virtual host
2762 documentation</a></seealso>
2763 <seealso><directive module="core">UseCanonicalName</directive></seealso>
2764 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
2765 <seealso><directive module="core">NameVirtualHost</directive></seealso>
2766 <seealso><directive module="core">ServerAlias</directive></seealso>
2767 </directivesynopsis>
2770 <name>ServerPath</name>
2771 <description>Legacy URL pathname for a name-based virtual host that
2772 is accessed by an incompatible browser</description>
2773 <syntax>ServerPath <var>URL-path</var></syntax>
2774 <contextlist><context>virtual host</context></contextlist>
2777 <p>The <directive>ServerPath</directive> directive sets the legacy
2778 URL pathname for a host, for use with <a
2779 href="../vhosts/">name-based virtual hosts</a>.</p>
2781 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
2782 </directivesynopsis>
2785 <name>ServerRoot</name>
2786 <description>Base directory for the server installation</description>
2787 <syntax>ServerRoot <var>directory-path</var></syntax>
2788 <default>ServerRoot /usr/local/apache</default>
2789 <contextlist><context>server config</context></contextlist>
2792 <p>The <directive>ServerRoot</directive> directive sets the
2793 directory in which the server lives. Typically it will contain the
2794 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2795 paths in other configuration directives (such as <directive
2796 module="core">Include</directive> or <directive
2797 module="mod_so">LoadModule</directive>, for example) are taken as
2798 relative to this directory.</p>
2800 <example><title>Example</title>
2801 ServerRoot /home/httpd
2805 <seealso><a href="../invoking.html">the <code>-d</code>
2806 option to <code>httpd</code></a></seealso>
2807 <seealso><a href="../misc/security_tips.html#serverroot">the
2808 security tips</a> for information on how to properly set
2809 permissions on the <directive>ServerRoot</directive></seealso>
2810 </directivesynopsis>
2813 <name>ServerSignature</name>
2814 <description>Configures the footer on server-generated documents</description>
2815 <syntax>ServerSignature On|Off|EMail</syntax>
2816 <default>ServerSignature Off</default>
2817 <contextlist><context>server config</context><context>virtual host</context>
2818 <context>directory</context><context>.htaccess</context>
2820 <override>All</override>
2823 <p>The <directive>ServerSignature</directive> directive allows the
2824 configuration of a trailing footer line under server-generated
2825 documents (error messages, <module>mod_proxy</module> ftp directory
2826 listings, <module>mod_info</module> output, ...). The reason why you
2827 would want to enable such a footer line is that in a chain of proxies,
2828 the user often has no possibility to tell which of the chained servers
2829 actually produced a returned error message.</p>
2831 <p>The <code>Off</code>
2832 setting, which is the default, suppresses the footer line (and is
2833 therefore compatible with the behavior of Apache-1.2 and
2834 below). The <code>On</code> setting simply adds a line with the
2835 server version number and <directive
2836 module="core">ServerName</directive> of the serving virtual host,
2837 and the <code>EMail</code> setting additionally creates a
2838 "mailto:" reference to the <directive
2839 module="core">ServerAdmin</directive> of the referenced
2842 <p>After version 2.0.44, the details of the server version number
2843 presented are controlled by the <directive
2844 module="core">ServerTokens</directive> directive.</p>
2846 <seealso><directive module="core">ServerTokens</directive></seealso>
2847 </directivesynopsis>
2850 <name>ServerTokens</name>
2851 <description>Configures the <code>Server</code> HTTP response
2852 header</description>
2853 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
2854 <default>ServerTokens Full</default>
2855 <contextlist><context>server config</context></contextlist>
2858 <p>This directive controls whether <code>Server</code> response
2859 header field which is sent back to clients includes a
2860 description of the generic OS-type of the server as well as
2861 information about compiled-in modules.</p>
2864 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2866 <dd>Server sends (<em>e.g.</em>): <code>Server:
2869 <dt><code>ServerTokens Major</code></dt>
2871 <dd>Server sends (<em>e.g.</em>): <code>Server:
2872 Apache/2</code></dd>
2874 <dt><code>ServerTokens Minor</code></dt>
2876 <dd>Server sends (<em>e.g.</em>): <code>Server:
2877 Apache/2.0</code></dd>
2879 <dt><code>ServerTokens Min[imal]</code></dt>
2881 <dd>Server sends (<em>e.g.</em>): <code>Server:
2882 Apache/2.0.41</code></dd>
2884 <dt><code>ServerTokens OS</code></dt>
2886 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2889 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2891 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2892 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2895 <p>This setting applies to the entire server, and cannot be
2896 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2898 <p>After version 2.0.44, this directive also controls the
2899 information presented by the <directive
2900 module="core">ServerSignature</directive> directive.</p>
2902 <seealso><directive module="core">ServerSignature</directive></seealso>
2903 </directivesynopsis>
2906 <name>SetHandler</name>
2907 <description>Forces all matching files to be processed by a
2908 handler</description>
2909 <syntax>SetHandler <var>handler-name</var>|None</syntax>
2910 <contextlist><context>server config</context><context>virtual host</context>
2911 <context>directory</context><context>.htaccess</context>
2913 <override>FileInfo</override>
2914 <compatibility>Moved into the core in Apache 2.0</compatibility>
2917 <p>When placed into an <code>.htaccess</code> file or a
2918 <directive type="section" module="core">Directory</directive> or
2919 <directive type="section" module="core">Location</directive>
2920 section, this directive forces all matching files to be parsed
2921 through the <a href="../handler.html">handler</a> given by
2922 <var>handler-name</var>. For example, if you had a directory you
2923 wanted to be parsed entirely as imagemap rule files, regardless
2924 of extension, you might put the following into an
2925 <code>.htaccess</code> file in that directory:</p>
2928 SetHandler imap-file
2931 <p>Another example: if you wanted to have the server display a
2932 status report whenever a URL of
2933 <code>http://servername/status</code> was called, you might put
2934 the following into <code>httpd.conf</code>:</p>
2937 <Location /status><br />
2939 SetHandler server-status<br />
2944 <p>You can override an earlier defined <directive>SetHandler</directive>
2945 directive by using the value <code>None</code>.</p>
2946 <p><strong>Note:</strong> because SetHandler overrides default handlers,
2947 normal behaviour such as handling of URLs ending in a slash (/) as
2948 directories or index files is suppressed.</p>
2951 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
2953 </directivesynopsis>
2956 <name>SetInputFilter</name>
2957 <description>Sets the filters that will process client requests and POST
2959 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2960 <contextlist><context>server config</context><context>virtual host</context>
2961 <context>directory</context><context>.htaccess</context>
2963 <override>FileInfo</override>
2966 <p>The <directive>SetInputFilter</directive> directive sets the
2967 filter or filters which will process client requests and POST
2968 input when they are received by the server. This is in addition to
2969 any filters defined elsewhere, including the
2970 <directive module="mod_mime">AddInputFilter</directive>
2973 <p>If more than one filter is specified, they must be separated
2974 by semicolons in the order in which they should process the
2977 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
2978 </directivesynopsis>
2981 <name>SetOutputFilter</name>
2982 <description>Sets the filters that will process responses from the
2983 server</description>
2984 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
2985 <contextlist><context>server config</context><context>virtual host</context>
2986 <context>directory</context><context>.htaccess</context>
2988 <override>FileInfo</override>
2991 <p>The <directive>SetOutputFilter</directive> directive sets the filters
2992 which will process responses from the server before they are
2993 sent to the client. This is in addition to any filters defined
2994 elsewhere, including the
2995 <directive module="mod_mime">AddOutputFilter</directive>
2998 <p>For example, the following configuration will process all files
2999 in the <code>/www/data/</code> directory for server-side
3003 <Directory /www/data/><br />
3005 SetOutputFilter INCLUDES<br />
3010 <p>If more than one filter is specified, they must be separated
3011 by semicolons in the order in which they should process the
3014 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3015 </directivesynopsis>
3018 <name>TimeOut</name>
3019 <description>Amount of time the server will wait for
3020 certain events before failing a request</description>
3021 <syntax>TimeOut <var>seconds</var></syntax>
3022 <default>TimeOut 300</default>
3023 <contextlist><context>server config</context></contextlist>
3026 <p>The <directive>TimeOut</directive> directive currently defines
3027 the amount of time Apache will wait for three things:</p>
3030 <li>The total amount of time it takes to receive a GET
3033 <li>The amount of time between receipt of TCP packets on a
3034 POST or PUT request.</li>
3036 <li>The amount of time between ACKs on transmissions of TCP
3037 packets in responses.</li>
3040 <p>We plan on making these separately configurable at some point
3041 down the road. The timer used to default to 1200 before 1.2,
3042 but has been lowered to 300 which is still far more than
3043 necessary in most situations. It is not set any lower by
3044 default because there may still be odd places in the code where
3045 the timer is not reset when a packet is sent. </p>
3047 </directivesynopsis>
3050 <name>TraceEnable</name>
3051 <description>Determines the behaviour on <code>TRACE</code>
3052 requests</description>
3053 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3054 <default>TraceEnable on</default>
3055 <contextlist><context>server config</context></contextlist>
3056 <compatibility>Available in Apache 1.3.34, 2.0.55 and later</compatibility>
3059 <p>This directive overrides the behavior of <code>TRACE</code> for both
3060 the core server and <module>mod_proxy</module>. The default
3061 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3062 RFC 2616, which disallows any request body to accompany the request.
3063 <code>TraceEnable off</code> causes the core server and
3064 <module>mod_proxy</module> to return a <code>405</code> (Method not
3065 allowed) error to the client.</p>
3067 <p>Finally, for testing and diagnostic purposes only, request
3068 bodies may be allowed using the non-compliant <code>TraceEnable
3069 extended</code> directive. The core (as an origin server) will
3070 restrict the request body to 64k (plus 8k for chunk headers if
3071 <code>Transfer-Encoding: chunked</code> is used). The core will
3072 reflect the full headers and all chunk headers with the response
3073 body. As a proxy server, the request body is not restricted to 64k.</p>
3075 </directivesynopsis>
3078 <name>UseCanonicalName</name>
3079 <description>Configures how the server determines its own name and
3081 <syntax>UseCanonicalName On|Off|DNS</syntax>
3082 <default>UseCanonicalName Off</default>
3083 <contextlist><context>server config</context><context>virtual host</context>
3084 <context>directory</context></contextlist>
3087 <p>In many situations Apache must construct a <em>self-referential</em>
3088 URL -- that is, a URL that refers back to the same server. With
3089 <code>UseCanonicalName On</code> Apache will use the hostname and port
3090 specified in the <directive module="core">ServerName</directive>
3091 directive to construct the canonical name for the server. This name
3092 is used in all self-referential URLs, and for the values of
3093 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3095 <p>With <code>UseCanonicalName Off</code> Apache will form
3096 self-referential URLs using the hostname and port supplied by
3097 the client if any are supplied (otherwise it will use the
3098 canonical name, as defined above). These values are the same
3099 that are used to implement <a
3100 href="../vhosts/name-based.html">name based virtual hosts</a>,
3101 and are available with the same clients. The CGI variables
3102 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3103 constructed from the client supplied values as well.</p>
3105 <p>An example where this may be useful is on an intranet server
3106 where you have users connecting to the machine using short
3107 names such as <code>www</code>. You'll notice that if the users
3108 type a shortname, and a URL which is a directory, such as
3109 <code>http://www/splat</code>, <em>without the trailing
3110 slash</em> then Apache will redirect them to
3111 <code>http://www.domain.com/splat/</code>. If you have
3112 authentication enabled, this will cause the user to have to
3113 authenticate twice (once for <code>www</code> and once again
3114 for <code>www.domain.com</code> -- see <a
3115 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3116 FAQ on this subject for more information</a>). But if
3117 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3118 Apache will redirect to <code>http://www/splat/</code>.</p>
3120 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3121 which is intended for use with mass IP-based virtual hosting to
3122 support ancient clients that do not provide a
3123 <code>Host:</code> header. With this option Apache does a
3124 reverse DNS lookup on the server IP address that the client
3125 connected to in order to work out self-referential URLs.</p>
3127 <note type="warning"><title>Warning</title>
3128 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3129 they may be broken by this option. The client is essentially free
3130 to give whatever value they want as a hostname. But if the CGI is
3131 only using <code>SERVER_NAME</code> to construct self-referential URLs
3132 then it should be just fine.</p>
3135 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3136 <seealso><directive module="core">ServerName</directive></seealso>
3137 <seealso><directive module="mpm_common">Listen</directive></seealso>
3138 </directivesynopsis>
3141 <name>UseCanonicalPhysicalPort</name>
3142 <description>Configures how the server determines its own name and
3144 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3145 <default>UseCanonicalPhysicalPort Off</default>
3146 <contextlist><context>server config</context><context>virtual host</context>
3147 <context>directory</context></contextlist>
3150 <p>In many situations Apache must construct a <em>self-referential</em>
3151 URL -- that is, a URL that refers back to the same server. With
3152 <code>UseCanonicalPhysicalPort On</code> Apache will, when
3153 constructing the canonical port for the server to honor
3154 the <directive module="core">UseCanonicalName</directive> directive,
3155 provide the actual physical port number being used by this request
3156 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3157 Apache will not ever use the actual physical port number, instead
3158 relying on all configured information to construct a valid port number.</p>
3160 <note><title>Note</title>
3161 <p>The ordering of when the physical port is used is as follows:<br /><br />
3162 <code>UseCanonicalName On</code></p>
3164 <li>Port provided in <code>Servername</code></li>
3165 <li>Physical port</li>
3166 <li>Default port</li>
3168 <code>UseCanonicalName Off | DNS</code>
3170 <li>Parsed port from <code>Host:</code> header</li>
3171 <li>Physical port</li>
3172 <li>Port provided in <code>Servername</code></li>
3173 <li>Default port</li>
3176 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3177 physical ports are removed from the ordering.</p>
3181 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3182 <seealso><directive module="core">ServerName</directive></seealso>
3183 <seealso><directive module="mpm_common">Listen</directive></seealso>
3184 </directivesynopsis>
3186 <directivesynopsis type="section">
3187 <name>VirtualHost</name>
3188 <description>Contains directives that apply only to a specific
3189 hostname or IP address</description>
3190 <syntax><VirtualHost
3191 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3192 ...> ... </VirtualHost></syntax>
3193 <contextlist><context>server config</context></contextlist>
3196 <p><directive type="section">VirtualHost</directive> and
3197 <code></VirtualHost></code> are used to enclose a group of
3198 directives that will apply only to a particular virtual host. Any
3199 directive that is allowed in a virtual host context may be
3200 used. When the server receives a request for a document on a
3201 particular virtual host, it uses the configuration directives
3202 enclosed in the <directive type="section">VirtualHost</directive>
3203 section. <var>Addr</var> can be:</p>
3206 <li>The IP address of the virtual host;</li>
3208 <li>A fully qualified domain name for the IP address of the
3211 <li>The character <code>*</code>, which is used only in combination with
3212 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3214 <li>The string <code>_default_</code>, which is used only
3215 with IP virtual hosting to catch unmatched IP addresses.</li>
3218 <example><title>Example</title>
3219 <VirtualHost 10.1.2.3><br />
3221 ServerAdmin webmaster@host.foo.com<br />
3222 DocumentRoot /www/docs/host.foo.com<br />
3223 ServerName host.foo.com<br />
3224 ErrorLog logs/host.foo.com-error_log<br />
3225 TransferLog logs/host.foo.com-access_log<br />
3227 </VirtualHost>
3231 <p>IPv6 addresses must be specified in square brackets because
3232 the optional port number could not be determined otherwise. An
3233 IPv6 example is shown below:</p>
3236 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3238 ServerAdmin webmaster@host.example.com<br />
3239 DocumentRoot /www/docs/host.example.com<br />
3240 ServerName host.example.com<br />
3241 ErrorLog logs/host.example.com-error_log<br />
3242 TransferLog logs/host.example.com-access_log<br />
3244 </VirtualHost>
3247 <p>Each Virtual Host must correspond to a different IP address,
3248 different port number or a different host name for the server,
3249 in the former case the server machine must be configured to
3250 accept IP packets for multiple addresses. (If the machine does
3251 not have multiple network interfaces, then this can be
3252 accomplished with the <code>ifconfig alias</code> command -- if
3253 your OS supports it).</p>
3255 <note><title>Note</title>
3256 <p>The use of <directive type="section">VirtualHost</directive> does
3257 <strong>not</strong> affect what addresses Apache listens on. You
3258 may need to ensure that Apache is listening on the correct addresses
3259 using <directive module="mpm_common">Listen</directive>.</p>
3262 <p>When using IP-based virtual hosting, the special name
3263 <code>_default_</code> can be specified in
3264 which case this virtual host will match any IP address that is
3265 not explicitly listed in another virtual host. In the absence
3266 of any <code>_default_</code> virtual host the "main" server config,
3267 consisting of all those definitions outside any VirtualHost
3268 section, is used when no IP-match occurs. (But note that any IP
3269 address that matches a <directive
3270 module="core">NameVirtualHost</directive> directive will use neither
3271 the "main" server config nor the <code>_default_</code> virtual host.
3272 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
3273 documentation for further details.)</p>
3275 <p>You can specify a <code>:port</code> to change the port that is
3276 matched. If unspecified then it defaults to the same port as the
3277 most recent <directive module="mpm_common">Listen</directive>
3278 statement of the main server. You may also specify <code>:*</code>
3279 to match all ports on that address. (This is recommended when used
3280 with <code>_default_</code>.)</p>
3282 <note type="warning"><title>Security</title>
3283 <p>See the <a href="../misc/security_tips.html">security tips</a>
3284 document for details on why your security could be compromised if the
3285 directory where log files are stored is writable by anyone other
3286 than the user that starts the server.</p>
3289 <seealso><a href="../vhosts/">Apache Virtual Host documentation</a></seealso>
3290 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3291 Apache</a></seealso>
3292 <seealso><a href="../bind.html">Setting
3293 which addresses and ports Apache uses</a></seealso>
3294 <seealso><a href="../sections.html">How <Directory>, <Location>
3295 and <Files> sections work</a> for an explanation of how these
3296 different sections are combined when a request is received</seealso>
3297 </directivesynopsis>