2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision: 1040494 $ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="core.xml.meta">
26 <description>Funcionalides básicas del Servidor HTTP Apache que siempre están presentes.</description>
30 <name>AcceptFilter</name>
31 <description>Configura mejoras para un Protocolo de Escucha de Sockets</description>
32 <syntax>AcceptFilter <var>protocol</var> <var>accept_filter</var></syntax>
33 <contextlist><context>server config</context></contextlist>
34 <compatibility>Disponible en Apache httpd 2.1.5 y posteriores.
35 En Windows desde Apache httpd 2.3.3 y posteriores.</compatibility>
38 <p>Esta directiva hace posible mejoras específicas a nivel de sistema operativo
39 y a través del tipo de Protocolo para un socket que escucha.
40 La premisa básica es que el kernel no envíe un socket al servidor
41 hasta que o bien los datos se hayan recibido o bien se haya almacenado
42 en el buffer una Respuesta HTTP completa.
43 Actualmente sólo están soportados
44 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
45 Accept Filters</a> sobre FreeBSD, <code>TCP_DEFER_ACCEPT</code> sobre Linux,
46 y AcceptEx() sobre Windows.</p>
48 <p>El uso de <code>none</code> para un argumento desactiva cualquier filtro
49 aceptado para ese protocolo. Esto es útil para protocolos que requieren que un
50 servidor envíe datos primeros, tales como <code>ftp:</code> o <code>nntp</code>:</p>
51 <example>AcceptFilter nntp none</example>
53 <p>Los nombres de protocolo por defecto son <code>https</code> para el puerto 443
54 y <code>http</code> para todos los demás puertos. Para especificar que se está
55 utilizando otro protocolo con un puerto escuchando, añade el argumento <var>protocol</var>
56 a la directiva <directive module="mpm_common">Listen</directive>.</p>
58 <p>Sobre FreeBDS los valores por defecto:</p>
60 AcceptFilter http httpready <br/>
61 AcceptFilter https dataready
64 <p>El filtro <code>httpready</code> almacena en el buffer peticiones HTTP completas
65 a nivel de kernel. Una vez que la petición es recibida, el kernel la envía al servidor.
66 Consulta la página man de
67 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
68 accf_http(9)</a> para más detalles. Puesto que las peticiones HTTPS
69 están encriptadas, sólo se utiliza el filtro
70 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">accf_data(9)</a>.</p>
72 <p>Sobre Linux los valores por defecto son:</p>
74 AcceptFilter http data <br/>
75 AcceptFilter https data
78 <p>En Linux, <code>TCP_DEFER_ACCEPT</code> no soporta el buffering en peticiones http.
79 Cualquier valor además de <code>none</code> habilitará
80 <code>TCP_DEFER_ACCEPT</code> en ese socket. Para más detalles
81 ver la página man de Linux
82 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
85 <p>Sobre Windows los valores por defecto son:</p>
87 AcceptFilter http data <br/>
88 AcceptFilter https data
91 <p>Sobre Windows mpm_winnt interpreta el argumento AcceptFilter para conmutar la API
92 AcceptEx(), y no soporta el buffering sobre el protocolo http. Hay dos valores
93 que utilizan la API Windows AcceptEx() y que recuperan sockets de red
94 entre conexciones. <code>data</code> espera hasta que los datos han sido
95 transmitidos como se comentaba anteriormente, y el buffer inicial de datos y las
96 direcciones de red son recuperadas a partir de una única llamada AcceptEx().
97 <code>connect</code> utiliza la API AcceptEx() API, y recupera también
98 las direccciones de red, pero a diferencia de <code>none</code>
99 la opción <code>connect</code> no espera a la transmisión inicial de los datos.</p>
101 <p>Sobre Windows, <code>none</code> prefiere accept() antes que AcceptEx()
102 y no recuperará sockets entre las conexiones. Lo que es útil para los adaptadores de
103 red con un soporte precario de drivers, así como para algunos proveedores de red
104 tales como drivers vpn, o filtros de spam, de virus o de spyware.</p>
107 <seealso><directive>Protocol</directive></seealso>
111 <name>AcceptPathInfo</name>
112 <description>Los recursos aceptan información sobre su ruta</description>
113 <syntax>AcceptPathInfo On|Off|Default</syntax>
114 <default>AcceptPathInfo Default</default>
115 <contextlist><context>server config</context>
116 <context>virtual host</context><context>directory</context>
117 <context>.htaccess</context></contextlist>
118 <override>FileInfo</override>
119 <compatibility>Disponible en Apache httpd 2.0.30 y posteriores</compatibility>
123 <p>Esta directiva controla si las peticiones que contienen información sobre la ruta
124 que sigue un fichero que existe (o un fichero que no existe pero en un directorio que
125 sí existe) serán aceptadas o denegadas. La información de ruta puede estar disponible
126 para los scripts en la variable de entorno <code>PATH_INFO</code>.</p>
128 <p>Por ejemplo, asumamos que la ubicación <code>/test/</code> apunta a
129 un directorio que contiene únicamente el fichero
130 <code>here.html</code>. Entonces, las peticiones tanto para
131 <code>/test/here.html/more</code> como para
132 <code>/test/nothere.html/more</code> recogen
133 <code>/more</code> como <code>PATH_INFO</code>.</p>
135 <p>Los tres posibles argumentos para la directiva
136 <directive>AcceptPathInfo</directive> son los siguientes:</p>
138 <dt><code>Off</code></dt><dd>Una petición sólo será aceptada si
139 se corresponde con una ruta literal que existe. Por lo tanto, una petición
140 con una información de ruta después del nombre de fichero tal como
141 <code>/test/here.html/more</code> en el ejemplo anterior devolverá
142 un error 404 NOT FOUND.</dd>
144 <dt><code>On</code></dt><dd>Una petición será aceptada si una
145 ruta principal de acceso se corresponde con un fichero que existe. El ejemplo
146 anterior <code>/test/here.html/more</code> será aceptado si
147 <code>/test/here.html</code> corresponde a un fichero válido.</dd>
149 <dt><code>Default</code></dt><dd>La gestión de las peticiones
150 con información de ruta está determinada por el <a
151 href="../handler.html">controlador</a> responsable de la petición.
152 El controlador principal para para ficheros normales rechaza por defecto
153 peticiones <code>PATH_INFO</code>. Los controladores que sirven scripts, tales como <a
154 href="mod_cgi.html">cgi-script</a> e <a
155 href="mod_isapi.html">isapi-handler</a>, normalmente aceptan
156 <code>PATH_INFO</code> por defecto.</dd>
159 <p>El objetivo principal de la directiva <code>AcceptPathInfo</code>
160 es permitirte sobreescribir la opción del controlador
161 de aceptar or rechazar <code>PATH_INFO</code>. This override is required,
162 for example, when you use a <a href="../filter.html">filter</a>, such
163 as <a href="mod_include.html">INCLUDES</a>, to generate content
164 based on <code>PATH_INFO</code>. The core handler would usually reject
165 the request, so you can use the following configuration to enable
169 <Files "mypaths.shtml"><br />
171 Options +Includes<br />
172 SetOutputFilter INCLUDES<br />
173 AcceptPathInfo On<br />
182 <name>AccessFileName</name>
183 <description>Name of the distributed configuration file</description>
184 <syntax>AccessFileName <var>filename</var> [<var>filename</var>] ...</syntax>
185 <default>AccessFileName .htaccess</default>
186 <contextlist><context>server config</context><context>virtual host</context>
190 <p>While processing a request the server looks for
191 the first existing configuration file from this list of names in
192 every directory of the path to the document, if distributed
193 configuration files are <a href="#allowoverride">enabled for that
194 directory</a>. For example:</p>
200 <p>before returning the document
201 <code>/usr/local/web/index.html</code>, the server will read
202 <code>/.acl</code>, <code>/usr/.acl</code>,
203 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
204 for directives, unless they have been disabled with</p>
207 <Directory /><br />
209 AllowOverride None<br />
214 <seealso><directive module="core">AllowOverride</directive></seealso>
215 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
216 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
220 <name>AddDefaultCharset</name>
221 <description>Default charset parameter to be added when a response
222 content-type is <code>text/plain</code> or <code>text/html</code></description>
223 <syntax>AddDefaultCharset On|Off|<var>charset</var></syntax>
224 <default>AddDefaultCharset Off</default>
225 <contextlist><context>server config</context>
226 <context>virtual host</context><context>directory</context>
227 <context>.htaccess</context></contextlist>
228 <override>FileInfo</override>
231 <p>This directive specifies a default value for the media type
232 charset parameter (the name of a character encoding) to be added
233 to a response if and only if the response's content-type is either
234 <code>text/plain</code> or <code>text/html</code>. This should override
235 any charset specified in the body of the response via a <code>META</code>
236 element, though the exact behavior is often dependent on the user's client
237 configuration. A setting of <code>AddDefaultCharset Off</code>
238 disables this functionality. <code>AddDefaultCharset On</code> enables
239 a default charset of <code>iso-8859-1</code>. Any other value is assumed
240 to be the <var>charset</var> to be used, which should be one of the
241 <a href="http://www.iana.org/assignments/character-sets">IANA registered
242 charset values</a> for use in Internet media types (MIME types).
246 AddDefaultCharset utf-8
249 <p><directive>AddDefaultCharset</directive> should only be used when all
250 of the text resources to which it applies are known to be in that
251 character encoding and it is too inconvenient to label their charset
252 individually. One such example is to add the charset parameter
253 to resources containing generated content, such as legacy CGI
254 scripts, that might be vulnerable to cross-site scripting attacks
255 due to user-provided data being included in the output. Note, however,
256 that a better solution is to just fix (or delete) those scripts, since
257 setting a default charset does not protect users that have enabled
258 the "auto-detect character encoding" feature on their browser.</p>
260 <seealso><directive module="mod_mime">AddCharset</directive></seealso>
264 <name>AllowEncodedSlashes</name>
265 <description>Determines whether encoded path separators in URLs are allowed to
266 be passed through</description>
267 <syntax>AllowEncodedSlashes On|Off</syntax>
268 <default>AllowEncodedSlashes Off</default>
269 <contextlist><context>server config</context><context>virtual host</context>
271 <compatibility>Available in Apache httpd 2.0.46 and later</compatibility>
274 <p>The <directive>AllowEncodedSlashes</directive> directive allows URLs
275 which contain encoded path separators (<code>%2F</code> for <code>/</code>
276 and additionally <code>%5C</code> for <code>\</code> on according systems)
277 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
279 <p>Turning <directive>AllowEncodedSlashes</directive> <code>On</code> is
280 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
282 <note><title>Note</title>
283 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
284 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
285 according systems) will be left as such in the otherwise decoded URL
289 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
293 <name>AllowOverride</name>
294 <description>Types of directives that are allowed in
295 <code>.htaccess</code> files</description>
296 <syntax>AllowOverride All|None|<var>directive-type</var>
297 [<var>directive-type</var>] ...</syntax>
298 <default>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</default>
299 <contextlist><context>directory</context></contextlist>
302 <p>When the server finds an <code>.htaccess</code> file (as
303 specified by <directive module="core">AccessFileName</directive>)
304 it needs to know which directives declared in that file can override
305 earlier configuration directives.</p>
307 <note><title>Only available in <Directory> sections</title>
308 <directive>AllowOverride</directive> is valid only in
309 <directive type="section" module="core">Directory</directive>
310 sections specified without regular expressions, not in <directive
311 type="section" module="core">Location</directive>, <directive
312 module="core" type="section">DirectoryMatch</directive> or
313 <directive type="section" module="core">Files</directive> sections.
316 <p>When this directive is set to <code>None</code>, then
317 <a href="#accessfilename">.htaccess</a> files are completely ignored.
318 In this case, the server will not even attempt to read
319 <code>.htaccess</code> files in the filesystem.</p>
321 <p>When this directive is set to <code>All</code>, then any
322 directive which has the .htaccess <a
323 href="directive-dict.html#Context">Context</a> is allowed in
324 <code>.htaccess</code> files.</p>
326 <p>The <var>directive-type</var> can be one of the following
327 groupings of directives.</p>
334 Allow use of the authorization directives (<directive
335 module="mod_authn_dbm">AuthDBMGroupFile</directive>,
336 <directive module="mod_authn_dbm">AuthDBMUserFile</directive>,
337 <directive module="mod_authz_groupfile">AuthGroupFile</directive>,
338 <directive module="mod_authn_core">AuthName</directive>,
339 <directive module="mod_authn_core">AuthType</directive>, <directive
340 module="mod_authn_file">AuthUserFile</directive>, <directive
341 module="mod_authz_core">Require</directive>, <em>etc.</em>).</dd>
346 Allow use of the directives controlling document types
347 (<directive module="core">ErrorDocument</directive>,
348 <directive module="core">ForceType</directive>,
349 <directive module="mod_negotiation">LanguagePriority</directive>,
350 <directive module="core">SetHandler</directive>,
351 <directive module="core">SetInputFilter</directive>,
352 <directive module="core">SetOutputFilter</directive>, and
353 <module>mod_mime</module> Add* and Remove* directives),
354 document meta data (<directive
355 module="mod_headers">Header</directive>, <directive
356 module="mod_headers">RequestHeader</directive>, <directive
357 module="mod_setenvif">SetEnvIf</directive>, <directive
358 module="mod_setenvif">SetEnvIfNoCase</directive>, <directive
359 module="mod_setenvif">BrowserMatch</directive>, <directive
360 module="mod_usertrack">CookieExpires</directive>, <directive
361 module="mod_usertrack">CookieDomain</directive>, <directive
362 module="mod_usertrack">CookieStyle</directive>, <directive
363 module="mod_usertrack">CookieTracking</directive>, <directive
364 module="mod_usertrack">CookieName</directive>),
365 <module>mod_rewrite</module> directives <directive
366 module="mod_rewrite">RewriteEngine</directive>, <directive
367 module="mod_rewrite">RewriteOptions</directive>, <directive
368 module="mod_rewrite">RewriteBase</directive>, <directive
369 module="mod_rewrite">RewriteCond</directive>, <directive
370 module="mod_rewrite">RewriteRule</directive>) and
371 <directive module="mod_actions">Action</directive> from
372 <module>mod_actions</module>.
378 Allow use of the directives controlling directory indexing
380 module="mod_autoindex">AddDescription</directive>,
381 <directive module="mod_autoindex">AddIcon</directive>, <directive
382 module="mod_autoindex">AddIconByEncoding</directive>,
383 <directive module="mod_autoindex">AddIconByType</directive>,
384 <directive module="mod_autoindex">DefaultIcon</directive>, <directive
385 module="mod_dir">DirectoryIndex</directive>, <directive
386 module="mod_autoindex">FancyIndexing</directive>, <directive
387 module="mod_autoindex">HeaderName</directive>, <directive
388 module="mod_autoindex">IndexIgnore</directive>, <directive
389 module="mod_autoindex">IndexOptions</directive>, <directive
390 module="mod_autoindex">ReadmeName</directive>,
396 Allow use of the directives controlling host access (<directive
397 module="mod_authz_host">Allow</directive>, <directive
398 module="mod_authz_host">Deny</directive> and <directive
399 module="mod_authz_host">Order</directive>).</dd>
401 <dt>Options[=<var>Option</var>,...]</dt>
404 Allow use of the directives controlling specific directory
405 features (<directive module="core">Options</directive> and
406 <directive module="mod_include">XBitHack</directive>).
407 An equal sign may be given followed by a comma (but no spaces)
408 separated lists of options that may be set using the <directive
409 module="core">Options</directive> command.</dd>
415 AllowOverride AuthConfig Indexes
418 <p>In the example above all directives that are neither in the group
419 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
422 <note><p>For security and performance reasons, do not set
423 <code>AllowOverride</code> to anything other than <code>None</code>
424 in your <code><Directory /></code> block. Instead, find (or
425 create) the <code><Directory></code> block that refers to the
426 directory where you're actually planning to place a
427 <code>.htaccess</code> file.</p>
431 <seealso><directive module="core">AccessFileName</directive></seealso>
432 <seealso><a href="../configuring.html">Configuration Files</a></seealso>
433 <seealso><a href="../howto/htaccess.html">.htaccess Files</a></seealso>
437 <name>CGIMapExtension</name>
438 <description>Technique for locating the interpreter for CGI
439 scripts</description>
440 <syntax>CGIMapExtension <var>cgi-path</var> <var>.extension</var></syntax>
441 <contextlist><context>directory</context><context>.htaccess</context>
443 <override>FileInfo</override>
444 <compatibility>NetWare only</compatibility>
447 <p>This directive is used to control how Apache httpd finds the
448 interpreter used to run CGI scripts. For example, setting
449 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
450 cause all CGI script files with a <code>.foo</code> extension to
451 be passed to the FOO interpreter.</p>
456 <name>ContentDigest</name>
457 <description>Enables the generation of <code>Content-MD5</code> HTTP Response
458 headers</description>
459 <syntax>ContentDigest On|Off</syntax>
460 <default>ContentDigest Off</default>
461 <contextlist><context>server config</context><context>virtual host</context>
462 <context>directory</context><context>.htaccess</context>
464 <override>Options</override>
465 <status>Experimental</status>
468 <p>This directive enables the generation of
469 <code>Content-MD5</code> headers as defined in RFC1864
470 respectively RFC2616.</p>
472 <p>MD5 is an algorithm for computing a "message digest"
473 (sometimes called "fingerprint") of arbitrary-length data, with
474 a high degree of confidence that any alterations in the data
475 will be reflected in alterations in the message digest.</p>
477 <p>The <code>Content-MD5</code> header provides an end-to-end
478 message integrity check (MIC) of the entity-body. A proxy or
479 client may check this header for detecting accidental
480 modification of the entity-body in transit. Example header:</p>
483 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
486 <p>Note that this can cause performance problems on your server
487 since the message digest is computed on every request (the
488 values are not cached).</p>
490 <p><code>Content-MD5</code> is only sent for documents served
491 by the <module>core</module>, and not by any module. For example,
492 SSI documents, output from CGI scripts, and byte range responses
493 do not have this header.</p>
498 <name>DefaultType</name>
499 <description>This directive has no effect other than to emit warnings
500 if the value is not <code>none</code>. In prior versions, DefaultType
501 would specify a default media type to assign to response content for
502 which no other media type configuration could be found.
504 <syntax>DefaultType <var>media-type|none</var></syntax>
505 <default>DefaultType none</default>
506 <contextlist><context>server config</context><context>virtual host</context>
507 <context>directory</context><context>.htaccess</context>
509 <override>FileInfo</override>
510 <compatibility>The argument <code>none</code> is available in Apache httpd 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.</compatibility>
513 <p>This directive has been disabled. For backwards compatibility
514 of configuration files, it may be specified with the value
515 <code>none</code>, meaning no default media type. For example:</p>
521 <p><code>DefaultType None</code> is only available in
522 httpd-2.2.7 and later.</p>
524 <p>Use the mime.types configuration file and the
525 <directive module="mod_mime">AddType</directive> to configure media
526 type assignments via file extensions, or the
527 <directive module="core">ForceType</directive> directive to configure
528 the media type for specific resources. Otherwise, the server will
529 send the response without a Content-Type header field and the
530 recipient may attempt to guess the media type.</p>
536 <description>Define the existence of a variable</description>
537 <syntax>Define <var>parameter-name</var></syntax>
538 <contextlist><context>server config</context></contextlist>
541 <p>Equivalent to passing the <code>-D</code> argument to <program
542 >httpd</program>.</p>
543 <p>This directive can be used to toggle the use of <directive module="core"
544 type="section">IfDefine</directive> sections without needing to alter
545 <code>-D</code> arguments in any startup scripts.</p>
549 <directivesynopsis type="section">
550 <name>Directory</name>
551 <description>Enclose a group of directives that apply only to the
552 named file-system directory, sub-directories, and their contents.</description>
553 <syntax><Directory <var>directory-path</var>>
554 ... </Directory></syntax>
555 <contextlist><context>server config</context><context>virtual host</context>
559 <p><directive type="section">Directory</directive> and
560 <code></Directory></code> are used to enclose a group of
561 directives that will apply only to the named directory,
562 sub-directories of that directory, and the files within the respective
563 directories. Any directive that is allowed
564 in a directory context may be used. <var>Directory-path</var> is
565 either the full path to a directory, or a wild-card string using
566 Unix shell-style matching. In a wild-card string, <code>?</code> matches
567 any single character, and <code>*</code> matches any sequences of
568 characters. You may also use <code>[]</code> character ranges. None
569 of the wildcards match a `/' character, so <code><Directory
570 /*/public_html></code> will not match
571 <code>/home/user/public_html</code>, but <code><Directory
572 /home/*/public_html></code> will match. Example:</p>
575 <Directory /usr/local/httpd/htdocs><br />
577 Options Indexes FollowSymLinks<br />
583 <p>Be careful with the <var>directory-path</var> arguments:
584 They have to literally match the filesystem path which Apache httpd uses
585 to access the files. Directives applied to a particular
586 <code><Directory></code> will not apply to files accessed from
587 that same directory via a different path, such as via different symbolic
591 <p><glossary ref="regex">Regular
592 expressions</glossary> can also be used, with the addition of the
593 <code>~</code> character. For example:</p>
596 <Directory ~ "^/www/.*/[0-9]{3}">
599 <p>would match directories in <code>/www/</code> that consisted of
602 <p>If multiple (non-regular expression) <directive
603 type="section">Directory</directive> sections
604 match the directory (or one of its parents) containing a document,
605 then the directives are applied in the order of shortest match
606 first, interspersed with the directives from the <a
607 href="#accessfilename">.htaccess</a> files. For example,
611 <Directory /><br />
613 AllowOverride None<br />
615 </Directory><br />
617 <Directory /home/><br />
619 AllowOverride FileInfo<br />
624 <p>for access to the document <code>/home/web/dir/doc.html</code>
628 <li>Apply directive <code>AllowOverride None</code>
629 (disabling <code>.htaccess</code> files).</li>
631 <li>Apply directive <code>AllowOverride FileInfo</code> (for
632 directory <code>/home</code>).</li>
634 <li>Apply any <code>FileInfo</code> directives in
635 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
636 <code>/home/web/dir/.htaccess</code> in that order.</li>
639 <p>Regular expressions are not considered until after all of the
640 normal sections have been applied. Then all of the regular
641 expressions are tested in the order they appeared in the
642 configuration file. For example, with</p>
645 <Directory ~ abc$><br />
647 # ... directives here ...<br />
652 <p>the regular expression section won't be considered until after
653 all normal <directive type="section">Directory</directive>s and
654 <code>.htaccess</code> files have been applied. Then the regular
655 expression will match on <code>/home/abc/public_html/abc</code> and
656 the corresponding <directive type="section">Directory</directive> will
659 <p><strong>Note that the default access for
660 <code><Directory /></code> is <code>Allow from All</code>.
661 This means that Apache httpd will serve any file mapped from an URL. It is
662 recommended that you change this with a block such
666 <Directory /><br />
668 Order Deny,Allow<br />
674 <p><strong>and then override this for directories you
675 <em>want</em> accessible. See the <a
676 href="../misc/security_tips.html">Security Tips</a> page for more
677 details.</strong></p>
679 <p>The directory sections occur in the <code>httpd.conf</code> file.
680 <directive type="section">Directory</directive> directives
681 cannot nest, and cannot appear in a <directive module="core"
682 type="section">Limit</directive> or <directive module="core"
683 type="section">LimitExcept</directive> section.</p>
685 <seealso><a href="../sections.html">How <Directory>,
686 <Location> and <Files> sections work</a> for an
687 explanation of how these different sections are combined when a
688 request is received</seealso>
691 <directivesynopsis type="section">
692 <name>DirectoryMatch</name>
693 <description>Enclose directives that apply to
694 the contents of file-system directories matching a regular expression.</description>
695 <syntax><DirectoryMatch <var>regex</var>>
696 ... </DirectoryMatch></syntax>
697 <contextlist><context>server config</context><context>virtual host</context>
701 <p><directive type="section">DirectoryMatch</directive> and
702 <code></DirectoryMatch></code> are used to enclose a group
703 of directives which will apply only to the named directory (and the files within),
704 the same as <directive module="core" type="section">Directory</directive>.
705 However, it takes as an argument a
706 <glossary ref="regex">regular expression</glossary>. For example:</p>
709 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
712 <p>would match directories in <code>/www/</code> that consisted of three
715 <note><title>Compatability</title>
716 Prior to 2.3.9, this directive implicitly applied to sub-directories
717 (like <directive module="core" type="section">Directory</directive>) and
718 could not match the end of line symbol ($). In 2.3.9 and later,
719 only directories that match the expression are affected by the enclosed
723 <note><title>Trailing Slash</title>
724 This directive applies to requests for directories that may or may
725 not end in a trailing slash, so expressions that are anchored to the
726 end of line ($) must be written with care.
729 <seealso><directive type="section" module="core">Directory</directive> for
730 a description of how regular expressions are mixed in with normal
731 <directive type="section">Directory</directive>s</seealso>
733 href="../sections.html">How <Directory>, <Location> and
734 <Files> sections work</a> for an explanation of how these different
735 sections are combined when a request is received</seealso>
739 <name>DocumentRoot</name>
740 <description>Directory that forms the main document tree visible
741 from the web</description>
742 <syntax>DocumentRoot <var>directory-path</var></syntax>
743 <default>DocumentRoot /usr/local/apache/htdocs</default>
744 <contextlist><context>server config</context><context>virtual host</context>
748 <p>This directive sets the directory from which <program>httpd</program>
749 will serve files. Unless matched by a directive like <directive
750 module="mod_alias">Alias</directive>, the server appends the
751 path from the requested URL to the document root to make the
752 path to the document. Example:</p>
755 DocumentRoot /usr/web
759 <code>http://www.my.host.com/index.html</code> refers to
760 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
761 not absolute then it is assumed to be relative to the <directive
762 module="core">ServerRoot</directive>.</p>
764 <p>The <directive>DocumentRoot</directive> should be specified without
765 a trailing slash.</p>
767 <seealso><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
768 Locations</a></seealso>
772 <name>EnableMMAP</name>
773 <description>Use memory-mapping to read files during delivery</description>
774 <syntax>EnableMMAP On|Off</syntax>
775 <default>EnableMMAP On</default>
776 <contextlist><context>server config</context><context>virtual host</context>
777 <context>directory</context><context>.htaccess</context>
779 <override>FileInfo</override>
782 <p>This directive controls whether the <program>httpd</program> may use
783 memory-mapping if it needs to read the contents of a file during
784 delivery. By default, when the handling of a request requires
785 access to the data within a file -- for example, when delivering a
786 server-parsed file using <module>mod_include</module> -- Apache httpd
787 memory-maps the file if the OS supports it.</p>
789 <p>This memory-mapping sometimes yields a performance improvement.
790 But in some environments, it is better to disable the memory-mapping
791 to prevent operational problems:</p>
794 <li>On some multiprocessor systems, memory-mapping can reduce the
795 performance of the <program>httpd</program>.</li>
796 <li>Deleting or truncating a file while <program>httpd</program>
797 has it memory-mapped can cause <program>httpd</program> to
798 crash with a segmentation fault.
802 <p>For server configurations that are vulnerable to these problems,
803 you should disable memory-mapping of delivered files by specifying:</p>
809 <p>For NFS mounted files, this feature may be disabled explicitly for
810 the offending files by specifying:</p>
813 <Directory "/path-to-nfs-files">
823 <name>EnableSendfile</name>
824 <description>Use the kernel sendfile support to deliver files to the client</description>
825 <syntax>EnableSendfile On|Off</syntax>
826 <default>EnableSendfile Off</default>
827 <contextlist><context>server config</context><context>virtual host</context>
828 <context>directory</context><context>.htaccess</context>
830 <override>FileInfo</override>
831 <compatibility>Available in version 2.0.44 and later. Default changed to Off in
832 version 2.3.9.</compatibility>
835 <p>This directive controls whether <program>httpd</program> may use the
836 sendfile support from the kernel to transmit file contents to the client.
837 By default, when the handling of a request requires no access
838 to the data within a file -- for example, when delivering a
839 static file -- Apache httpd uses sendfile to deliver the file contents
840 without ever reading the file if the OS supports it.</p>
842 <p>This sendfile mechanism avoids separate read and send operations,
843 and buffer allocations. But on some platforms or within some
844 filesystems, it is better to disable this feature to avoid
845 operational problems:</p>
848 <li>Some platforms may have broken sendfile support that the build
849 system did not detect, especially if the binaries were built on
850 another box and moved to such a machine with broken sendfile
852 <li>On Linux the use of sendfile triggers TCP-checksum
853 offloading bugs on certain networking cards when using IPv6.</li>
854 <li>On Linux on Itanium, sendfile may be unable to handle files
855 over 2GB in size.</li>
856 <li>With a network-mounted <directive
857 module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
858 the kernel may be unable to serve the network file through
862 <p>For server configurations that are not vulnerable to these problems,
863 you may enable this feature by specifying:</p>
869 <p>For network mounted files, this feature may be disabled explicitly
870 for the offending files by specifying:</p>
873 <Directory "/path-to-nfs-files">
879 <p>Please note that the per-directory and .htaccess configuration
880 of <directive>EnableSendfile</directive> is not supported by
881 <module>mod_cache_disk</module>.
882 Only global definition of <directive>EnableSendfile</directive>
883 is taken into account by the module.
890 <description>Abort configuration parsing with a custom error message</description>
891 <syntax>Error <var>message</var></syntax>
892 <contextlist><context>server config</context><context>virtual host</context>
893 <context>directory</context><context>.htaccess</context>
895 <compatibility>2.3.9 and later</compatibility>
898 <p>If an error can be detected within the configuration, this
899 directive can be used to generate a custom error message, and halt
900 configuration parsing. The typical use is for reporting required
901 modules which are missing from the configuration.</p>
903 <example><title>Example</title>
904 # ensure that mod_include is loaded<br />
905 <IfModule !include_module><br />
906 Error mod_include is required by mod_foo. Load it with LoadModule.<br />
907 </IfModule><br />
909 # ensure that exactly one of SSL,NOSSL is defined<br />
910 <IfDefine SSL><br />
911 <IfDefine NOSSL><br />
912 Error Both SSL and NOSSL are defined. Define only one of them.<br />
913 </IfDefine><br />
914 </IfDefine><br />
915 <IfDefine !SSL><br />
916 <IfDefine !NOSSL><br />
917 Error Either SSL or NOSSL must be defined.<br />
918 </IfDefine><br />
919 </IfDefine><br />
926 <name>ErrorDocument</name>
927 <description>What the server will return to the client
928 in case of an error</description>
929 <syntax>ErrorDocument <var>error-code</var> <var>document</var></syntax>
930 <contextlist><context>server config</context><context>virtual host</context>
931 <context>directory</context><context>.htaccess</context>
933 <override>FileInfo</override>
934 <compatibility>Quoting syntax for text messages is different in Apache HTTP Server
938 <p>In the event of a problem or error, Apache httpd can be configured
939 to do one of four things,</p>
942 <li>output a simple hardcoded error message</li>
944 <li>output a customized message</li>
946 <li>redirect to a local <var>URL-path</var> to handle the
949 <li>redirect to an external <var>URL</var> to handle the
953 <p>The first option is the default, while options 2-4 are
954 configured using the <directive>ErrorDocument</directive>
955 directive, which is followed by the HTTP response code and a URL
956 or a message. Apache httpd will sometimes offer additional information
957 regarding the problem/error.</p>
959 <p>URLs can begin with a slash (/) for local web-paths (relative
960 to the <directive module="core">DocumentRoot</directive>), or be a
961 full URL which the client can resolve. Alternatively, a message
962 can be provided to be displayed by the browser. Examples:</p>
965 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
966 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
967 ErrorDocument 401 /subscription_info.html<br />
968 ErrorDocument 403 "Sorry can't allow you access today"
971 <p>Additionally, the special value <code>default</code> can be used
972 to specify Apache httpd's simple hardcoded message. While not required
973 under normal circumstances, <code>default</code> will restore
974 Apache httpd's simple hardcoded message for configurations that would
975 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
978 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
979 <Directory /web/docs><br />
981 ErrorDocument 404 default<br />
986 <p>Note that when you specify an <directive>ErrorDocument</directive>
987 that points to a remote URL (ie. anything with a method such as
988 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
989 client to tell it where to find the document, even if the
990 document ends up being on the same server. This has several
991 implications, the most important being that the client will not
992 receive the original error status code, but instead will
993 receive a redirect status code. This in turn can confuse web
994 robots and other clients which try to determine if a URL is
995 valid using the status code. In addition, if you use a remote
996 URL in an <code>ErrorDocument 401</code>, the client will not
997 know to prompt the user for a password since it will not
998 receive the 401 status code. Therefore, <strong>if you use an
999 <code>ErrorDocument 401</code> directive then it must refer to a local
1000 document.</strong></p>
1002 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1003 server-generated error messages when they are "too small" and substitute
1004 its own "friendly" error messages. The size threshold varies depending on
1005 the type of error, but in general, if you make your error document
1006 greater than 512 bytes, then MSIE will show the server-generated
1007 error rather than masking it. More information is available in
1008 Microsoft Knowledge Base article <a
1009 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1012 <p>Although most error messages can be overriden, there are certain
1013 circumstances where the internal messages are used regardless of the
1014 setting of <directive module="core">ErrorDocument</directive>. In
1015 particular, if a malformed request is detected, normal request processing
1016 will be immediately halted and the internal error message returned.
1017 This is necessary to guard against security problems caused by
1020 <p>If you are using mod_proxy, you may wish to enable
1021 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1022 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1023 Apache httpd will not generate custom error documents for proxied content.</p>
1026 <seealso><a href="../custom-error.html">documentation of
1027 customizable responses</a></seealso>
1028 </directivesynopsis>
1031 <name>ErrorLog</name>
1032 <description>Location where the server will log errors</description>
1033 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1034 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1035 <contextlist><context>server config</context><context>virtual host</context>
1039 <p>The <directive>ErrorLog</directive> directive sets the name of
1040 the file to which the server will log any errors it encounters. If
1041 the <var>file-path</var> is not absolute then it is assumed to be
1042 relative to the <directive module="core">ServerRoot</directive>.</p>
1044 <example><title>Example</title>
1045 ErrorLog /var/log/httpd/error_log
1048 <p>If the <var>file-path</var>
1049 begins with a pipe character "<code>|</code>" then it is assumed to be a
1050 command to spawn to handle the error log.</p>
1052 <example><title>Example</title>
1053 ErrorLog "|/usr/local/bin/httpd_errors"
1056 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1057 more information.</p>
1059 <p>Using <code>syslog</code> instead of a filename enables logging
1060 via syslogd(8) if the system supports it. The default is to use
1061 syslog facility <code>local7</code>, but you can override this by
1062 using the <code>syslog:<var>facility</var></code> syntax where
1063 <var>facility</var> can be one of the names usually documented in
1064 syslog(1). The facility is effectively global, and if it is changed
1065 in individual virtual hosts, the final facility specified affects the
1068 <example><title>Example</title>
1069 ErrorLog syslog:user
1072 <p>SECURITY: See the <a
1073 href="../misc/security_tips.html#serverroot">security tips</a>
1074 document for details on why your security could be compromised
1075 if the directory where log files are stored is writable by
1076 anyone other than the user that starts the server.</p>
1077 <note type="warning"><title>Note</title>
1078 <p>When entering a file path on non-Unix platforms, care should be taken
1079 to make sure that only forward slashed are used even though the platform
1080 may allow the use of back slashes. In general it is a good idea to always
1081 use forward slashes throughout the configuration files.</p>
1084 <seealso><directive module="core">LogLevel</directive></seealso>
1085 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1086 </directivesynopsis>
1089 <name>ErrorLogFormat</name>
1090 <description>Format specification for error log entries</description>
1091 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1092 <contextlist><context>server config</context><context>virtual host</context>
1094 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1097 <p><directive>ErrorLogFormat</directive> allows to specify what
1098 supplementary information is logged in the error log in addition to the
1099 actual log message.</p>
1101 <example><title>Simple example</title>
1102 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1105 <p>Specifying <code>connection</code> or <code>request</code> as first
1106 paramter allows to specify additional formats, causing additional
1107 information to be logged when the first message is logged for a specific
1108 connection or request, respectivly. This additional information is only
1109 logged once per connection/request. If a connection or request is processed
1110 without causing any log message, the additional information is not logged
1113 <p>It can happen that some format string items do not produce output. For
1114 example, the Referer header is only present if the log message is
1115 associated to a request and the log message happens at a time when the
1116 Referer header has already been read from the client. If no output is
1117 produced, the default behaviour is to delete everything from the preceeding
1118 space character to the next space character. This means the log line is
1119 implicitly divided into fields on non-whitespace to whitespace transitions.
1120 If a format string item does not produce output, the whole field is
1121 ommitted. For example, if the remote address <code>%a</code> in the log
1122 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1123 brackets are not logged either. Space characters can be escaped with a
1124 backslash to prevent them from delimiting a field. The combination '% '
1125 (percent space) is a zero-witdh field delimiter that does not produce any
1128 <p>The above behaviour can be changed by adding modifiers to the format
1129 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1130 respective item does not produce any output. In once-per-connection/request
1131 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1132 item with the plus modifier does not produce any output, the whole line is
1135 <p>A number as modifier can be used to assign a log severity level to a
1136 format item. The item will only be logged if the severity of the log
1137 message is not higher than the specified log severity level. The number can
1138 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1140 <p>Some format string items accept additional parameters in braces.</p>
1142 <table border="1" style="zebra">
1143 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1145 <tr><th>Format String</th> <th>Description</th></tr>
1147 <tr><td><code>%%</code></td>
1148 <td>The percent sign</td></tr>
1150 <tr><td><code>%...a</code></td>
1151 <td>Remote IP-address and port</td></tr>
1153 <tr><td><code>%...A</code></td>
1154 <td>Local IP-address and port</td></tr>
1156 <tr><td><code>%...{name}e</code></td>
1157 <td>Request environment variable <code>name</code></td></tr>
1159 <tr><td><code>%...E</code></td>
1160 <td>APR/OS error status code and string</td></tr>
1162 <tr><td><code>%...F</code></td>
1163 <td>Source file name and line number of the log call</td></tr>
1165 <tr><td><code>%...{name}i</code></td>
1166 <td>Request header <code>name</code></td></tr>
1168 <tr><td><code>%...k</code></td>
1169 <td>Number of keep-alive requests on this connection</td></tr>
1171 <tr><td><code>%...l</code></td>
1172 <td>Loglevel of the message</td></tr>
1174 <tr><td><code>%...L</code></td>
1175 <td>Log ID of the request</td></tr>
1177 <tr><td><code>%...{c}L</code></td>
1178 <td>Log ID of the connection</td></tr>
1180 <tr><td><code>%...{C}L</code></td>
1181 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1183 <tr><td><code>%...m</code></td>
1184 <td>Name of the module logging the message</td></tr>
1186 <tr><td><code>%M</code></td>
1187 <td>The actual log message</td></tr>
1189 <tr><td><code>%...{name}n</code></td>
1190 <td>Request note <code>name</code></td></tr>
1192 <tr><td><code>%...P</code></td>
1193 <td>Process ID of current process</td></tr>
1195 <tr><td><code>%...T</code></td>
1196 <td>Thread ID of current thread</td></tr>
1198 <tr><td><code>%...t</code></td>
1199 <td>The current time</td></tr>
1201 <tr><td><code>%...{u}t</code></td>
1202 <td>The current time including micro-seconds</td></tr>
1204 <tr><td><code>%...{cu}t</code></td>
1205 <td>The current time in compact ISO 8601 format, including
1206 micro-seconds</td></tr>
1208 <tr><td><code>%...v</code></td>
1209 <td>The canonical <directive module="core">ServerName</directive>
1210 of the current server.</td></tr>
1212 <tr><td><code>%...V</code></td>
1213 <td>The server name of the server serving the request according to the
1214 <directive module="core" >UseCanonicalName</directive>
1217 <tr><td><code>\ </code> (backslash space)</td>
1218 <td>Non-field delimiting space</td></tr>
1220 <tr><td><code>% </code> (percent space)</td>
1221 <td>Field delimiter (no output)</td></tr>
1224 <p>The log ID format <code>%L</code> produces a unique id for a connection
1225 or request. This can be used to correlate which log lines belong to the
1226 same connection or request, which request happens on which connection.
1227 A <code>%L</code> format string is also available in
1228 <module>mod_log_config</module>, to allow to correlate access log entries
1229 with error log lines. If <module>mod_unique_id</module> is loaded, its
1230 unique id will be used as log ID for requests.</p>
1232 <example><title>Example (somewhat similar to default format)</title>
1233 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1234 %M% ,\ referer\ %{Referer}i"
1237 <example><title>Example (similar to the 2.2.x format)</title>
1238 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1239 %M% ,\ referer\ %{Referer}i"
1242 <example><title>Advanced example with request/connection log IDs</title>
1243 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1244 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1245 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1246 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1247 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1251 <seealso><directive module="core">ErrorLog</directive></seealso>
1252 <seealso><directive module="core">LogLevel</directive></seealso>
1253 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1254 </directivesynopsis>
1257 <name>ExtendedStatus</name>
1258 <description>Keep track of extended status information for each
1259 request</description>
1260 <syntax>ExtendedStatus On|Off</syntax>
1261 <default>ExtendedStatus Off[*]</default>
1262 <contextlist><context>server config</context></contextlist>
1265 <p>This option tracks additional data per worker about the
1266 currently executing request, and a utilization summary; you
1267 can see these variables during runtime by configuring
1268 <module>mod_status</module>. Note that other modules may
1269 rely on this scoreboard.</p>
1271 <p>This setting applies to the entire server, and cannot be
1272 enabled or disabled on a virtualhost-by-virtualhost basis.
1273 The collection of extended status information can slow down
1274 the server. Also note that this setting cannot be changed
1275 during a graceful restart.</p>
1278 <p>Note that loading <module>mod_status</module> will change
1279 the default behavior to ExtendedStatus On, while other
1280 third party modules may do the same. Such modules rely on
1281 collecting detailed information about the state of all workers.
1282 The default is changed by <module>mod_status</module> beginning
1283 with version 2.3.6; the previous default was always Off.</p>
1288 </directivesynopsis>
1291 <name>FileETag</name>
1292 <description>File attributes used to create the ETag
1293 HTTP response header for static files</description>
1294 <syntax>FileETag <var>component</var> ...</syntax>
1295 <default>FileETag INode MTime Size</default>
1296 <contextlist><context>server config</context><context>virtual host</context>
1297 <context>directory</context><context>.htaccess</context>
1299 <override>FileInfo</override>
1303 The <directive>FileETag</directive> directive configures the file
1304 attributes that are used to create the <code>ETag</code> (entity
1305 tag) response header field when the document is based on a static file.
1306 (The <code>ETag</code> value is used in cache management to save
1307 network bandwidth.) The
1308 <directive>FileETag</directive> directive allows you to choose
1309 which of these -- if any -- should be used. The recognized keywords are:
1313 <dt><strong>INode</strong></dt>
1314 <dd>The file's i-node number will be included in the calculation</dd>
1315 <dt><strong>MTime</strong></dt>
1316 <dd>The date and time the file was last modified will be included</dd>
1317 <dt><strong>Size</strong></dt>
1318 <dd>The number of bytes in the file will be included</dd>
1319 <dt><strong>All</strong></dt>
1320 <dd>All available fields will be used. This is equivalent to:
1321 <example>FileETag INode MTime Size</example></dd>
1322 <dt><strong>None</strong></dt>
1323 <dd>If a document is file-based, no <code>ETag</code> field will be
1324 included in the response</dd>
1327 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1328 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1329 which allow changes to be made to the default setting inherited
1330 from a broader scope. Any keyword appearing without such a prefix
1331 immediately and completely cancels the inherited setting.</p>
1333 <p>If a directory's configuration includes
1334 <code>FileETag INode MTime Size</code>, and a
1335 subdirectory's includes <code>FileETag -INode</code>,
1336 the setting for that subdirectory (which will be inherited by
1337 any sub-subdirectories that don't override it) will be equivalent to
1338 <code>FileETag MTime Size</code>.</p>
1339 <note type="warning"><title>Warning</title>
1340 Do not change the default for directories or locations that have WebDAV
1341 enabled and use <module>mod_dav_fs</module> as a storage provider.
1342 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1343 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1344 These conditional requests will break if the <code>ETag</code> format is
1345 changed via <directive>FileETag</directive>.
1347 <note><title>Server Side Includes</title>
1348 An ETag is not generated for responses parsed by <module>mod_include</module>,
1349 since the response entity can change without a change of the INode, MTime, or Size
1350 of the static file with embedded SSI directives.
1354 </directivesynopsis>
1356 <directivesynopsis type="section">
1358 <description>Contains directives that apply to matched
1359 filenames</description>
1360 <syntax><Files <var>filename</var>> ... </Files></syntax>
1361 <contextlist><context>server config</context><context>virtual host</context>
1362 <context>directory</context><context>.htaccess</context>
1364 <override>All</override>
1367 <p>The <directive type="section">Files</directive> directive
1368 limits the scope of the enclosed directives by filename. It is comparable
1369 to the <directive module="core" type="section">Directory</directive>
1370 and <directive module="core" type="section">Location</directive>
1371 directives. It should be matched with a <code></Files></code>
1372 directive. The directives given within this section will be applied to
1373 any object with a basename (last component of filename) matching the
1374 specified filename. <directive type="section">Files</directive>
1375 sections are processed in the order they appear in the
1376 configuration file, after the <directive module="core"
1377 type="section">Directory</directive> sections and
1378 <code>.htaccess</code> files are read, but before <directive
1379 type="section" module="core">Location</directive> sections. Note
1380 that <directive type="section">Files</directive> can be nested
1381 inside <directive type="section"
1382 module="core">Directory</directive> sections to restrict the
1383 portion of the filesystem they apply to.</p>
1385 <p>The <var>filename</var> argument should include a filename, or
1386 a wild-card string, where <code>?</code> matches any single character,
1387 and <code>*</code> matches any sequences of characters.
1388 <glossary ref="regex">Regular expressions</glossary>
1389 can also be used, with the addition of the
1390 <code>~</code> character. For example:</p>
1393 <Files ~ "\.(gif|jpe?g|png)$">
1396 <p>would match most common Internet graphics formats. <directive
1397 module="core" type="section">FilesMatch</directive> is preferred,
1400 <p>Note that unlike <directive type="section"
1401 module="core">Directory</directive> and <directive type="section"
1402 module="core">Location</directive> sections, <directive
1403 type="section">Files</directive> sections can be used inside
1404 <code>.htaccess</code> files. This allows users to control access to
1405 their own files, at a file-by-file level.</p>
1408 <seealso><a href="../sections.html">How <Directory>, <Location>
1409 and <Files> sections work</a> for an explanation of how these
1410 different sections are combined when a request is received</seealso>
1411 </directivesynopsis>
1413 <directivesynopsis type="section">
1414 <name>FilesMatch</name>
1415 <description>Contains directives that apply to regular-expression matched
1416 filenames</description>
1417 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1418 <contextlist><context>server config</context><context>virtual host</context>
1419 <context>directory</context><context>.htaccess</context>
1421 <override>All</override>
1424 <p>The <directive type="section">FilesMatch</directive> directive
1425 limits the scope of the enclosed directives by filename, just as the
1426 <directive module="core" type="section">Files</directive> directive
1427 does. However, it accepts a <glossary ref="regex">regular
1428 expression</glossary>. For example:</p>
1431 <FilesMatch "\.(gif|jpe?g|png)$">
1434 <p>would match most common Internet graphics formats.</p>
1437 <seealso><a href="../sections.html">How <Directory>, <Location>
1438 and <Files> sections work</a> for an explanation of how these
1439 different sections are combined when a request is received</seealso>
1440 </directivesynopsis>
1443 <name>ForceType</name>
1444 <description>Forces all matching files to be served with the specified
1445 media type in the HTTP Content-Type header field</description>
1446 <syntax>ForceType <var>media-type</var>|None</syntax>
1447 <contextlist><context>directory</context><context>.htaccess</context>
1449 <override>FileInfo</override>
1450 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1453 <p>When placed into an <code>.htaccess</code> file or a
1454 <directive type="section" module="core">Directory</directive>, or
1455 <directive type="section" module="core">Location</directive> or
1456 <directive type="section" module="core">Files</directive>
1457 section, this directive forces all matching files to be served
1458 with the content type identification given by
1459 <var>media-type</var>. For example, if you had a directory full of
1460 GIF files, but did not want to label them all with <code>.gif</code>,
1461 you might want to use:</p>
1467 <p>Note that this directive overrides other indirect media type
1468 associations defined in mime.types or via the
1469 <directive module="mod_mime">AddType</directive>.</p>
1471 <p>You can also override more general
1472 <directive>ForceType</directive> settings
1473 by using the value of <code>None</code>:</p>
1476 # force all files to be image/gif:<br />
1477 <Location /images><br />
1479 ForceType image/gif<br />
1481 </Location><br />
1483 # but normal mime-type associations here:<br />
1484 <Location /images/mixed><br />
1486 ForceType None<br />
1491 <p>This directive primarily overrides the content types generated for
1492 static files served out of the filesystem. For resources other than
1493 static files, where the generator of the response typically specifies
1494 a Content-Type, this directive has no effect.</p>
1497 </directivesynopsis>
1499 <name>GprofDir</name>
1500 <description>Directory to write gmon.out profiling data to. </description>
1501 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1502 <contextlist><context>server config</context><context>virtual host</context>
1506 <p>When the server has been compiled with gprof profiling suppport,
1507 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1508 be written to the specified directory when the process exits. If the
1509 argument ends with a percent symbol ('%'), subdirectories are created
1510 for each process id.</p>
1512 <p>This directive currently only works with the <module>prefork</module>
1515 </directivesynopsis>
1518 <name>HostnameLookups</name>
1519 <description>Enables DNS lookups on client IP addresses</description>
1520 <syntax>HostnameLookups On|Off|Double</syntax>
1521 <default>HostnameLookups Off</default>
1522 <contextlist><context>server config</context><context>virtual host</context>
1523 <context>directory</context></contextlist>
1526 <p>This directive enables DNS lookups so that host names can be
1527 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1528 The value <code>Double</code> refers to doing double-reverse
1529 DNS lookup. That is, after a reverse lookup is performed, a forward
1530 lookup is then performed on that result. At least one of the IP
1531 addresses in the forward lookup must match the original
1532 address. (In "tcpwrappers" terminology this is called
1533 <code>PARANOID</code>.)</p>
1535 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1536 used for controlling access by hostname, a double reverse lookup
1537 will be performed. This is necessary for security. Note that the
1538 result of this double-reverse isn't generally available unless you
1539 set <code>HostnameLookups Double</code>. For example, if only
1540 <code>HostnameLookups On</code> and a request is made to an object
1541 that is protected by hostname restrictions, regardless of whether
1542 the double-reverse fails or not, CGIs will still be passed the
1543 single-reverse result in <code>REMOTE_HOST</code>.</p>
1545 <p>The default is <code>Off</code> in order to save the network
1546 traffic for those sites that don't truly need the reverse
1547 lookups done. It is also better for the end users because they
1548 don't have to suffer the extra latency that a lookup entails.
1549 Heavily loaded sites should leave this directive
1550 <code>Off</code>, since DNS lookups can take considerable
1551 amounts of time. The utility <program>logresolve</program>, compiled by
1552 default to the <code>bin</code> subdirectory of your installation
1553 directory, can be used to look up host names from logged IP addresses
1556 </directivesynopsis>
1558 <directivesynopsis type="section">
1560 <description>Contains directives that apply only if a condition is
1561 satisfied by a request at runtime</description>
1562 <syntax><If <var>expression</var>> ... </If></syntax>
1563 <contextlist><context>server config</context><context>virtual host</context>
1564 <context>directory</context><context>.htaccess</context>
1566 <override>All</override>
1569 <p>The <directive type="section">If</directive> directive
1570 evaluates an expression at runtime, and applies the enclosed
1571 directives if and only if the expression evaluates to true.
1575 <If "$req{Host} = ''">
1578 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1580 <p>You may compare the value of any variable in the request headers
1581 ($req), response headers ($resp) or environment ($env) in your
1584 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1585 operator to compare if the expression is in a given range:</p>
1588 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1593 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1594 for a complete reference and more examples.</seealso>
1595 <seealso><a href="../sections.html">How <Directory>, <Location>,
1596 <Files> sections work</a> for an explanation of how these
1597 different sections are combined when a request is received.
1598 <directive type="section">If</directive> has the same precedence
1599 and usage as <directive type="section">Files</directive></seealso>
1600 </directivesynopsis>
1602 <directivesynopsis type="section">
1603 <name>IfDefine</name>
1604 <description>Encloses directives that will be processed only
1605 if a test is true at startup</description>
1606 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1607 </IfDefine></syntax>
1608 <contextlist><context>server config</context><context>virtual host</context>
1609 <context>directory</context><context>.htaccess</context>
1611 <override>All</override>
1614 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1615 </code> section is used to mark directives that are conditional. The
1616 directives within an <directive type="section">IfDefine</directive>
1617 section are only processed if the <var>test</var> is true. If <var>
1618 test</var> is false, everything between the start and end markers is
1621 <p>The <var>test</var> in the <directive type="section"
1622 >IfDefine</directive> section directive can be one of two forms:</p>
1625 <li><var>parameter-name</var></li>
1627 <li><code>!</code><var>parameter-name</var></li>
1630 <p>In the former case, the directives between the start and end
1631 markers are only processed if the parameter named
1632 <var>parameter-name</var> is defined. The second format reverses
1633 the test, and only processes the directives if
1634 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1636 <p>The <var>parameter-name</var> argument is a define as given on the
1637 <program>httpd</program> command line via <code>-D<var>parameter</var>
1638 </code> at the time the server was started or by the <directive
1639 module="core">Define</directive> directive.</p>
1641 <p><directive type="section">IfDefine</directive> sections are
1642 nest-able, which can be used to implement simple
1643 multiple-parameter tests. Example:</p>
1646 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1649 <IfDefine ReverseProxy><br />
1651 LoadModule proxy_module modules/mod_proxy.so<br />
1652 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1653 <IfDefine UseCache><br />
1655 LoadModule cache_module modules/mod_cache.so<br />
1656 <IfDefine MemCache><br />
1658 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1660 </IfDefine><br />
1661 <IfDefine !MemCache><br />
1663 LoadModule cache_disk_module modules/mod_cache_disk.so<br />
1672 </directivesynopsis>
1674 <directivesynopsis type="section">
1675 <name>IfModule</name>
1676 <description>Encloses directives that are processed conditional on the
1677 presence or absence of a specific module</description>
1678 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1679 </IfModule></syntax>
1680 <contextlist><context>server config</context><context>virtual host</context>
1681 <context>directory</context><context>.htaccess</context>
1683 <override>All</override>
1684 <compatibility>Module identifiers are available in version 2.1 and
1685 later.</compatibility>
1688 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1689 section is used to mark directives that are conditional on the presence of
1690 a specific module. The directives within an <directive type="section"
1691 >IfModule</directive> section are only processed if the <var>test</var>
1692 is true. If <var>test</var> is false, everything between the start and
1693 end markers is ignored.</p>
1695 <p>The <var>test</var> in the <directive type="section"
1696 >IfModule</directive> section directive can be one of two forms:</p>
1699 <li><var>module</var></li>
1701 <li>!<var>module</var></li>
1704 <p>In the former case, the directives between the start and end
1705 markers are only processed if the module named <var>module</var>
1706 is included in Apache httpd -- either compiled in or
1707 dynamically loaded using <directive module="mod_so"
1708 >LoadModule</directive>. The second format reverses the test,
1709 and only processes the directives if <var>module</var> is
1710 <strong>not</strong> included.</p>
1712 <p>The <var>module</var> argument can be either the module identifier or
1713 the file name of the module, at the time it was compiled. For example,
1714 <code>rewrite_module</code> is the identifier and
1715 <code>mod_rewrite.c</code> is the file name. If a module consists of
1716 several source files, use the name of the file containing the string
1717 <code>STANDARD20_MODULE_STUFF</code>.</p>
1719 <p><directive type="section">IfModule</directive> sections are
1720 nest-able, which can be used to implement simple multiple-module
1723 <note>This section should only be used if you need to have one
1724 configuration file that works whether or not a specific module
1725 is available. In normal operation, directives need not be
1726 placed in <directive type="section">IfModule</directive>
1729 </directivesynopsis>
1732 <name>Include</name>
1733 <description>Includes other configuration files from within
1734 the server configuration files</description>
1735 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1736 <contextlist><context>server config</context><context>virtual host</context>
1737 <context>directory</context>
1739 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1740 wildcard matching available in 2.3.6 and later</compatibility>
1743 <p>This directive allows inclusion of other configuration files
1744 from within the server configuration files.</p>
1746 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1747 in the filename or directory parts of the path to include several files
1748 at once, in alphabetical order. In addition, if
1749 <directive>Include</directive> points to a directory, rather than a file,
1750 Apache httpd will read all files in that directory and any subdirectory.
1751 However, including entire directories is not recommended, because it is
1752 easy to accidentally leave temporary files in a directory that can cause
1753 <program>httpd</program> to fail. Instead, we encourage you to use the
1754 wildcard syntax shown below, to include files that match a particular
1755 pattern, such as *.conf, for example.</p>
1757 <p>When a wildcard is specified for a <strong>file</strong> component of
1758 the path, and no file matches the wildcard, the
1759 <directive module="core">Include</directive>
1760 directive will be <strong>silently ignored</strong>. When a wildcard is
1761 specified for a <strong>directory</strong> component of the path, and
1762 no directory matches the wildcard, the
1763 <directive module="core">Include</directive> directive will
1764 <strong>fail with an error</strong> saying the directory cannot be found.
1767 <p>For further control over the behaviour of the server when no files or
1768 directories match, prefix the path with the modifiers <var>optional</var>
1769 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1770 file or directory that does not match will be silently ignored. If
1771 <var>strict</var> is specified, any wildcard file or directory that does
1772 not match at least one file will cause server startup to fail.</p>
1774 <p>When a directory or file component of the path is
1775 specified exactly, and that directory or file does not exist,
1776 <directive module="core">Include</directive> directive will fail with an
1777 error saying the file or directory cannot be found.</p>
1779 <p>The file path specified may be an absolute path, or may be relative
1780 to the <directive module="core">ServerRoot</directive> directory.</p>
1785 Include /usr/local/apache2/conf/ssl.conf<br />
1786 Include /usr/local/apache2/conf/vhosts/*.conf
1789 <p>Or, providing paths relative to your <directive
1790 module="core">ServerRoot</directive> directory:</p>
1793 Include conf/ssl.conf<br />
1794 Include conf/vhosts/*.conf
1797 <p>Wildcards may be included in the directory or file portion of the
1798 path. In the following example, the server will fail to load if no
1799 directories match conf/vhosts/*, but will load successfully if no
1800 files match *.conf.</p>
1803 Include conf/vhosts/*/vhost.conf<br />
1804 Include conf/vhosts/*/*.conf
1807 <p>In this example, the server will fail to load if either
1808 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1811 Include strict conf/vhosts/*/*.conf
1814 <p>In this example, the server load successfully if either conf/vhosts/*
1815 matches no directories, or if *.conf matches no files:</p>
1818 Include optional conf/vhosts/*/*.conf
1823 <seealso><program>apachectl</program></seealso>
1824 </directivesynopsis>
1827 <name>KeepAlive</name>
1828 <description>Enables HTTP persistent connections</description>
1829 <syntax>KeepAlive On|Off</syntax>
1830 <default>KeepAlive On</default>
1831 <contextlist><context>server config</context><context>virtual host</context>
1835 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1836 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1837 which allow multiple requests to be sent over the same TCP
1838 connection. In some cases this has been shown to result in an
1839 almost 50% speedup in latency times for HTML documents with
1840 many images. To enable Keep-Alive connections, set
1841 <code>KeepAlive On</code>.</p>
1843 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1844 used if they are specifically requested by a client. In
1845 addition, a Keep-Alive connection with an HTTP/1.0 client can
1846 only be used when the length of the content is known in
1847 advance. This implies that dynamic content such as CGI output,
1848 SSI pages, and server-generated directory listings will
1849 generally not use Keep-Alive connections to HTTP/1.0 clients.
1850 For HTTP/1.1 clients, persistent connections are the default
1851 unless otherwise specified. If the client requests it, chunked
1852 encoding will be used in order to send content of unknown
1853 length over persistent connections.</p>
1855 <p>When a client uses a Keep-Alive connection it will be counted
1856 as a single "request" for the <directive module="mpm_common"
1857 >MaxConnectionsPerChild</directive> directive, regardless
1858 of how many requests are sent using the connection.</p>
1861 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1862 </directivesynopsis>
1865 <name>KeepAliveTimeout</name>
1866 <description>Amount of time the server will wait for subsequent
1867 requests on a persistent connection</description>
1868 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1869 <default>KeepAliveTimeout 5</default>
1870 <contextlist><context>server config</context><context>virtual host</context>
1872 <compatibility>Specifying a value in milliseconds is available in
1873 Apache httpd 2.3.2 and later</compatibility>
1876 <p>The number of seconds Apache httpd will wait for a subsequent
1877 request before closing the connection. By adding a postfix of ms the
1878 timeout can be also set in milliseconds. Once a request has been
1879 received, the timeout value specified by the
1880 <directive module="core">Timeout</directive> directive applies.</p>
1882 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1883 may cause performance problems in heavily loaded servers. The
1884 higher the timeout, the more server processes will be kept
1885 occupied waiting on connections with idle clients.</p>
1887 <p>In a name-based virtual host context, the value of the first
1888 defined virtual host (the default host) in a set of <directive
1889 module="core">NameVirtualHost</directive> will be used.
1890 The other values will be ignored.</p>
1892 </directivesynopsis>
1894 <directivesynopsis type="section">
1896 <description>Restrict enclosed access controls to only certain HTTP
1897 methods</description>
1898 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1899 </Limit></syntax>
1900 <contextlist><context>directory</context><context>.htaccess</context>
1902 <override>AuthConfig, Limit</override>
1905 <p>Access controls are normally effective for
1906 <strong>all</strong> access methods, and this is the usual
1907 desired behavior. <strong>In the general case, access control
1908 directives should not be placed within a
1909 <directive type="section">Limit</directive> section.</strong></p>
1911 <p>The purpose of the <directive type="section">Limit</directive>
1912 directive is to restrict the effect of the access controls to the
1913 nominated HTTP methods. For all other methods, the access
1914 restrictions that are enclosed in the <directive
1915 type="section">Limit</directive> bracket <strong>will have no
1916 effect</strong>. The following example applies the access control
1917 only to the methods <code>POST</code>, <code>PUT</code>, and
1918 <code>DELETE</code>, leaving all other methods unprotected:</p>
1921 <Limit POST PUT DELETE><br />
1923 Require valid-user<br />
1928 <p>The method names listed can be one or more of: <code>GET</code>,
1929 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1930 <code>CONNECT</code>, <code>OPTIONS</code>,
1931 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1932 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1933 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1934 case-sensitive.</strong> If <code>GET</code> is used it will also
1935 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1936 cannot be limited (see <directive module="core"
1937 >TraceEnable</directive>).</p>
1939 <note type="warning">A <directive type="section"
1940 module="core">LimitExcept</directive> section should always be
1941 used in preference to a <directive type="section">Limit</directive>
1942 section when restricting access, since a <directive type="section"
1943 module="core">LimitExcept</directive> section provides protection
1944 against arbitrary methods.</note>
1946 <p>The <directive type="section">Limit</directive> and
1947 <directive type="section" module="core">LimitExcept</directive>
1948 directives may be nested. In this case, each successive level of
1949 <directive type="section">Limit</directive> or <directive
1950 type="section" module="core">LimitExcept</directive> directives must
1951 further restrict the set of methods to which access controls apply.</p>
1953 <note type="warning">When using
1954 <directive type="section">Limit</directive> or
1955 <directive type="section">LimitExcept</directive> directives with
1956 the <directive module="mod_authz_core">Require</directive> directive,
1957 note that the first <directive module="mod_authz_core">Require</directive>
1958 to succeed authorizes the request, regardless of the presence of other
1959 <directive module="mod_authz_core">Require</directive> directives.</note>
1961 <p>For example, given the following configuration, all users will
1962 be authorized for <code>POST</code> requests, and the
1963 <code>Require group editors</code> directive will be ignored
1967 <LimitExcept GET>
1971 </LimitExcept><br />
1974 Require group editors
1979 </directivesynopsis>
1981 <directivesynopsis type="section">
1982 <name>LimitExcept</name>
1983 <description>Restrict access controls to all HTTP methods
1984 except the named ones</description>
1985 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1986 </LimitExcept></syntax>
1987 <contextlist><context>directory</context><context>.htaccess</context>
1989 <override>AuthConfig, Limit</override>
1992 <p><directive type="section">LimitExcept</directive> and
1993 <code></LimitExcept></code> are used to enclose
1994 a group of access control directives which will then apply to any
1995 HTTP access method <strong>not</strong> listed in the arguments;
1996 i.e., it is the opposite of a <directive type="section"
1997 module="core">Limit</directive> section and can be used to control
1998 both standard and nonstandard/unrecognized methods. See the
1999 documentation for <directive module="core"
2000 type="section">Limit</directive> for more details.</p>
2005 <LimitExcept POST GET><br />
2007 Require valid-user<br />
2009 </LimitExcept>
2013 </directivesynopsis>
2016 <name>LimitInternalRecursion</name>
2017 <description>Determine maximum number of internal redirects and nested
2018 subrequests</description>
2019 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2020 <default>LimitInternalRecursion 10</default>
2021 <contextlist><context>server config</context><context>virtual host</context>
2023 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
2026 <p>An internal redirect happens, for example, when using the <directive
2027 module="mod_actions">Action</directive> directive, which internally
2028 redirects the original request to a CGI script. A subrequest is Apache httpd's
2029 mechanism to find out what would happen for some URI if it were requested.
2030 For example, <module>mod_dir</module> uses subrequests to look for the
2031 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2034 <p><directive>LimitInternalRecursion</directive> prevents the server
2035 from crashing when entering an infinite loop of internal redirects or
2036 subrequests. Such loops are usually caused by misconfigurations.</p>
2038 <p>The directive stores two different limits, which are evaluated on
2039 per-request basis. The first <var>number</var> is the maximum number of
2040 internal redirects, that may follow each other. The second <var>number</var>
2041 determines, how deep subrequests may be nested. If you specify only one
2042 <var>number</var>, it will be assigned to both limits.</p>
2044 <example><title>Example</title>
2045 LimitInternalRecursion 5
2048 </directivesynopsis>
2051 <name>LimitRequestBody</name>
2052 <description>Restricts the total size of the HTTP request body sent
2053 from the client</description>
2054 <syntax>LimitRequestBody <var>bytes</var></syntax>
2055 <default>LimitRequestBody 0</default>
2056 <contextlist><context>server config</context><context>virtual host</context>
2057 <context>directory</context><context>.htaccess</context>
2059 <override>All</override>
2062 <p>This directive specifies the number of <var>bytes</var> from 0
2063 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2064 request body. See the note below for the limited applicability
2065 to proxy requests.</p>
2067 <p>The <directive>LimitRequestBody</directive> directive allows
2068 the user to set a limit on the allowed size of an HTTP request
2069 message body within the context in which the directive is given
2070 (server, per-directory, per-file or per-location). If the client
2071 request exceeds that limit, the server will return an error
2072 response instead of servicing the request. The size of a normal
2073 request message body will vary greatly depending on the nature of
2074 the resource and the methods allowed on that resource. CGI scripts
2075 typically use the message body for retrieving form information.
2076 Implementations of the <code>PUT</code> method will require
2077 a value at least as large as any representation that the server
2078 wishes to accept for that resource.</p>
2080 <p>This directive gives the server administrator greater
2081 control over abnormal client request behavior, which may be
2082 useful for avoiding some forms of denial-of-service
2085 <p>If, for example, you are permitting file upload to a particular
2086 location, and wish to limit the size of the uploaded file to 100K,
2087 you might use the following directive:</p>
2090 LimitRequestBody 102400
2093 <note><p>For a full description of how this directive is interpreted by
2094 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2098 </directivesynopsis>
2101 <name>LimitRequestFields</name>
2102 <description>Limits the number of HTTP request header fields that
2103 will be accepted from the client</description>
2104 <syntax>LimitRequestFields <var>number</var></syntax>
2105 <default>LimitRequestFields 100</default>
2106 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2109 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2110 32767. The default value is defined by the compile-time
2111 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2114 <p>The <directive>LimitRequestFields</directive> directive allows
2115 the server administrator to modify the limit on the number of
2116 request header fields allowed in an HTTP request. A server needs
2117 this value to be larger than the number of fields that a normal
2118 client request might include. The number of request header fields
2119 used by a client rarely exceeds 20, but this may vary among
2120 different client implementations, often depending upon the extent
2121 to which a user has configured their browser to support detailed
2122 content negotiation. Optional HTTP extensions are often expressed
2123 using request header fields.</p>
2125 <p>This directive gives the server administrator greater
2126 control over abnormal client request behavior, which may be
2127 useful for avoiding some forms of denial-of-service attacks.
2128 The value should be increased if normal clients see an error
2129 response from the server that indicates too many fields were
2130 sent in the request.</p>
2135 LimitRequestFields 50
2138 <note type="warning"><title>Warning</title>
2139 <p> When name-based virtual hosting is used, the value for this
2140 directive is taken from the default (first-listed) virtual host for the
2141 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2145 </directivesynopsis>
2148 <name>LimitRequestFieldSize</name>
2149 <description>Limits the size of the HTTP request header allowed from the
2150 client</description>
2151 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2152 <default>LimitRequestFieldSize 8190</default>
2153 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2156 <p>This directive specifies the number of <var>bytes</var>
2157 that will be allowed in an HTTP request header.</p>
2159 <p>The <directive>LimitRequestFieldSize</directive> directive
2160 allows the server administrator to reduce or increase the limit
2161 on the allowed size of an HTTP request header field. A server
2162 needs this value to be large enough to hold any one header field
2163 from a normal client request. The size of a normal request header
2164 field will vary greatly among different client implementations,
2165 often depending upon the extent to which a user has configured
2166 their browser to support detailed content negotiation. SPNEGO
2167 authentication headers can be up to 12392 bytes.</p>
2169 <p>This directive gives the server administrator greater
2170 control over abnormal client request behavior, which may be
2171 useful for avoiding some forms of denial-of-service attacks.</p>
2176 LimitRequestFieldSize 4094
2179 <note>Under normal conditions, the value should not be changed from
2182 <note type="warning"><title>Warning</title>
2183 <p> When name-based virtual hosting is used, the value for this
2184 directive is taken from the default (first-listed) virtual host for the
2185 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2189 </directivesynopsis>
2192 <name>LimitRequestLine</name>
2193 <description>Limit the size of the HTTP request line that will be accepted
2194 from the client</description>
2195 <syntax>LimitRequestLine <var>bytes</var></syntax>
2196 <default>LimitRequestLine 8190</default>
2197 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2200 <p>This directive sets the number of <var>bytes</var> that will be
2201 allowed on the HTTP request-line.</p>
2203 <p>The <directive>LimitRequestLine</directive> directive allows
2204 the server administrator to reduce or increase the limit on the allowed size
2205 of a client's HTTP request-line. Since the request-line consists of the
2206 HTTP method, URI, and protocol version, the
2207 <directive>LimitRequestLine</directive> directive places a
2208 restriction on the length of a request-URI allowed for a request
2209 on the server. A server needs this value to be large enough to
2210 hold any of its resource names, including any information that
2211 might be passed in the query part of a <code>GET</code> request.</p>
2213 <p>This directive gives the server administrator greater
2214 control over abnormal client request behavior, which may be
2215 useful for avoiding some forms of denial-of-service attacks.</p>
2220 LimitRequestLine 4094
2223 <note>Under normal conditions, the value should not be changed from
2226 <note type="warning"><title>Warning</title>
2227 <p> When name-based virtual hosting is used, the value for this
2228 directive is taken from the default (first-listed) virtual host for the
2229 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2233 </directivesynopsis>
2236 <name>LimitXMLRequestBody</name>
2237 <description>Limits the size of an XML-based request body</description>
2238 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2239 <default>LimitXMLRequestBody 1000000</default>
2240 <contextlist><context>server config</context><context>virtual host</context>
2241 <context>directory</context><context>.htaccess</context></contextlist>
2242 <override>All</override>
2245 <p>Limit (in bytes) on maximum size of an XML-based request
2246 body. A value of <code>0</code> will disable any checking.</p>
2251 LimitXMLRequestBody 0
2255 </directivesynopsis>
2257 <directivesynopsis type="section">
2258 <name>Location</name>
2259 <description>Applies the enclosed directives only to matching
2261 <syntax><Location
2262 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2263 <contextlist><context>server config</context><context>virtual host</context>
2267 <p>The <directive type="section">Location</directive> directive
2268 limits the scope of the enclosed directives by URL. It is similar to the
2269 <directive type="section" module="core">Directory</directive>
2270 directive, and starts a subsection which is terminated with a
2271 <code></Location></code> directive. <directive
2272 type="section">Location</directive> sections are processed in the
2273 order they appear in the configuration file, after the <directive
2274 type="section" module="core">Directory</directive> sections and
2275 <code>.htaccess</code> files are read, and after the <directive
2276 type="section" module="core">Files</directive> sections.</p>
2278 <p><directive type="section">Location</directive> sections operate
2279 completely outside the filesystem. This has several consequences.
2280 Most importantly, <directive type="section">Location</directive>
2281 directives should not be used to control access to filesystem
2282 locations. Since several different URLs may map to the same
2283 filesystem location, such access controls may by circumvented.</p>
2285 <note><title>When to use <directive
2286 type="section">Location</directive></title>
2288 <p>Use <directive type="section">Location</directive> to apply
2289 directives to content that lives outside the filesystem. For
2290 content that lives in the filesystem, use <directive
2291 type="section" module="core">Directory</directive> and <directive
2292 type="section" module="core">Files</directive>. An exception is
2293 <code><Location /></code>, which is an easy way to
2294 apply a configuration to the entire server.</p>
2297 <p>For all origin (non-proxy) requests, the URL to be matched is a
2298 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2299 port, or query string may be included.</em> For proxy requests, the
2300 URL to be matched is of the form
2301 <code>scheme://servername/path</code>, and you must include the
2304 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2305 any single character, and <code>*</code> matches any sequences of
2306 characters. Neither wildcard character matches a / in the URL-path.</p>
2308 <p><glossary ref="regex">Regular expressions</glossary>
2309 can also be used, with the addition of the <code>~</code>
2310 character. For example:</p>
2313 <Location ~ "/(extra|special)/data">
2316 <p>would match URLs that contained the substring <code>/extra/data</code>
2317 or <code>/special/data</code>. The directive <directive
2318 type="section" module="core">LocationMatch</directive> behaves
2319 identical to the regex version of <directive
2320 type="section">Location</directive>, and is preferred, for the
2321 simple reason that <code>~</code> is hard to distinguish from
2322 <code>-</code> in many fonts.</p>
2324 <p>The <directive type="section">Location</directive>
2325 functionality is especially useful when combined with the
2326 <directive module="core">SetHandler</directive>
2327 directive. For example, to enable status requests, but allow them
2328 only from browsers at <code>example.com</code>, you might use:</p>
2331 <Location /status><br />
2333 SetHandler server-status<br />
2334 Require host example.com<br />
2339 <note><title>Note about / (slash)</title>
2340 <p>The slash character has special meaning depending on where in a
2341 URL it appears. People may be used to its behavior in the filesystem
2342 where multiple adjacent slashes are frequently collapsed to a single
2343 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2344 <code>/home/foo</code>). In URL-space this is not necessarily true.
2345 The <directive type="section" module="core">LocationMatch</directive>
2346 directive and the regex version of <directive type="section"
2347 >Location</directive> require you to explicitly specify multiple
2348 slashes if that is your intention.</p>
2350 <p>For example, <code><LocationMatch ^/abc></code> would match
2351 the request URL <code>/abc</code> but not the request URL <code>
2352 //abc</code>. The (non-regex) <directive type="section"
2353 >Location</directive> directive behaves similarly when used for
2354 proxy requests. But when (non-regex) <directive type="section"
2355 >Location</directive> is used for non-proxy requests it will
2356 implicitly match multiple slashes with a single slash. For example,
2357 if you specify <code><Location /abc/def></code> and the
2358 request is to <code>/abc//def</code> then it will match.</p>
2361 <seealso><a href="../sections.html">How <Directory>, <Location>
2362 and <Files> sections work</a> for an explanation of how these
2363 different sections are combined when a request is received.</seealso>
2364 <seealso><directive module="core">LocationMatch</directive></seealso>
2365 </directivesynopsis>
2367 <directivesynopsis type="section">
2368 <name>LocationMatch</name>
2369 <description>Applies the enclosed directives only to regular-expression
2370 matching URLs</description>
2371 <syntax><LocationMatch
2372 <var>regex</var>> ... </LocationMatch></syntax>
2373 <contextlist><context>server config</context><context>virtual host</context>
2377 <p>The <directive type="section">LocationMatch</directive> directive
2378 limits the scope of the enclosed directives by URL, in an identical manner
2379 to <directive module="core" type="section">Location</directive>. However,
2380 it takes a <glossary ref="regex">regular expression</glossary>
2381 as an argument instead of a simple string. For example:</p>
2384 <LocationMatch "/(extra|special)/data">
2387 <p>would match URLs that contained the substring <code>/extra/data</code>
2388 or <code>/special/data</code>.</p>
2391 <seealso><a href="../sections.html">How <Directory>, <Location>
2392 and <Files> sections work</a> for an explanation of how these
2393 different sections are combined when a request is received</seealso>
2394 </directivesynopsis>
2397 <name>LogLevel</name>
2398 <description>Controls the verbosity of the ErrorLog</description>
2399 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2400 [<var>module</var>:<var>level</var>] ...
2402 <default>LogLevel warn</default>
2403 <contextlist><context>server config</context><context>virtual host</context>
2404 <context>directory</context>
2406 <compatibility>Per-module and per-directory configuration is available in
2407 Apache HTTP Server 2.3.6 and later</compatibility>
2410 <p><directive>LogLevel</directive> adjusts the verbosity of the
2411 messages recorded in the error logs (see <directive
2412 module="core">ErrorLog</directive> directive). The following
2413 <var>level</var>s are available, in order of decreasing
2417 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2420 <th><strong>Level</strong> </th>
2422 <th><strong>Description</strong> </th>
2424 <th><strong>Example</strong> </th>
2428 <td><code>emerg</code> </td>
2430 <td>Emergencies - system is unusable.</td>
2432 <td>"Child cannot open lock file. Exiting"</td>
2436 <td><code>alert</code> </td>
2438 <td>Action must be taken immediately.</td>
2440 <td>"getpwuid: couldn't determine user name from uid"</td>
2444 <td><code>crit</code> </td>
2446 <td>Critical Conditions.</td>
2448 <td>"socket: Failed to get a socket, exiting child"</td>
2452 <td><code>error</code> </td>
2454 <td>Error conditions.</td>
2456 <td>"Premature end of script headers"</td>
2460 <td><code>warn</code> </td>
2462 <td>Warning conditions.</td>
2464 <td>"child process 1234 did not exit, sending another
2469 <td><code>notice</code> </td>
2471 <td>Normal but significant condition.</td>
2473 <td>"httpd: caught SIGBUS, attempting to dump core in
2478 <td><code>info</code> </td>
2480 <td>Informational.</td>
2482 <td>"Server seems busy, (you may need to increase
2483 StartServers, or Min/MaxSpareServers)..."</td>
2487 <td><code>debug</code> </td>
2489 <td>Debug-level messages</td>
2491 <td>"Opening config file ..."</td>
2494 <td><code>trace1</code> </td>
2496 <td>Trace messages</td>
2498 <td>"proxy: FTP: control connection complete"</td>
2501 <td><code>trace2</code> </td>
2503 <td>Trace messages</td>
2505 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2508 <td><code>trace3</code> </td>
2510 <td>Trace messages</td>
2512 <td>"openssl: Handshake: start"</td>
2515 <td><code>trace4</code> </td>
2517 <td>Trace messages</td>
2519 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2522 <td><code>trace5</code> </td>
2524 <td>Trace messages</td>
2526 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2529 <td><code>trace6</code> </td>
2531 <td>Trace messages</td>
2533 <td>"cache lookup FAILED, forcing new map lookup"</td>
2536 <td><code>trace7</code> </td>
2538 <td>Trace messages, dumping large amounts of data</td>
2540 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2543 <td><code>trace8</code> </td>
2545 <td>Trace messages, dumping large amounts of data</td>
2547 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2551 <p>When a particular level is specified, messages from all
2552 other levels of higher significance will be reported as well.
2553 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2554 then messages with log levels of <code>notice</code> and
2555 <code>warn</code> will also be posted.</p>
2557 <p>Using a level of at least <code>crit</code> is
2566 <note><title>Note</title>
2567 <p>When logging to a regular file messages of the level
2568 <code>notice</code> cannot be suppressed and thus are always
2569 logged. However, this doesn't apply when logging is done
2570 using <code>syslog</code>.</p>
2573 <p>Specifying a level without a module name will reset the level
2574 for all modules to that level. Specifying a level with a module
2575 name will set the level for that module only. It is possible to
2576 use the module source file name, the module identifier, or the
2577 module identifier with the trailing <code>_module</code> omitted
2578 as module specification. This means the following three specifications
2582 LogLevel info ssl:warn<br />
2583 LogLevel info mod_ssl.c:warn<br />
2584 LogLevel info ssl_module:warn<br />
2587 <p>It is also possible to change the level per directory:</p>
2591 <Directory /usr/local/apache/htdocs/app><br />
2592 LogLevel debug<br />
2597 Per directory loglevel configuration only affects messages that are
2598 logged after the request has been parsed and that are associated with
2599 the request. Log messages which are associated with the connection or
2600 the server are not affected.
2603 </directivesynopsis>
2606 <name>MaxKeepAliveRequests</name>
2607 <description>Number of requests allowed on a persistent
2608 connection</description>
2609 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2610 <default>MaxKeepAliveRequests 100</default>
2611 <contextlist><context>server config</context><context>virtual host</context>
2615 <p>The <directive>MaxKeepAliveRequests</directive> directive
2616 limits the number of requests allowed per connection when
2617 <directive module="core" >KeepAlive</directive> is on. If it is
2618 set to <code>0</code>, unlimited requests will be allowed. We
2619 recommend that this setting be kept to a high value for maximum
2620 server performance.</p>
2625 MaxKeepAliveRequests 500
2628 </directivesynopsis>
2632 <description>Configures mutex mechanism and lock file directory for all
2633 or specified mutexes</description>
2634 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2635 <default>Mutex default</default>
2636 <contextlist><context>server config</context></contextlist>
2637 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2640 <p>The <directive>Mutex</directive> directive sets the mechanism,
2641 and optionally the lock file location, that httpd and modules use
2642 to serialize access to resources. Specify <code>default</code> as
2643 the first argument to change the settings for all mutexes; specify
2644 a mutex name (see table below) as the first argument to override
2645 defaults only for that mutex.</p>
2647 <p>The <directive>Mutex</directive> directive is typically used in
2648 the following exceptional situations:</p>
2651 <li>change the mutex mechanism when the default mechanism selected
2652 by <glossary>APR</glossary> has a functional or performance
2655 <li>change the directory used by file-based mutexes when the
2656 default directory does not support locking</li>
2659 <note><title>Supported modules</title>
2660 <p>This directive only configures mutexes which have been registered
2661 with the core server using the <code>ap_mutex_register()</code> API.
2662 All modules bundled with httpd support the <directive>Mutex</directive>
2663 directive, but third-party modules may not. Consult the documentation
2664 of the third-party module, which must indicate the mutex name(s) which
2665 can be configured if this directive is supported.</p>
2668 <p>The following mutex <em>mechanisms</em> are available:</p>
2670 <li><code>default | yes</code>
2671 <p>This selects the default locking implementation, as determined by
2672 <glossary>APR</glossary>. The default locking implementation can
2673 be displayed by running <program>httpd</program> with the
2674 <code>-V</code> option.</p></li>
2676 <li><code>none | no</code>
2677 <p>This effectively disables the mutex, and is only allowed for a
2678 mutex if the module indicates that it is a valid choice. Consult the
2679 module documentation for more information.</p></li>
2681 <li><code>posixsem</code>
2682 <p>This is a mutex variant based on a Posix semaphore.</p>
2684 <note type="warning"><title>Warning</title>
2685 <p>The semaphore ownership is not recovered if a thread in the process
2686 holding the mutex segfaults, resulting in a hang of the web server.</p>
2690 <li><code>sysvsem</code>
2691 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2693 <note type="warning"><title>Warning</title>
2694 <p>It is possible to "leak" SysV semaphores if processes crash
2695 before the semaphore is removed.</p>
2698 <note type="warning"><title>Security</title>
2699 <p>The semaphore API allows for a denial of service attack by any
2700 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2701 all CGIs, unless you use something like <program>suexec</program>
2702 or <code>cgiwrapper</code>).</p>
2706 <li><code>sem</code>
2707 <p>This selects the "best" available semaphore implementation, choosing
2708 between Posix and SystemV IPC semaphores, in that order.</p></li>
2710 <li><code>pthread</code>
2711 <p>This is a mutex variant based on cross-process Posix thread
2714 <note type="warning"><title>Warning</title>
2715 <p>On most systems, if a child process terminates abnormally while
2716 holding a mutex that uses this implementation, the server will deadlock
2717 and stop responding to requests. When this occurs, the server will
2718 require a manual restart to recover.</p>
2719 <p>Solaris is a notable exception as it provides a mechanism which
2720 usually allows the mutex to be recovered after a child process
2721 terminates abnormally while holding a mutex.</p>
2722 <p>If your system implements the
2723 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2724 to use the <code>pthread</code> option safely.</p>
2728 <li><code>fcntl:/path/to/mutex</code>
2729 <p>This is a mutex variant where a physical (lock-)file and the
2730 <code>fcntl()</code> function are used as the mutex.</p>
2732 <note type="warning"><title>Warning</title>
2733 <p>When multiple mutexes based on this mechanism are used within
2734 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2735 can be reported for valid mutex operations if <code>fcntl()</code>
2736 is not thread-aware, such as on Solaris.</p>
2740 <li><code>flock:/path/to/mutex</code>
2741 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2742 with the exception that the <code>flock()</code> function is used to
2743 provide file locking.</p></li>
2745 <li><code>file:/path/to/mutex</code>
2746 <p>This selects the "best" available file locking implementation,
2747 choosing between <code>fcntl</code> and <code>flock</code>, in that
2751 <p>Most mechanisms are only available on selected platforms, where the
2752 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2753 which aren't available on all platforms are <em>posixsem</em>,
2754 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2755 <em>flock</em>, and <em>file</em>.</p>
2757 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2758 the path, if provided, is a directory where the lock file will be created.
2759 The default directory is httpd's run-time file directory relative to
2760 <directive module="core">ServerRoot</directive>. Always use a local disk
2761 filesystem for <code>/path/to/mutex</code> and never a directory residing
2762 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2763 type, an optional instance string provided by the module, and unless the
2764 <code>OmitPID</code> keyword is specified, the process id of the httpd
2765 parent process will be appended to to make the file name unique, avoiding
2766 conflicts when multiple httpd instances share a lock file directory. For
2767 example, if the mutex name is <code>mpm-accept</code> and the lock file
2768 directory is <code>/var/httpd/locks</code>, the lock file name for the
2769 httpd instance with parent process id 12345 would be
2770 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2772 <note type="warning"><title>Security</title>
2773 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2774 directory such as <code>/var/tmp</code> because someone could create
2775 a denial of service attack and prevent the server from starting by
2776 creating a lockfile with the same name as the one the server will try
2780 <p>The following table documents the names of mutexes used by httpd
2781 and bundled modules.</p>
2783 <table border="1" style="zebra">
2787 <th>Protected resource</th>
2790 <td><code>mpm-accept</code></td>
2791 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2792 <td>incoming connections, to avoid the thundering herd problem;
2793 for more information, refer to the
2794 <a href="../misc/perf-tuning.html">performance tuning</a>
2798 <td><code>authdigest-client</code></td>
2799 <td><module>mod_auth_digest</module></td>
2800 <td>client list in shared memory</td>
2803 <td><code>authdigest-opaque</code></td>
2804 <td><module>mod_auth_digest</module></td>
2805 <td>counter in shared memory</td>
2808 <td><code>ldap-cache</code></td>
2809 <td><module>mod_ldap</module></td>
2810 <td>LDAP result cache</td>
2813 <td><code>rewrite-map</code></td>
2814 <td><module>mod_rewrite</module></td>
2815 <td>communication with external mapping programs, to avoid
2816 intermixed I/O from multiple requests</td>
2819 <td><code>ssl-cache</code></td>
2820 <td><module>mod_ssl</module></td>
2821 <td>SSL session cache</td>
2824 <td><code>ssl-stapling</code></td>
2825 <td><module>mod_ssl</module></td>
2826 <td>OCSP stapling response cache</td>
2829 <td><code>watchdog-callback</code></td>
2830 <td><module>mod_watchdog</module></td>
2831 <td>callback function of a particular client module</td>
2835 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2836 parent process id from the lock file name.</p>
2838 <p>In the following example, the mutex mechanism for the MPM accept
2839 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2840 with the associated lock file created in directory
2841 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2842 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2845 Mutex default sysvsem<br />
2846 Mutex mpm-accept fcntl:/var/httpd/locks
2849 </directivesynopsis>
2852 <name>NameVirtualHost</name>
2853 <description>Designates an IP address for name-virtual
2854 hosting</description>
2855 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2856 <contextlist><context>server config</context></contextlist>
2860 <p>A single <directive>NameVirtualHost</directive> directive
2861 identifies a set of identical virtual hosts on which the server will
2862 further select from on the basis of the <em>hostname</em>
2863 requested by the client. The <directive>NameVirtualHost</directive>
2864 directive is a required directive if you want to configure
2865 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2867 <p>This directive, and the corresponding <directive >VirtualHost</directive>,
2868 <em>must</em> be qualified with a port number if the server supports both HTTP
2869 and HTTPS connections.</p>
2871 <p>Although <var>addr</var> can be a hostname, it is recommended
2872 that you always use an IP address or a wildcard. A wildcard
2873 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2874 as their argument.</p>
2876 <p>In cases where a firewall or other proxy receives the requests and
2877 forwards them on a different IP address to the server, you must specify the
2878 IP address of the physical interface on the machine which will be
2879 servicing the requests. </p>
2881 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2882 will only select among the first two virtual hosts. Requests received on
2883 port 80 on any other interface will only select among the third and fourth
2884 virtual hosts. In the common case where the interface isn't important
2885 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2889 NameVirtualHost 192.0.2.1:80<br />
2890 NameVirtualHost *:80<br /><br />
2892 <VirtualHost 192.0.2.1:80><br />
2893 ServerName namebased-a.example.com<br />
2894 </VirtualHost><br />
2896 <VirtualHost 192.0.2.1:80><br />
2897 Servername namebased-b.example.com<br />
2898 </VirtualHost><br />
2900 <VirtualHost *:80><br />
2901 ServerName namebased-c.example.com <br />
2902 </VirtualHost><br />
2904 <VirtualHost *:80><br />
2905 ServerName namebased-d.example.com <br />
2906 </VirtualHost><br />
2911 <p>If no matching virtual host is found, then the first listed
2912 virtual host that matches the IP address and port will be used.</p>
2915 <p>IPv6 addresses must be enclosed in square brackets, as shown
2916 in the following example:</p>
2919 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2922 <note><title>Argument to <directive type="section">VirtualHost</directive>
2924 <p>Note that the argument to the <directive
2925 type="section">VirtualHost</directive> directive must
2926 exactly match the argument to the <directive
2927 >NameVirtualHost</directive> directive.</p>
2930 NameVirtualHost 192.0.2.2:80<br />
2931 <VirtualHost 192.0.2.2:80><br />
2933 </VirtualHost><br />
2938 <seealso><a href="../vhosts/">Virtual Hosts
2939 documentation</a></seealso>
2941 </directivesynopsis>
2944 <name>Options</name>
2945 <description>Configures what features are available in a particular
2946 directory</description>
2948 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2949 <default>Options All</default>
2950 <contextlist><context>server config</context><context>virtual host</context>
2951 <context>directory</context><context>.htaccess</context>
2953 <override>Options</override>
2956 <p>The <directive>Options</directive> directive controls which
2957 server features are available in a particular directory.</p>
2959 <p><var>option</var> can be set to <code>None</code>, in which
2960 case none of the extra features are enabled, or one or more of
2964 <dt><code>All</code></dt>
2966 <dd>All options except for <code>MultiViews</code>. This is the default
2969 <dt><code>ExecCGI</code></dt>
2972 Execution of CGI scripts using <module>mod_cgi</module>
2975 <dt><code>FollowSymLinks</code></dt>
2979 The server will follow symbolic links in this directory.
2981 <p>Even though the server follows the symlink it does <em>not</em>
2982 change the pathname used to match against <directive type="section"
2983 module="core">Directory</directive> sections.</p>
2984 <p>Note also, that this option <strong>gets ignored</strong> if set
2985 inside a <directive type="section" module="core">Location</directive>
2987 <p>Omitting this option should not be considered a security restriction,
2988 since symlink testing is subject to race conditions that make it
2992 <dt><code>Includes</code></dt>
2995 Server-side includes provided by <module>mod_include</module>
2998 <dt><code>IncludesNOEXEC</code></dt>
3002 Server-side includes are permitted, but the <code>#exec
3003 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3004 possible to <code>#include virtual</code> CGI scripts from
3005 <directive module="mod_alias">ScriptAlias</directive>ed
3008 <dt><code>Indexes</code></dt>
3011 If a URL which maps to a directory is requested, and there
3012 is no <directive module="mod_dir">DirectoryIndex</directive>
3013 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3014 <module>mod_autoindex</module> will return a formatted listing
3015 of the directory.</dd>
3017 <dt><code>MultiViews</code></dt>
3020 <a href="../content-negotiation.html">Content negotiated</a>
3021 "MultiViews" are allowed using
3022 <module>mod_negotiation</module>.
3023 <note><title>Note</title> <p>This option gets ignored if set
3024 anywhere other than <directive module="core" type="section"
3025 >Directory</directive>, as <module>mod_negotiation</module>
3026 needs real resources to compare against and evaluate from.</p></note>
3029 <dt><code>SymLinksIfOwnerMatch</code></dt>
3031 <dd>The server will only follow symbolic links for which the
3032 target file or directory is owned by the same user id as the
3035 <note><title>Note</title> <p>This option gets ignored if
3036 set inside a <directive module="core"
3037 type="section">Location</directive> section.</p>
3038 <p>This option should not be considered a security restriction,
3039 since symlink testing is subject to race conditions that make it
3040 circumventable.</p></note>
3044 <p>Normally, if multiple <directive>Options</directive> could
3045 apply to a directory, then the most specific one is used and
3046 others are ignored; the options are not merged. (See <a
3047 href="../sections.html#mergin">how sections are merged</a>.)
3048 However if <em>all</em> the options on the
3049 <directive>Options</directive> directive are preceded by a
3050 <code>+</code> or <code>-</code> symbol, the options are
3051 merged. Any options preceded by a <code>+</code> are added to the
3052 options currently in force, and any options preceded by a
3053 <code>-</code> are removed from the options currently in
3056 <note type="warning"><title>Warning</title>
3057 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3058 <code>-</code> with those without is not valid syntax, and is likely
3059 to cause unexpected results.</p>
3062 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3065 <Directory /web/docs><br />
3067 Options Indexes FollowSymLinks<br />
3069 </Directory><br />
3071 <Directory /web/docs/spec><br />
3073 Options Includes<br />
3078 <p>then only <code>Includes</code> will be set for the
3079 <code>/web/docs/spec</code> directory. However if the second
3080 <directive>Options</directive> directive uses the <code>+</code> and
3081 <code>-</code> symbols:</p>
3084 <Directory /web/docs><br />
3086 Options Indexes FollowSymLinks<br />
3088 </Directory><br />
3090 <Directory /web/docs/spec><br />
3092 Options +Includes -Indexes<br />
3097 <p>then the options <code>FollowSymLinks</code> and
3098 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3101 <note><title>Note</title>
3102 <p>Using <code>-IncludesNOEXEC</code> or
3103 <code>-Includes</code> disables server-side includes completely
3104 regardless of the previous setting.</p>
3107 <p>The default in the absence of any other settings is
3108 <code>All</code>.</p>
3110 </directivesynopsis>
3113 <name>Protocol</name>
3114 <description>Protocol for a listening socket</description>
3115 <syntax>Protocol <var>protocol</var></syntax>
3116 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3117 <compatibility>Available in Apache 2.1.5 and later.
3118 On Windows from Apache 2.3.3 and later.</compatibility>
3121 <p>This directive specifies the protocol used for a specific listening socket.
3122 The protocol is used to determine which module should handle a request, and
3123 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3126 <p>You only need to set the protocol if you are running on non-standard ports, otherwise <code>http</code> is assumed for port 80 and <code>https</code> for port 443.</p>
3128 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3134 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3136 <seealso><directive>AcceptFilter</directive></seealso>
3137 <seealso><directive module="mpm_common">Listen</directive></seealso>
3138 </directivesynopsis>
3142 <name>RLimitCPU</name>
3143 <description>Limits the CPU consumption of processes launched
3144 by Apache httpd children</description>
3145 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3146 <default>Unset; uses operating system defaults</default>
3147 <contextlist><context>server config</context><context>virtual host</context>
3148 <context>directory</context><context>.htaccess</context></contextlist>
3149 <override>All</override>
3152 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3153 resource limit for all processes and the second parameter sets
3154 the maximum resource limit. Either parameter can be a number,
3155 or <code>max</code> to indicate to the server that the limit should
3156 be set to the maximum allowed by the operating system
3157 configuration. Raising the maximum resource limit requires that
3158 the server is running as <code>root</code>, or in the initial startup
3161 <p>This applies to processes forked off from Apache httpd children
3162 servicing requests, not the Apache httpd children themselves. This
3163 includes CGI scripts and SSI exec commands, but not any
3164 processes forked off from the Apache httpd parent such as piped
3167 <p>CPU resource limits are expressed in seconds per
3170 <seealso><directive module="core">RLimitMEM</directive></seealso>
3171 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3172 </directivesynopsis>
3175 <name>RLimitMEM</name>
3176 <description>Limits the memory consumption of processes launched
3177 by Apache httpd children</description>
3178 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3179 <default>Unset; uses operating system defaults</default>
3180 <contextlist><context>server config</context><context>virtual host</context>
3181 <context>directory</context><context>.htaccess</context></contextlist>
3182 <override>All</override>
3185 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3186 resource limit for all processes and the second parameter sets
3187 the maximum resource limit. Either parameter can be a number,
3188 or <code>max</code> to indicate to the server that the limit should
3189 be set to the maximum allowed by the operating system
3190 configuration. Raising the maximum resource limit requires that
3191 the server is running as <code>root</code>, or in the initial startup
3194 <p>This applies to processes forked off from Apache httpd children
3195 servicing requests, not the Apache httpd children themselves. This
3196 includes CGI scripts and SSI exec commands, but not any
3197 processes forked off from the Apache httpd parent such as piped
3200 <p>Memory resource limits are expressed in bytes per
3203 <seealso><directive module="core">RLimitCPU</directive></seealso>
3204 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3205 </directivesynopsis>
3208 <name>RLimitNPROC</name>
3209 <description>Limits the number of processes that can be launched by
3210 processes launched by Apache httpd children</description>
3211 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3212 <default>Unset; uses operating system defaults</default>
3213 <contextlist><context>server config</context><context>virtual host</context>
3214 <context>directory</context><context>.htaccess</context></contextlist>
3215 <override>All</override>
3218 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3219 resource limit for all processes and the second parameter sets
3220 the maximum resource limit. Either parameter can be a number,
3221 or <code>max</code> to indicate to the server that the limit
3222 should be set to the maximum allowed by the operating system
3223 configuration. Raising the maximum resource limit requires that
3224 the server is running as <code>root</code>, or in the initial startup
3227 <p>This applies to processes forked off from Apache httpd children
3228 servicing requests, not the Apache httpd children themselves. This
3229 includes CGI scripts and SSI exec commands, but not any
3230 processes forked off from the Apache httpd parent such as piped
3233 <p>Process limits control the number of processes per user.</p>
3235 <note><title>Note</title>
3236 <p>If CGI processes are <strong>not</strong> running
3237 under user ids other than the web server user id, this directive
3238 will limit the number of processes that the server itself can
3239 create. Evidence of this situation will be indicated by
3240 <strong><code>cannot fork</code></strong> messages in the
3241 <code>error_log</code>.</p>
3244 <seealso><directive module="core">RLimitMEM</directive></seealso>
3245 <seealso><directive module="core">RLimitCPU</directive></seealso>
3246 </directivesynopsis>
3249 <name>ScriptInterpreterSource</name>
3250 <description>Technique for locating the interpreter for CGI
3251 scripts</description>
3252 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3253 <default>ScriptInterpreterSource Script</default>
3254 <contextlist><context>server config</context><context>virtual host</context>
3255 <context>directory</context><context>.htaccess</context></contextlist>
3256 <override>FileInfo</override>
3257 <compatibility>Win32 only;
3258 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3259 later</compatibility>
3262 <p>This directive is used to control how Apache httpd finds the
3263 interpreter used to run CGI scripts. The default setting is
3264 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3265 by the shebang line (first line, starting with <code>#!</code>) in the
3266 script. On Win32 systems this line usually looks like:</p>
3269 #!C:/Perl/bin/perl.exe
3272 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3278 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3279 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3280 searched using the script file extension (e.g., <code>.pl</code>) as a
3281 search key. The command defined by the registry subkey
3282 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3283 <code>Shell\Open\Command</code> is used to open the script file. If the
3284 registry keys cannot be found, Apache httpd falls back to the behavior of the
3285 <code>Script</code> option.</p>
3287 <note type="warning"><title>Security</title>
3288 <p>Be careful when using <code>ScriptInterpreterSource
3289 Registry</code> with <directive
3290 module="mod_alias">ScriptAlias</directive>'ed directories, because
3291 Apache httpd will try to execute <strong>every</strong> file within this
3292 directory. The <code>Registry</code> setting may cause undesired
3293 program calls on files which are typically not executed. For
3294 example, the default open command on <code>.htm</code> files on
3295 most Windows systems will execute Microsoft Internet Explorer, so
3296 any HTTP request for an <code>.htm</code> file existing within the
3297 script directory would start the browser in the background on the
3298 server. This is a good way to crash your system within a minute or
3302 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3303 2.0 does the same thing as <code>Registry</code> but uses only the
3304 subkey <code>Shell\ExecCGI\Command</code>. The
3305 <code>ExecCGI</code> key is not a common one. It must be
3306 configured manually in the windows registry and hence prevents
3307 accidental program calls on your system.</p>
3309 </directivesynopsis>
3312 <name>SeeRequestTail</name>
3313 <description>Determine if mod_status displays the first 63 characters
3314 of a request or the last 63, assuming the request itself is greater than
3315 63 chars.</description>
3316 <syntax>SeeRequestTail On|Off</syntax>
3317 <default>SeeRequestTail Off</default>
3318 <contextlist><context>server config</context></contextlist>
3319 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3322 <p>mod_status with <code>ExtendedStatus On</code>
3323 displays the actual request being handled.
3324 For historical purposes, only 63 characters of the request
3325 are actually stored for display purposes. This directive
3326 controls whether the 1st 63 characters are stored (the previous
3327 behavior and the default) or if the last 63 characters are. This
3328 is only applicable, of course, if the length of the request is
3329 64 characters or greater.</p>
3331 <p>If Apache httpd is handling <code
3332 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3333 > mod_status displays as follows:
3338 <th>Off (default)</th>
3339 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3343 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3348 </directivesynopsis>
3351 <name>ServerAdmin</name>
3352 <description>Email address that the server includes in error
3353 messages sent to the client</description>
3354 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3355 <contextlist><context>server config</context><context>virtual host</context>
3359 <p>The <directive>ServerAdmin</directive> sets the contact address
3360 that the server includes in any error messages it returns to the
3361 client. If the <code>httpd</code> doesn't recognize the supplied argument
3363 assumes, that it's an <var>email-address</var> and prepends it with
3364 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3365 actually use an email address, since there are a lot of CGI scripts that
3366 make that assumption. If you want to use an URL, it should point to another
3367 server under your control. Otherwise users may not be able to contact you in
3370 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3373 ServerAdmin www-admin@foo.example.com
3375 <p>as users do not always mention that they are talking about the
3378 </directivesynopsis>
3381 <name>ServerAlias</name>
3382 <description>Alternate names for a host used when matching requests
3383 to name-virtual hosts</description>
3384 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3385 <contextlist><context>virtual host</context></contextlist>
3388 <p>The <directive>ServerAlias</directive> directive sets the
3389 alternate names for a host, for use with <a
3390 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3391 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3394 <VirtualHost *:80><br />
3395 ServerName server.domain.com<br />
3396 ServerAlias server server2.domain.com server2<br />
3397 ServerAlias *.example.com<br />
3398 UseCanonicalName Off<br />
3400 </VirtualHost>
3403 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3404 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3405 </directivesynopsis>
3408 <name>ServerName</name>
3409 <description>Hostname and port that the server uses to identify
3410 itself</description>
3411 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3412 <contextlist><context>server config</context><context>virtual host</context>
3416 <p>The <directive>ServerName</directive> directive sets the
3417 request scheme, hostname and
3418 port that the server uses to identify itself. This is used when
3419 creating redirection URLs.</p>
3421 <p>Additionally, <directive>ServerName</directive> is used (possibly
3422 in conjunction with <directive>ServerAlias</directive>) to uniquely
3423 identify a virtual host, when using <a
3424 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3426 <p>For example, if the name of the
3427 machine hosting the web server is <code>simple.example.com</code>,
3428 but the machine also has the DNS alias <code>www.example.com</code>
3429 and you wish the web server to be so identified, the following
3430 directive should be used:</p>
3433 ServerName www.example.com:80
3436 <p>The <directive>ServerName</directive> directive
3437 may appear anywhere within the definition of a server. However,
3438 each appearance overrides the previous appearance (within that
3441 <p>If no <directive>ServerName</directive> is specified, then the
3442 server attempts to deduce the hostname by performing a reverse
3443 lookup on the IP address. If no port is specified in the
3444 <directive>ServerName</directive>, then the server will use the
3445 port from the incoming request. For optimal reliability and
3446 predictability, you should specify an explicit hostname and port
3447 using the <directive>ServerName</directive> directive.</p>
3449 <p>If you are using <a
3450 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3451 the <directive>ServerName</directive> inside a
3452 <directive type="section" module="core">VirtualHost</directive>
3453 section specifies what hostname must appear in the request's
3454 <code>Host:</code> header to match this virtual host.</p>
3456 <p>Sometimes, the server runs behind a device that processes SSL,
3457 such as a reverse proxy, load balancer or SSL offload
3458 appliance. When this is the case, specify the
3459 <code>https://</code> scheme and the port number to which the
3460 clients connect in the <directive>ServerName</directive> directive
3461 to make sure that the server generates the correct
3462 self-referential URLs.
3465 <p>See the description of the
3466 <directive module="core">UseCanonicalName</directive> and
3467 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3468 settings which determine whether self-referential URLs (e.g., by the
3469 <module>mod_dir</module> module) will refer to the
3470 specified port, or to the port number given in the client's request.
3473 <note type="warning">
3474 <p>Failure to set <directive>ServerName</directive> to a name that
3475 your server can resolve to an IP address will result in a startup
3476 warning. <code>httpd</code> will then use whatever hostname it can
3477 determine, using the system's <code>hostname</code> command. This
3478 will almost never be the hostname you actually want.</p>
3480 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3486 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3487 Apache HTTP Server</a></seealso>
3488 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3489 documentation</a></seealso>
3490 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3491 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3492 <seealso><directive module="core">NameVirtualHost</directive></seealso>
3493 <seealso><directive module="core">ServerAlias</directive></seealso>
3494 </directivesynopsis>
3497 <name>ServerPath</name>
3498 <description>Legacy URL pathname for a name-based virtual host that
3499 is accessed by an incompatible browser</description>
3500 <syntax>ServerPath <var>URL-path</var></syntax>
3501 <contextlist><context>virtual host</context></contextlist>
3504 <p>The <directive>ServerPath</directive> directive sets the legacy
3505 URL pathname for a host, for use with <a
3506 href="../vhosts/">name-based virtual hosts</a>.</p>
3508 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3509 </directivesynopsis>
3512 <name>ServerRoot</name>
3513 <description>Base directory for the server installation</description>
3514 <syntax>ServerRoot <var>directory-path</var></syntax>
3515 <default>ServerRoot /usr/local/apache</default>
3516 <contextlist><context>server config</context></contextlist>
3519 <p>The <directive>ServerRoot</directive> directive sets the
3520 directory in which the server lives. Typically it will contain the
3521 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3522 paths in other configuration directives (such as <directive
3523 module="core">Include</directive> or <directive
3524 module="mod_so">LoadModule</directive>, for example) are taken as
3525 relative to this directory.</p>
3527 <example><title>Example</title>
3528 ServerRoot /home/httpd
3532 <seealso><a href="../invoking.html">the <code>-d</code>
3533 option to <code>httpd</code></a></seealso>
3534 <seealso><a href="../misc/security_tips.html#serverroot">the
3535 security tips</a> for information on how to properly set
3536 permissions on the <directive>ServerRoot</directive></seealso>
3537 </directivesynopsis>
3540 <name>ServerSignature</name>
3541 <description>Configures the footer on server-generated documents</description>
3542 <syntax>ServerSignature On|Off|EMail</syntax>
3543 <default>ServerSignature Off</default>
3544 <contextlist><context>server config</context><context>virtual host</context>
3545 <context>directory</context><context>.htaccess</context>
3547 <override>All</override>
3550 <p>The <directive>ServerSignature</directive> directive allows the
3551 configuration of a trailing footer line under server-generated
3552 documents (error messages, <module>mod_proxy</module> ftp directory
3553 listings, <module>mod_info</module> output, ...). The reason why you
3554 would want to enable such a footer line is that in a chain of proxies,
3555 the user often has no possibility to tell which of the chained servers
3556 actually produced a returned error message.</p>
3558 <p>The <code>Off</code>
3559 setting, which is the default, suppresses the footer line (and is
3560 therefore compatible with the behavior of Apache-1.2 and
3561 below). The <code>On</code> setting simply adds a line with the
3562 server version number and <directive
3563 module="core">ServerName</directive> of the serving virtual host,
3564 and the <code>EMail</code> setting additionally creates a
3565 "mailto:" reference to the <directive
3566 module="core">ServerAdmin</directive> of the referenced
3569 <p>After version 2.0.44, the details of the server version number
3570 presented are controlled by the <directive
3571 module="core">ServerTokens</directive> directive.</p>
3573 <seealso><directive module="core">ServerTokens</directive></seealso>
3574 </directivesynopsis>
3577 <name>ServerTokens</name>
3578 <description>Configures the <code>Server</code> HTTP response
3579 header</description>
3580 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3581 <default>ServerTokens Full</default>
3582 <contextlist><context>server config</context></contextlist>
3585 <p>This directive controls whether <code>Server</code> response
3586 header field which is sent back to clients includes a
3587 description of the generic OS-type of the server as well as
3588 information about compiled-in modules.</p>
3591 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3593 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3594 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3596 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3598 <dd>Server sends (<em>e.g.</em>): <code>Server:
3601 <dt><code>ServerTokens Major</code></dt>
3603 <dd>Server sends (<em>e.g.</em>): <code>Server:
3604 Apache/2</code></dd>
3606 <dt><code>ServerTokens Minor</code></dt>
3608 <dd>Server sends (<em>e.g.</em>): <code>Server:
3609 Apache/2.4</code></dd>
3611 <dt><code>ServerTokens Min[imal]</code></dt>
3613 <dd>Server sends (<em>e.g.</em>): <code>Server:
3614 Apache/2.4.1</code></dd>
3616 <dt><code>ServerTokens OS</code></dt>
3618 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3623 <p>This setting applies to the entire server, and cannot be
3624 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3626 <p>After version 2.0.44, this directive also controls the
3627 information presented by the <directive
3628 module="core">ServerSignature</directive> directive.</p>
3630 <note>Setting <directive>ServerTokens</directive> to less than
3631 <code>minimal</code> is not recommended because it makes it more
3632 difficult to debug interoperational problems. Also note that
3633 disabling the Server: header does nothing at all to make your
3634 server more secure; the idea of "security through obscurity"
3635 is a myth and leads to a false sense of safety.</note>
3638 <seealso><directive module="core">ServerSignature</directive></seealso>
3639 </directivesynopsis>
3642 <name>SetHandler</name>
3643 <description>Forces all matching files to be processed by a
3644 handler</description>
3645 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3646 <contextlist><context>server config</context><context>virtual host</context>
3647 <context>directory</context><context>.htaccess</context>
3649 <override>FileInfo</override>
3650 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3653 <p>When placed into an <code>.htaccess</code> file or a
3654 <directive type="section" module="core">Directory</directive> or
3655 <directive type="section" module="core">Location</directive>
3656 section, this directive forces all matching files to be parsed
3657 through the <a href="../handler.html">handler</a> given by
3658 <var>handler-name</var>. For example, if you had a directory you
3659 wanted to be parsed entirely as imagemap rule files, regardless
3660 of extension, you might put the following into an
3661 <code>.htaccess</code> file in that directory:</p>
3664 SetHandler imap-file
3667 <p>Another example: if you wanted to have the server display a
3668 status report whenever a URL of
3669 <code>http://servername/status</code> was called, you might put
3670 the following into <code>httpd.conf</code>:</p>
3673 <Location /status><br />
3675 SetHandler server-status<br />
3680 <p>You can override an earlier defined <directive>SetHandler</directive>
3681 directive by using the value <code>None</code>.</p>
3682 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3683 normal behaviour such as handling of URLs ending in a slash (/) as
3684 directories or index files is suppressed.</p>
3687 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3689 </directivesynopsis>
3692 <name>SetInputFilter</name>
3693 <description>Sets the filters that will process client requests and POST
3695 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3696 <contextlist><context>server config</context><context>virtual host</context>
3697 <context>directory</context><context>.htaccess</context>
3699 <override>FileInfo</override>
3702 <p>The <directive>SetInputFilter</directive> directive sets the
3703 filter or filters which will process client requests and POST
3704 input when they are received by the server. This is in addition to
3705 any filters defined elsewhere, including the
3706 <directive module="mod_mime">AddInputFilter</directive>
3709 <p>If more than one filter is specified, they must be separated
3710 by semicolons in the order in which they should process the
3713 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3714 </directivesynopsis>
3717 <name>SetOutputFilter</name>
3718 <description>Sets the filters that will process responses from the
3719 server</description>
3720 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3721 <contextlist><context>server config</context><context>virtual host</context>
3722 <context>directory</context><context>.htaccess</context>
3724 <override>FileInfo</override>
3727 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3728 which will process responses from the server before they are
3729 sent to the client. This is in addition to any filters defined
3730 elsewhere, including the
3731 <directive module="mod_mime">AddOutputFilter</directive>
3734 <p>For example, the following configuration will process all files
3735 in the <code>/www/data/</code> directory for server-side
3739 <Directory /www/data/><br />
3741 SetOutputFilter INCLUDES<br />
3746 <p>If more than one filter is specified, they must be separated
3747 by semicolons in the order in which they should process the
3750 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3751 </directivesynopsis>
3754 <name>TimeOut</name>
3755 <description>Amount of time the server will wait for
3756 certain events before failing a request</description>
3757 <syntax>TimeOut <var>seconds</var></syntax>
3758 <default>TimeOut 300</default>
3759 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3762 <p>The <directive>TimeOut</directive> directive defines the length
3763 of time Apache httpd will wait for I/O in various circumstances:</p>
3766 <li>When reading data from the client, the length of time to
3767 wait for a TCP packet to arrive if the read buffer is
3770 <li>When writing data to the client, the length of time to wait
3771 for an acknowledgement of a packet if the send buffer is
3774 <li>In <module>mod_cgi</module>, the length of time to wait for
3775 output from a CGI script.</li>
3777 <li>In <module>mod_ext_filter</module>, the length of time to
3778 wait for output from a filtering process.</li>
3780 <li>In <module>mod_proxy</module>, the default timeout value if
3781 <directive module="mod_proxy">ProxyTimeout</directive> is not
3786 </directivesynopsis>
3789 <name>TraceEnable</name>
3790 <description>Determines the behaviour on <code>TRACE</code> requests</description>
3791 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3792 <default>TraceEnable on</default>
3793 <contextlist><context>server config</context></contextlist>
3794 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3797 <p>This directive overrides the behavior of <code>TRACE</code> for both
3798 the core server and <module>mod_proxy</module>. The default
3799 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3800 RFC 2616, which disallows any request body to accompany the request.
3801 <code>TraceEnable off</code> causes the core server and
3802 <module>mod_proxy</module> to return a <code>405</code> (Method not
3803 allowed) error to the client.</p>
3805 <p>Finally, for testing and diagnostic purposes only, request
3806 bodies may be allowed using the non-compliant <code>TraceEnable
3807 extended</code> directive. The core (as an origin server) will
3808 restrict the request body to 64k (plus 8k for chunk headers if
3809 <code>Transfer-Encoding: chunked</code> is used). The core will
3810 reflect the full headers and all chunk headers with the response
3811 body. As a proxy server, the request body is not restricted to 64k.</p>
3813 </directivesynopsis>
3816 <name>UnDefine</name>
3817 <description>Undefine the existence of a variable</description>
3818 <syntax>UnDefine <var>parameter-name</var></syntax>
3819 <contextlist><context>server config</context></contextlist>
3822 <p>Undoes the effect of a <directive module="core">Define</directive> or
3823 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3824 <p>This directive can be used to toggle the use of <directive module="core"
3825 type="section">IfDefine</directive> sections without needing to alter
3826 <code>-D</code> arguments in any startup scripts.</p>
3828 </directivesynopsis>
3831 <name>UseCanonicalName</name>
3832 <description>Configures how the server determines its own name and
3834 <syntax>UseCanonicalName On|Off|DNS</syntax>
3835 <default>UseCanonicalName Off</default>
3836 <contextlist><context>server config</context><context>virtual host</context>
3837 <context>directory</context></contextlist>
3840 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3841 URL -- that is, a URL that refers back to the same server. With
3842 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3843 specified in the <directive module="core">ServerName</directive>
3844 directive to construct the canonical name for the server. This name
3845 is used in all self-referential URLs, and for the values of
3846 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3848 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3849 self-referential URLs using the hostname and port supplied by
3850 the client if any are supplied (otherwise it will use the
3851 canonical name, as defined above). These values are the same
3852 that are used to implement <a
3853 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3854 and are available with the same clients. The CGI variables
3855 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3856 constructed from the client supplied values as well.</p>
3858 <p>An example where this may be useful is on an intranet server
3859 where you have users connecting to the machine using short
3860 names such as <code>www</code>. You'll notice that if the users
3861 type a shortname, and a URL which is a directory, such as
3862 <code>http://www/splat</code>, <em>without the trailing
3863 slash</em> then Apache httpd will redirect them to
3864 <code>http://www.domain.com/splat/</code>. If you have
3865 authentication enabled, this will cause the user to have to
3866 authenticate twice (once for <code>www</code> and once again
3867 for <code>www.domain.com</code> -- see <a
3868 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3869 FAQ on this subject for more information</a>). But if
3870 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3871 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3873 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3874 which is intended for use with mass IP-based virtual hosting to
3875 support ancient clients that do not provide a
3876 <code>Host:</code> header. With this option Apache httpd does a
3877 reverse DNS lookup on the server IP address that the client
3878 connected to in order to work out self-referential URLs.</p>
3880 <note type="warning"><title>Warning</title>
3881 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3882 they may be broken by this option. The client is essentially free
3883 to give whatever value they want as a hostname. But if the CGI is
3884 only using <code>SERVER_NAME</code> to construct self-referential URLs
3885 then it should be just fine.</p>
3888 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3889 <seealso><directive module="core">ServerName</directive></seealso>
3890 <seealso><directive module="mpm_common">Listen</directive></seealso>
3891 </directivesynopsis>
3894 <name>UseCanonicalPhysicalPort</name>
3895 <description>Configures how the server determines its own name and
3897 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3898 <default>UseCanonicalPhysicalPort Off</default>
3899 <contextlist><context>server config</context><context>virtual host</context>
3900 <context>directory</context></contextlist>
3903 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3904 URL -- that is, a URL that refers back to the same server. With
3905 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3906 constructing the canonical port for the server to honor
3907 the <directive module="core">UseCanonicalName</directive> directive,
3908 provide the actual physical port number being used by this request
3909 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3910 Apache httpd will not ever use the actual physical port number, instead
3911 relying on all configured information to construct a valid port number.</p>
3913 <note><title>Note</title>
3914 <p>The ordering of when the physical port is used is as follows:<br /><br />
3915 <code>UseCanonicalName On</code></p>
3917 <li>Port provided in <code>Servername</code></li>
3918 <li>Physical port</li>
3919 <li>Default port</li>
3921 <code>UseCanonicalName Off | DNS</code>
3923 <li>Parsed port from <code>Host:</code> header</li>
3924 <li>Physical port</li>
3925 <li>Port provided in <code>Servername</code></li>
3926 <li>Default port</li>
3929 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3930 physical ports are removed from the ordering.</p>
3934 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3935 <seealso><directive module="core">ServerName</directive></seealso>
3936 <seealso><directive module="mpm_common">Listen</directive></seealso>
3937 </directivesynopsis>
3939 <directivesynopsis type="section">
3940 <name>VirtualHost</name>
3941 <description>Contains directives that apply only to a specific
3942 hostname or IP address</description>
3943 <syntax><VirtualHost
3944 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3945 ...> ... </VirtualHost></syntax>
3946 <contextlist><context>server config</context></contextlist>
3949 <p><directive type="section">VirtualHost</directive> and
3950 <code></VirtualHost></code> are used to enclose a group of
3951 directives that will apply only to a particular virtual host. Any
3952 directive that is allowed in a virtual host context may be
3953 used. When the server receives a request for a document on a
3954 particular virtual host, it uses the configuration directives
3955 enclosed in the <directive type="section">VirtualHost</directive>
3956 section. <var>Addr</var> can be:</p>
3959 <li>The IP address of the virtual host;</li>
3961 <li>A fully qualified domain name for the IP address of the
3962 virtual host (not recommended);</li>
3964 <li>The character <code>*</code>, which is used only in combination with
3965 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3967 <li>The string <code>_default_</code>, which is used only
3968 with IP virtual hosting to catch unmatched IP addresses.</li>
3971 <example><title>Example</title>
3972 <VirtualHost 10.1.2.3><br />
3974 ServerAdmin webmaster@host.example.com<br />
3975 DocumentRoot /www/docs/host.example.com<br />
3976 ServerName host.example.com<br />
3977 ErrorLog logs/host.example.com-error_log<br />
3978 TransferLog logs/host.example.com-access_log<br />
3980 </VirtualHost>
3984 <p>IPv6 addresses must be specified in square brackets because
3985 the optional port number could not be determined otherwise. An
3986 IPv6 example is shown below:</p>
3989 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3991 ServerAdmin webmaster@host.example.com<br />
3992 DocumentRoot /www/docs/host.example.com<br />
3993 ServerName host.example.com<br />
3994 ErrorLog logs/host.example.com-error_log<br />
3995 TransferLog logs/host.example.com-access_log<br />
3997 </VirtualHost>
4000 <p>Each Virtual Host must correspond to a different IP address,
4001 different port number or a different host name for the server,
4002 in the former case the server machine must be configured to
4003 accept IP packets for multiple addresses. (If the machine does
4004 not have multiple network interfaces, then this can be
4005 accomplished with the <code>ifconfig alias</code> command -- if
4006 your OS supports it).</p>
4008 <note><title>Note</title>
4009 <p>The use of <directive type="section">VirtualHost</directive> does
4010 <strong>not</strong> affect what addresses Apache httpd listens on. You
4011 may need to ensure that Apache httpd is listening on the correct addresses
4012 using <directive module="mpm_common">Listen</directive>.</p>
4015 <p>When using IP-based virtual hosting, the special name
4016 <code>_default_</code> can be specified in
4017 which case this virtual host will match any IP address that is
4018 not explicitly listed in another virtual host. In the absence
4019 of any <code>_default_</code> virtual host the "main" server config,
4020 consisting of all those definitions outside any VirtualHost
4021 section, is used when no IP-match occurs.</p>
4023 <p>You can specify a <code>:port</code> to change the port that is
4024 matched. If unspecified then it defaults to the same port as the
4025 most recent <directive module="mpm_common">Listen</directive>
4026 statement of the main server. You may also specify <code>:*</code>
4027 to match all ports on that address. (This is recommended when used
4028 with <code>_default_</code>.)</p>
4030 <p>A <directive module="core">ServerName</directive> should be
4031 specified inside each <directive
4032 type="section">VirtualHost</directive> block. If it is absent, the
4033 <directive module="core">ServerName</directive> from the "main"
4034 server configuration will be inherited.</p>
4036 <p>If no matching virtual host is found, then the first listed
4037 virtual host that matches the IP address will be used. As a
4038 consequence, the first listed virtual host is the default virtual
4041 <note type="warning"><title>Security</title>
4042 <p>See the <a href="../misc/security_tips.html">security tips</a>
4043 document for details on why your security could be compromised if the
4044 directory where log files are stored is writable by anyone other
4045 than the user that starts the server.</p>
4048 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4049 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4050 Apache HTTP Server</a></seealso>
4051 <seealso><a href="../bind.html">Setting
4052 which addresses and ports Apache HTTP Server uses</a></seealso>
4053 <seealso><a href="../sections.html">How <Directory>, <Location>
4054 and <Files> sections work</a> for an explanation of how these
4055 different sections are combined when a request is received</seealso>
4056 </directivesynopsis>