2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- English Revision: 1040494:1363515 (outdated) -->
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>. Este tipo de sobreescritura se necesita,
162 por ejemplo, cuando utilizas un <a href="../filter.html">filtro</a>, tal como
163 <a href="mod_include.html">INCLUDES</a>, para generar contenido
164 basado en <code>PATH_INFO</code>. El controlador principal normalmente rechazaría
165 la petición, de modo que puedes utilizar la siguiente configuración para habilitarla
169 <Files "mypaths.shtml"><br />
171 Options +Includes<br />
172 SetOutputFilter INCLUDES<br />
173 AcceptPathInfo On<br />
182 <name>AccessFileName</name>
183 <description>Nombre del fichero distribuido de configuración</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>Mientras que procesa una petición el servidor busca
191 el primer fichero de configuración existente dentro de un listado de nombres en
192 cada directorio de la ruta del documento, si los ficheros distribuidos
193 de configuración están <a href="#allowoverride">habilitados para ese
194 directorio</a>. Por ejemplo:</p>
200 <p>antes de servir el documento
201 <code>/usr/local/web/index.html</code>, el servidor leerá
202 <code>/.acl</code>, <code>/usr/.acl</code>,
203 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
204 para las directivas, salvo que estén deshabilitadas 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>
936 <p>In the event of a problem or error, Apache httpd can be configured
937 to do one of four things,</p>
940 <li>output a simple hardcoded error message</li>
942 <li>output a customized message</li>
944 <li>redirect to a local <var>URL-path</var> to handle the
947 <li>redirect to an external <var>URL</var> to handle the
951 <p>The first option is the default, while options 2-4 are
952 configured using the <directive>ErrorDocument</directive>
953 directive, which is followed by the HTTP response code and a URL
954 or a message. Apache httpd will sometimes offer additional information
955 regarding the problem/error.</p>
957 <p>URLs can begin with a slash (/) for local web-paths (relative
958 to the <directive module="core">DocumentRoot</directive>), or be a
959 full URL which the client can resolve. Alternatively, a message
960 can be provided to be displayed by the browser. Examples:</p>
963 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
964 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
965 ErrorDocument 401 /subscription_info.html<br />
966 ErrorDocument 403 "Sorry can't allow you access today"
969 <p>Additionally, the special value <code>default</code> can be used
970 to specify Apache httpd's simple hardcoded message. While not required
971 under normal circumstances, <code>default</code> will restore
972 Apache httpd's simple hardcoded message for configurations that would
973 otherwise inherit an existing <directive>ErrorDocument</directive>.</p>
976 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
977 <Directory /web/docs><br />
979 ErrorDocument 404 default<br />
984 <p>Note that when you specify an <directive>ErrorDocument</directive>
985 that points to a remote URL (ie. anything with a method such as
986 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
987 client to tell it where to find the document, even if the
988 document ends up being on the same server. This has several
989 implications, the most important being that the client will not
990 receive the original error status code, but instead will
991 receive a redirect status code. This in turn can confuse web
992 robots and other clients which try to determine if a URL is
993 valid using the status code. In addition, if you use a remote
994 URL in an <code>ErrorDocument 401</code>, the client will not
995 know to prompt the user for a password since it will not
996 receive the 401 status code. Therefore, <strong>if you use an
997 <code>ErrorDocument 401</code> directive then it must refer to a local
998 document.</strong></p>
1000 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1001 server-generated error messages when they are "too small" and substitute
1002 its own "friendly" error messages. The size threshold varies depending on
1003 the type of error, but in general, if you make your error document
1004 greater than 512 bytes, then MSIE will show the server-generated
1005 error rather than masking it. More information is available in
1006 Microsoft Knowledge Base article <a
1007 href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807"
1010 <p>Although most error messages can be overriden, there are certain
1011 circumstances where the internal messages are used regardless of the
1012 setting of <directive module="core">ErrorDocument</directive>. In
1013 particular, if a malformed request is detected, normal request processing
1014 will be immediately halted and the internal error message returned.
1015 This is necessary to guard against security problems caused by
1018 <p>If you are using mod_proxy, you may wish to enable
1019 <directive module="mod_proxy">ProxyErrorOverride</directive> so that you can provide
1020 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1021 Apache httpd will not generate custom error documents for proxied content.</p>
1024 <seealso><a href="../custom-error.html">documentation of
1025 customizable responses</a></seealso>
1026 </directivesynopsis>
1029 <name>ErrorLog</name>
1030 <description>Location where the server will log errors</description>
1031 <syntax> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</syntax>
1032 <default>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</default>
1033 <contextlist><context>server config</context><context>virtual host</context>
1037 <p>The <directive>ErrorLog</directive> directive sets the name of
1038 the file to which the server will log any errors it encounters. If
1039 the <var>file-path</var> is not absolute then it is assumed to be
1040 relative to the <directive module="core">ServerRoot</directive>.</p>
1042 <example><title>Example</title>
1043 ErrorLog /var/log/httpd/error_log
1046 <p>If the <var>file-path</var>
1047 begins with a pipe character "<code>|</code>" then it is assumed to be a
1048 command to spawn to handle the error log.</p>
1050 <example><title>Example</title>
1051 ErrorLog "|/usr/local/bin/httpd_errors"
1054 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1055 more information.</p>
1057 <p>Using <code>syslog</code> instead of a filename enables logging
1058 via syslogd(8) if the system supports it. The default is to use
1059 syslog facility <code>local7</code>, but you can override this by
1060 using the <code>syslog:<var>facility</var></code> syntax where
1061 <var>facility</var> can be one of the names usually documented in
1062 syslog(1). The facility is effectively global, and if it is changed
1063 in individual virtual hosts, the final facility specified affects the
1066 <example><title>Example</title>
1067 ErrorLog syslog:user
1070 <p>SECURITY: See the <a
1071 href="../misc/security_tips.html#serverroot">security tips</a>
1072 document for details on why your security could be compromised
1073 if the directory where log files are stored is writable by
1074 anyone other than the user that starts the server.</p>
1075 <note type="warning"><title>Note</title>
1076 <p>When entering a file path on non-Unix platforms, care should be taken
1077 to make sure that only forward slashed are used even though the platform
1078 may allow the use of back slashes. In general it is a good idea to always
1079 use forward slashes throughout the configuration files.</p>
1082 <seealso><directive module="core">LogLevel</directive></seealso>
1083 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1084 </directivesynopsis>
1087 <name>ErrorLogFormat</name>
1088 <description>Format specification for error log entries</description>
1089 <syntax> ErrorLog [connection|request] <var>format</var></syntax>
1090 <contextlist><context>server config</context><context>virtual host</context>
1092 <compatibility>Available in Apache httpd 2.3.9 and later</compatibility>
1095 <p><directive>ErrorLogFormat</directive> allows to specify what
1096 supplementary information is logged in the error log in addition to the
1097 actual log message.</p>
1099 <example><title>Simple example</title>
1100 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1103 <p>Specifying <code>connection</code> or <code>request</code> as first
1104 paramter allows to specify additional formats, causing additional
1105 information to be logged when the first message is logged for a specific
1106 connection or request, respectivly. This additional information is only
1107 logged once per connection/request. If a connection or request is processed
1108 without causing any log message, the additional information is not logged
1111 <p>It can happen that some format string items do not produce output. For
1112 example, the Referer header is only present if the log message is
1113 associated to a request and the log message happens at a time when the
1114 Referer header has already been read from the client. If no output is
1115 produced, the default behaviour is to delete everything from the preceeding
1116 space character to the next space character. This means the log line is
1117 implicitly divided into fields on non-whitespace to whitespace transitions.
1118 If a format string item does not produce output, the whole field is
1119 ommitted. For example, if the remote address <code>%a</code> in the log
1120 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1121 brackets are not logged either. Space characters can be escaped with a
1122 backslash to prevent them from delimiting a field. The combination '% '
1123 (percent space) is a zero-witdh field delimiter that does not produce any
1126 <p>The above behaviour can be changed by adding modifiers to the format
1127 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1128 respective item does not produce any output. In once-per-connection/request
1129 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1130 item with the plus modifier does not produce any output, the whole line is
1133 <p>A number as modifier can be used to assign a log severity level to a
1134 format item. The item will only be logged if the severity of the log
1135 message is not higher than the specified log severity level. The number can
1136 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1138 <p>Some format string items accept additional parameters in braces.</p>
1140 <table border="1" style="zebra">
1141 <columnspec><column width=".2"/><column width=".8"/></columnspec>
1143 <tr><th>Format String</th> <th>Description</th></tr>
1145 <tr><td><code>%%</code></td>
1146 <td>The percent sign</td></tr>
1148 <tr><td><code>%...a</code></td>
1149 <td>Remote IP-address and port</td></tr>
1151 <tr><td><code>%...A</code></td>
1152 <td>Local IP-address and port</td></tr>
1154 <tr><td><code>%...{name}e</code></td>
1155 <td>Request environment variable <code>name</code></td></tr>
1157 <tr><td><code>%...E</code></td>
1158 <td>APR/OS error status code and string</td></tr>
1160 <tr><td><code>%...F</code></td>
1161 <td>Source file name and line number of the log call</td></tr>
1163 <tr><td><code>%...{name}i</code></td>
1164 <td>Request header <code>name</code></td></tr>
1166 <tr><td><code>%...k</code></td>
1167 <td>Number of keep-alive requests on this connection</td></tr>
1169 <tr><td><code>%...l</code></td>
1170 <td>Loglevel of the message</td></tr>
1172 <tr><td><code>%...L</code></td>
1173 <td>Log ID of the request</td></tr>
1175 <tr><td><code>%...{c}L</code></td>
1176 <td>Log ID of the connection</td></tr>
1178 <tr><td><code>%...{C}L</code></td>
1179 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1181 <tr><td><code>%...m</code></td>
1182 <td>Name of the module logging the message</td></tr>
1184 <tr><td><code>%M</code></td>
1185 <td>The actual log message</td></tr>
1187 <tr><td><code>%...{name}n</code></td>
1188 <td>Request note <code>name</code></td></tr>
1190 <tr><td><code>%...P</code></td>
1191 <td>Process ID of current process</td></tr>
1193 <tr><td><code>%...T</code></td>
1194 <td>Thread ID of current thread</td></tr>
1196 <tr><td><code>%...t</code></td>
1197 <td>The current time</td></tr>
1199 <tr><td><code>%...{u}t</code></td>
1200 <td>The current time including micro-seconds</td></tr>
1202 <tr><td><code>%...{cu}t</code></td>
1203 <td>The current time in compact ISO 8601 format, including
1204 micro-seconds</td></tr>
1206 <tr><td><code>%...v</code></td>
1207 <td>The canonical <directive module="core">ServerName</directive>
1208 of the current server.</td></tr>
1210 <tr><td><code>%...V</code></td>
1211 <td>The server name of the server serving the request according to the
1212 <directive module="core" >UseCanonicalName</directive>
1215 <tr><td><code>\ </code> (backslash space)</td>
1216 <td>Non-field delimiting space</td></tr>
1218 <tr><td><code>% </code> (percent space)</td>
1219 <td>Field delimiter (no output)</td></tr>
1222 <p>The log ID format <code>%L</code> produces a unique id for a connection
1223 or request. This can be used to correlate which log lines belong to the
1224 same connection or request, which request happens on which connection.
1225 A <code>%L</code> format string is also available in
1226 <module>mod_log_config</module>, to allow to correlate access log entries
1227 with error log lines. If <module>mod_unique_id</module> is loaded, its
1228 unique id will be used as log ID for requests.</p>
1230 <example><title>Example (somewhat similar to default format)</title>
1231 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1232 %M% ,\ referer\ %{Referer}i"
1235 <example><title>Example (similar to the 2.2.x format)</title>
1236 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1237 %M% ,\ referer\ %{Referer}i"
1240 <example><title>Advanced example with request/connection log IDs</title>
1241 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br/>
1242 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br/>
1243 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br/>
1244 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br/>
1245 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br/>
1249 <seealso><directive module="core">ErrorLog</directive></seealso>
1250 <seealso><directive module="core">LogLevel</directive></seealso>
1251 <seealso><a href="../logs.html">Apache HTTP Server Log Files</a></seealso>
1252 </directivesynopsis>
1255 <name>ExtendedStatus</name>
1256 <description>Keep track of extended status information for each
1257 request</description>
1258 <syntax>ExtendedStatus On|Off</syntax>
1259 <default>ExtendedStatus Off[*]</default>
1260 <contextlist><context>server config</context></contextlist>
1263 <p>This option tracks additional data per worker about the
1264 currently executing request, and a utilization summary; you
1265 can see these variables during runtime by configuring
1266 <module>mod_status</module>. Note that other modules may
1267 rely on this scoreboard.</p>
1269 <p>This setting applies to the entire server, and cannot be
1270 enabled or disabled on a virtualhost-by-virtualhost basis.
1271 The collection of extended status information can slow down
1272 the server. Also note that this setting cannot be changed
1273 during a graceful restart.</p>
1276 <p>Note that loading <module>mod_status</module> will change
1277 the default behavior to ExtendedStatus On, while other
1278 third party modules may do the same. Such modules rely on
1279 collecting detailed information about the state of all workers.
1280 The default is changed by <module>mod_status</module> beginning
1281 with version 2.3.6; the previous default was always Off.</p>
1286 </directivesynopsis>
1289 <name>FileETag</name>
1290 <description>File attributes used to create the ETag
1291 HTTP response header for static files</description>
1292 <syntax>FileETag <var>component</var> ...</syntax>
1293 <default>FileETag INode MTime Size</default>
1294 <contextlist><context>server config</context><context>virtual host</context>
1295 <context>directory</context><context>.htaccess</context>
1297 <override>FileInfo</override>
1301 The <directive>FileETag</directive> directive configures the file
1302 attributes that are used to create the <code>ETag</code> (entity
1303 tag) response header field when the document is based on a static file.
1304 (The <code>ETag</code> value is used in cache management to save
1305 network bandwidth.) The
1306 <directive>FileETag</directive> directive allows you to choose
1307 which of these -- if any -- should be used. The recognized keywords are:
1311 <dt><strong>INode</strong></dt>
1312 <dd>The file's i-node number will be included in the calculation</dd>
1313 <dt><strong>MTime</strong></dt>
1314 <dd>The date and time the file was last modified will be included</dd>
1315 <dt><strong>Size</strong></dt>
1316 <dd>The number of bytes in the file will be included</dd>
1317 <dt><strong>All</strong></dt>
1318 <dd>All available fields will be used. This is equivalent to:
1319 <example>FileETag INode MTime Size</example></dd>
1320 <dt><strong>None</strong></dt>
1321 <dd>If a document is file-based, no <code>ETag</code> field will be
1322 included in the response</dd>
1325 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1326 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1327 which allow changes to be made to the default setting inherited
1328 from a broader scope. Any keyword appearing without such a prefix
1329 immediately and completely cancels the inherited setting.</p>
1331 <p>If a directory's configuration includes
1332 <code>FileETag INode MTime Size</code>, and a
1333 subdirectory's includes <code>FileETag -INode</code>,
1334 the setting for that subdirectory (which will be inherited by
1335 any sub-subdirectories that don't override it) will be equivalent to
1336 <code>FileETag MTime Size</code>.</p>
1337 <note type="warning"><title>Warning</title>
1338 Do not change the default for directories or locations that have WebDAV
1339 enabled and use <module>mod_dav_fs</module> as a storage provider.
1340 <module>mod_dav_fs</module> uses <code>INode MTime Size</code>
1341 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1342 These conditional requests will break if the <code>ETag</code> format is
1343 changed via <directive>FileETag</directive>.
1345 <note><title>Server Side Includes</title>
1346 An ETag is not generated for responses parsed by <module>mod_include</module>,
1347 since the response entity can change without a change of the INode, MTime, or Size
1348 of the static file with embedded SSI directives.
1352 </directivesynopsis>
1354 <directivesynopsis type="section">
1356 <description>Contains directives that apply to matched
1357 filenames</description>
1358 <syntax><Files <var>filename</var>> ... </Files></syntax>
1359 <contextlist><context>server config</context><context>virtual host</context>
1360 <context>directory</context><context>.htaccess</context>
1362 <override>All</override>
1365 <p>The <directive type="section">Files</directive> directive
1366 limits the scope of the enclosed directives by filename. It is comparable
1367 to the <directive module="core" type="section">Directory</directive>
1368 and <directive module="core" type="section">Location</directive>
1369 directives. It should be matched with a <code></Files></code>
1370 directive. The directives given within this section will be applied to
1371 any object with a basename (last component of filename) matching the
1372 specified filename. <directive type="section">Files</directive>
1373 sections are processed in the order they appear in the
1374 configuration file, after the <directive module="core"
1375 type="section">Directory</directive> sections and
1376 <code>.htaccess</code> files are read, but before <directive
1377 type="section" module="core">Location</directive> sections. Note
1378 that <directive type="section">Files</directive> can be nested
1379 inside <directive type="section"
1380 module="core">Directory</directive> sections to restrict the
1381 portion of the filesystem they apply to.</p>
1383 <p>The <var>filename</var> argument should include a filename, or
1384 a wild-card string, where <code>?</code> matches any single character,
1385 and <code>*</code> matches any sequences of characters.
1386 <glossary ref="regex">Regular expressions</glossary>
1387 can also be used, with the addition of the
1388 <code>~</code> character. For example:</p>
1391 <Files ~ "\.(gif|jpe?g|png)$">
1394 <p>would match most common Internet graphics formats. <directive
1395 module="core" type="section">FilesMatch</directive> is preferred,
1398 <p>Note that unlike <directive type="section"
1399 module="core">Directory</directive> and <directive type="section"
1400 module="core">Location</directive> sections, <directive
1401 type="section">Files</directive> sections can be used inside
1402 <code>.htaccess</code> files. This allows users to control access to
1403 their own files, at a file-by-file level.</p>
1406 <seealso><a href="../sections.html">How <Directory>, <Location>
1407 and <Files> sections work</a> for an explanation of how these
1408 different sections are combined when a request is received</seealso>
1409 </directivesynopsis>
1411 <directivesynopsis type="section">
1412 <name>FilesMatch</name>
1413 <description>Contains directives that apply to regular-expression matched
1414 filenames</description>
1415 <syntax><FilesMatch <var>regex</var>> ... </FilesMatch></syntax>
1416 <contextlist><context>server config</context><context>virtual host</context>
1417 <context>directory</context><context>.htaccess</context>
1419 <override>All</override>
1422 <p>The <directive type="section">FilesMatch</directive> directive
1423 limits the scope of the enclosed directives by filename, just as the
1424 <directive module="core" type="section">Files</directive> directive
1425 does. However, it accepts a <glossary ref="regex">regular
1426 expression</glossary>. For example:</p>
1429 <FilesMatch "\.(gif|jpe?g|png)$">
1432 <p>would match most common Internet graphics formats.</p>
1435 <seealso><a href="../sections.html">How <Directory>, <Location>
1436 and <Files> sections work</a> for an explanation of how these
1437 different sections are combined when a request is received</seealso>
1438 </directivesynopsis>
1441 <name>ForceType</name>
1442 <description>Forces all matching files to be served with the specified
1443 media type in the HTTP Content-Type header field</description>
1444 <syntax>ForceType <var>media-type</var>|None</syntax>
1445 <contextlist><context>directory</context><context>.htaccess</context>
1447 <override>FileInfo</override>
1448 <compatibility>Moved to the core in Apache httpd 2.0</compatibility>
1451 <p>When placed into an <code>.htaccess</code> file or a
1452 <directive type="section" module="core">Directory</directive>, or
1453 <directive type="section" module="core">Location</directive> or
1454 <directive type="section" module="core">Files</directive>
1455 section, this directive forces all matching files to be served
1456 with the content type identification given by
1457 <var>media-type</var>. For example, if you had a directory full of
1458 GIF files, but did not want to label them all with <code>.gif</code>,
1459 you might want to use:</p>
1465 <p>Note that this directive overrides other indirect media type
1466 associations defined in mime.types or via the
1467 <directive module="mod_mime">AddType</directive>.</p>
1469 <p>You can also override more general
1470 <directive>ForceType</directive> settings
1471 by using the value of <code>None</code>:</p>
1474 # force all files to be image/gif:<br />
1475 <Location /images><br />
1477 ForceType image/gif<br />
1479 </Location><br />
1481 # but normal mime-type associations here:<br />
1482 <Location /images/mixed><br />
1484 ForceType None<br />
1489 <p>This directive primarily overrides the content types generated for
1490 static files served out of the filesystem. For resources other than
1491 static files, where the generator of the response typically specifies
1492 a Content-Type, this directive has no effect.</p>
1495 </directivesynopsis>
1497 <name>GprofDir</name>
1498 <description>Directory to write gmon.out profiling data to. </description>
1499 <syntax>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</syntax>
1500 <contextlist><context>server config</context><context>virtual host</context>
1504 <p>When the server has been compiled with gprof profiling suppport,
1505 <directive>GprofDir</directive> causes <code>gmon.out</code> files to
1506 be written to the specified directory when the process exits. If the
1507 argument ends with a percent symbol ('%'), subdirectories are created
1508 for each process id.</p>
1510 <p>This directive currently only works with the <module>prefork</module>
1513 </directivesynopsis>
1516 <name>HostnameLookups</name>
1517 <description>Enables DNS lookups on client IP addresses</description>
1518 <syntax>HostnameLookups On|Off|Double</syntax>
1519 <default>HostnameLookups Off</default>
1520 <contextlist><context>server config</context><context>virtual host</context>
1521 <context>directory</context></contextlist>
1524 <p>This directive enables DNS lookups so that host names can be
1525 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1526 The value <code>Double</code> refers to doing double-reverse
1527 DNS lookup. That is, after a reverse lookup is performed, a forward
1528 lookup is then performed on that result. At least one of the IP
1529 addresses in the forward lookup must match the original
1530 address. (In "tcpwrappers" terminology this is called
1531 <code>PARANOID</code>.)</p>
1533 <p>Regardless of the setting, when <module>mod_authz_host</module> is
1534 used for controlling access by hostname, a double reverse lookup
1535 will be performed. This is necessary for security. Note that the
1536 result of this double-reverse isn't generally available unless you
1537 set <code>HostnameLookups Double</code>. For example, if only
1538 <code>HostnameLookups On</code> and a request is made to an object
1539 that is protected by hostname restrictions, regardless of whether
1540 the double-reverse fails or not, CGIs will still be passed the
1541 single-reverse result in <code>REMOTE_HOST</code>.</p>
1543 <p>The default is <code>Off</code> in order to save the network
1544 traffic for those sites that don't truly need the reverse
1545 lookups done. It is also better for the end users because they
1546 don't have to suffer the extra latency that a lookup entails.
1547 Heavily loaded sites should leave this directive
1548 <code>Off</code>, since DNS lookups can take considerable
1549 amounts of time. The utility <program>logresolve</program>, compiled by
1550 default to the <code>bin</code> subdirectory of your installation
1551 directory, can be used to look up host names from logged IP addresses
1554 </directivesynopsis>
1556 <directivesynopsis type="section">
1558 <description>Contains directives that apply only if a condition is
1559 satisfied by a request at runtime</description>
1560 <syntax><If <var>expression</var>> ... </If></syntax>
1561 <contextlist><context>server config</context><context>virtual host</context>
1562 <context>directory</context><context>.htaccess</context>
1564 <override>All</override>
1567 <p>The <directive type="section">If</directive> directive
1568 evaluates an expression at runtime, and applies the enclosed
1569 directives if and only if the expression evaluates to true.
1573 <If "$req{Host} = ''">
1576 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1578 <p>You may compare the value of any variable in the request headers
1579 ($req), response headers ($resp) or environment ($env) in your
1582 <p>Apart from <code>=</code>, <code>If</code> can use the <code>IN</code>
1583 operator to compare if the expression is in a given range:</p>
1586 <If %{REQUEST_METHOD} IN GET,HEAD,OPTIONS>
1591 <seealso><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1592 for a complete reference and more examples.</seealso>
1593 <seealso><a href="../sections.html">How <Directory>, <Location>,
1594 <Files> sections work</a> for an explanation of how these
1595 different sections are combined when a request is received.
1596 <directive type="section">If</directive> has the same precedence
1597 and usage as <directive type="section">Files</directive></seealso>
1598 </directivesynopsis>
1600 <directivesynopsis type="section">
1601 <name>IfDefine</name>
1602 <description>Encloses directives that will be processed only
1603 if a test is true at startup</description>
1604 <syntax><IfDefine [!]<var>parameter-name</var>> ...
1605 </IfDefine></syntax>
1606 <contextlist><context>server config</context><context>virtual host</context>
1607 <context>directory</context><context>.htaccess</context>
1609 <override>All</override>
1612 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1613 </code> section is used to mark directives that are conditional. The
1614 directives within an <directive type="section">IfDefine</directive>
1615 section are only processed if the <var>test</var> is true. If <var>
1616 test</var> is false, everything between the start and end markers is
1619 <p>The <var>test</var> in the <directive type="section"
1620 >IfDefine</directive> section directive can be one of two forms:</p>
1623 <li><var>parameter-name</var></li>
1625 <li><code>!</code><var>parameter-name</var></li>
1628 <p>In the former case, the directives between the start and end
1629 markers are only processed if the parameter named
1630 <var>parameter-name</var> is defined. The second format reverses
1631 the test, and only processes the directives if
1632 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1634 <p>The <var>parameter-name</var> argument is a define as given on the
1635 <program>httpd</program> command line via <code>-D<var>parameter</var>
1636 </code> at the time the server was started or by the <directive
1637 module="core">Define</directive> directive.</p>
1639 <p><directive type="section">IfDefine</directive> sections are
1640 nest-able, which can be used to implement simple
1641 multiple-parameter tests. Example:</p>
1644 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1647 <IfDefine ReverseProxy><br />
1649 LoadModule proxy_module modules/mod_proxy.so<br />
1650 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1651 <IfDefine UseCache><br />
1653 LoadModule cache_module modules/mod_cache.so<br />
1654 <IfDefine MemCache><br />
1656 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1658 </IfDefine><br />
1659 <IfDefine !MemCache><br />
1661 LoadModule cache_disk_module modules/mod_cache_disk.so<br />
1670 </directivesynopsis>
1672 <directivesynopsis type="section">
1673 <name>IfModule</name>
1674 <description>Encloses directives that are processed conditional on the
1675 presence or absence of a specific module</description>
1676 <syntax><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1677 </IfModule></syntax>
1678 <contextlist><context>server config</context><context>virtual host</context>
1679 <context>directory</context><context>.htaccess</context>
1681 <override>All</override>
1682 <compatibility>Module identifiers are available in version 2.1 and
1683 later.</compatibility>
1686 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1687 section is used to mark directives that are conditional on the presence of
1688 a specific module. The directives within an <directive type="section"
1689 >IfModule</directive> section are only processed if the <var>test</var>
1690 is true. If <var>test</var> is false, everything between the start and
1691 end markers is ignored.</p>
1693 <p>The <var>test</var> in the <directive type="section"
1694 >IfModule</directive> section directive can be one of two forms:</p>
1697 <li><var>module</var></li>
1699 <li>!<var>module</var></li>
1702 <p>In the former case, the directives between the start and end
1703 markers are only processed if the module named <var>module</var>
1704 is included in Apache httpd -- either compiled in or
1705 dynamically loaded using <directive module="mod_so"
1706 >LoadModule</directive>. The second format reverses the test,
1707 and only processes the directives if <var>module</var> is
1708 <strong>not</strong> included.</p>
1710 <p>The <var>module</var> argument can be either the module identifier or
1711 the file name of the module, at the time it was compiled. For example,
1712 <code>rewrite_module</code> is the identifier and
1713 <code>mod_rewrite.c</code> is the file name. If a module consists of
1714 several source files, use the name of the file containing the string
1715 <code>STANDARD20_MODULE_STUFF</code>.</p>
1717 <p><directive type="section">IfModule</directive> sections are
1718 nest-able, which can be used to implement simple multiple-module
1721 <note>This section should only be used if you need to have one
1722 configuration file that works whether or not a specific module
1723 is available. In normal operation, directives need not be
1724 placed in <directive type="section">IfModule</directive>
1727 </directivesynopsis>
1730 <name>Include</name>
1731 <description>Includes other configuration files from within
1732 the server configuration files</description>
1733 <syntax>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></syntax>
1734 <contextlist><context>server config</context><context>virtual host</context>
1735 <context>directory</context>
1737 <compatibility>Wildcard matching available in 2.0.41 and later, directory
1738 wildcard matching available in 2.3.6 and later</compatibility>
1741 <p>This directive allows inclusion of other configuration files
1742 from within the server configuration files.</p>
1744 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1745 in the filename or directory parts of the path to include several files
1746 at once, in alphabetical order. In addition, if
1747 <directive>Include</directive> points to a directory, rather than a file,
1748 Apache httpd will read all files in that directory and any subdirectory.
1749 However, including entire directories is not recommended, because it is
1750 easy to accidentally leave temporary files in a directory that can cause
1751 <program>httpd</program> to fail. Instead, we encourage you to use the
1752 wildcard syntax shown below, to include files that match a particular
1753 pattern, such as *.conf, for example.</p>
1755 <p>When a wildcard is specified for a <strong>file</strong> component of
1756 the path, and no file matches the wildcard, the
1757 <directive module="core">Include</directive>
1758 directive will be <strong>silently ignored</strong>. When a wildcard is
1759 specified for a <strong>directory</strong> component of the path, and
1760 no directory matches the wildcard, the
1761 <directive module="core">Include</directive> directive will
1762 <strong>fail with an error</strong> saying the directory cannot be found.
1765 <p>For further control over the behaviour of the server when no files or
1766 directories match, prefix the path with the modifiers <var>optional</var>
1767 or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1768 file or directory that does not match will be silently ignored. If
1769 <var>strict</var> is specified, any wildcard file or directory that does
1770 not match at least one file will cause server startup to fail.</p>
1772 <p>When a directory or file component of the path is
1773 specified exactly, and that directory or file does not exist,
1774 <directive module="core">Include</directive> directive will fail with an
1775 error saying the file or directory cannot be found.</p>
1777 <p>The file path specified may be an absolute path, or may be relative
1778 to the <directive module="core">ServerRoot</directive> directory.</p>
1783 Include /usr/local/apache2/conf/ssl.conf<br />
1784 Include /usr/local/apache2/conf/vhosts/*.conf
1787 <p>Or, providing paths relative to your <directive
1788 module="core">ServerRoot</directive> directory:</p>
1791 Include conf/ssl.conf<br />
1792 Include conf/vhosts/*.conf
1795 <p>Wildcards may be included in the directory or file portion of the
1796 path. In the following example, the server will fail to load if no
1797 directories match conf/vhosts/*, but will load successfully if no
1798 files match *.conf.</p>
1801 Include conf/vhosts/*/vhost.conf<br />
1802 Include conf/vhosts/*/*.conf
1805 <p>In this example, the server will fail to load if either
1806 conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1809 Include strict conf/vhosts/*/*.conf
1812 <p>In this example, the server load successfully if either conf/vhosts/*
1813 matches no directories, or if *.conf matches no files:</p>
1816 Include optional conf/vhosts/*/*.conf
1821 <seealso><program>apachectl</program></seealso>
1822 </directivesynopsis>
1825 <name>KeepAlive</name>
1826 <description>Enables HTTP persistent connections</description>
1827 <syntax>KeepAlive On|Off</syntax>
1828 <default>KeepAlive On</default>
1829 <contextlist><context>server config</context><context>virtual host</context>
1833 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1834 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1835 which allow multiple requests to be sent over the same TCP
1836 connection. In some cases this has been shown to result in an
1837 almost 50% speedup in latency times for HTML documents with
1838 many images. To enable Keep-Alive connections, set
1839 <code>KeepAlive On</code>.</p>
1841 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1842 used if they are specifically requested by a client. In
1843 addition, a Keep-Alive connection with an HTTP/1.0 client can
1844 only be used when the length of the content is known in
1845 advance. This implies that dynamic content such as CGI output,
1846 SSI pages, and server-generated directory listings will
1847 generally not use Keep-Alive connections to HTTP/1.0 clients.
1848 For HTTP/1.1 clients, persistent connections are the default
1849 unless otherwise specified. If the client requests it, chunked
1850 encoding will be used in order to send content of unknown
1851 length over persistent connections.</p>
1853 <p>When a client uses a Keep-Alive connection it will be counted
1854 as a single "request" for the <directive module="mpm_common"
1855 >MaxConnectionsPerChild</directive> directive, regardless
1856 of how many requests are sent using the connection.</p>
1859 <seealso><directive module="core">MaxKeepAliveRequests</directive></seealso>
1860 </directivesynopsis>
1863 <name>KeepAliveTimeout</name>
1864 <description>Amount of time the server will wait for subsequent
1865 requests on a persistent connection</description>
1866 <syntax>KeepAliveTimeout <var>num</var>[ms]</syntax>
1867 <default>KeepAliveTimeout 5</default>
1868 <contextlist><context>server config</context><context>virtual host</context>
1870 <compatibility>Specifying a value in milliseconds is available in
1871 Apache httpd 2.3.2 and later</compatibility>
1874 <p>The number of seconds Apache httpd will wait for a subsequent
1875 request before closing the connection. By adding a postfix of ms the
1876 timeout can be also set in milliseconds. Once a request has been
1877 received, the timeout value specified by the
1878 <directive module="core">Timeout</directive> directive applies.</p>
1880 <p>Setting <directive>KeepAliveTimeout</directive> to a high value
1881 may cause performance problems in heavily loaded servers. The
1882 higher the timeout, the more server processes will be kept
1883 occupied waiting on connections with idle clients.</p>
1885 <p>In a name-based virtual host context, the value of the first
1886 defined virtual host (the default host) in a set of <directive
1887 module="core">NameVirtualHost</directive> will be used.
1888 The other values will be ignored.</p>
1890 </directivesynopsis>
1892 <directivesynopsis type="section">
1894 <description>Restrict enclosed access controls to only certain HTTP
1895 methods</description>
1896 <syntax><Limit <var>method</var> [<var>method</var>] ... > ...
1897 </Limit></syntax>
1898 <contextlist><context>directory</context><context>.htaccess</context>
1900 <override>AuthConfig, Limit</override>
1903 <p>Access controls are normally effective for
1904 <strong>all</strong> access methods, and this is the usual
1905 desired behavior. <strong>In the general case, access control
1906 directives should not be placed within a
1907 <directive type="section">Limit</directive> section.</strong></p>
1909 <p>The purpose of the <directive type="section">Limit</directive>
1910 directive is to restrict the effect of the access controls to the
1911 nominated HTTP methods. For all other methods, the access
1912 restrictions that are enclosed in the <directive
1913 type="section">Limit</directive> bracket <strong>will have no
1914 effect</strong>. The following example applies the access control
1915 only to the methods <code>POST</code>, <code>PUT</code>, and
1916 <code>DELETE</code>, leaving all other methods unprotected:</p>
1919 <Limit POST PUT DELETE><br />
1921 Require valid-user<br />
1926 <p>The method names listed can be one or more of: <code>GET</code>,
1927 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1928 <code>CONNECT</code>, <code>OPTIONS</code>,
1929 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1930 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1931 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1932 case-sensitive.</strong> If <code>GET</code> is used it will also
1933 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1934 cannot be limited (see <directive module="core"
1935 >TraceEnable</directive>).</p>
1937 <note type="warning">A <directive type="section"
1938 module="core">LimitExcept</directive> section should always be
1939 used in preference to a <directive type="section">Limit</directive>
1940 section when restricting access, since a <directive type="section"
1941 module="core">LimitExcept</directive> section provides protection
1942 against arbitrary methods.</note>
1944 <p>The <directive type="section">Limit</directive> and
1945 <directive type="section" module="core">LimitExcept</directive>
1946 directives may be nested. In this case, each successive level of
1947 <directive type="section">Limit</directive> or <directive
1948 type="section" module="core">LimitExcept</directive> directives must
1949 further restrict the set of methods to which access controls apply.</p>
1951 <note type="warning">When using
1952 <directive type="section">Limit</directive> or
1953 <directive type="section">LimitExcept</directive> directives with
1954 the <directive module="mod_authz_core">Require</directive> directive,
1955 note that the first <directive module="mod_authz_core">Require</directive>
1956 to succeed authorizes the request, regardless of the presence of other
1957 <directive module="mod_authz_core">Require</directive> directives.</note>
1959 <p>For example, given the following configuration, all users will
1960 be authorized for <code>POST</code> requests, and the
1961 <code>Require group editors</code> directive will be ignored
1965 <LimitExcept GET>
1969 </LimitExcept><br />
1972 Require group editors
1977 </directivesynopsis>
1979 <directivesynopsis type="section">
1980 <name>LimitExcept</name>
1981 <description>Restrict access controls to all HTTP methods
1982 except the named ones</description>
1983 <syntax><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1984 </LimitExcept></syntax>
1985 <contextlist><context>directory</context><context>.htaccess</context>
1987 <override>AuthConfig, Limit</override>
1990 <p><directive type="section">LimitExcept</directive> and
1991 <code></LimitExcept></code> are used to enclose
1992 a group of access control directives which will then apply to any
1993 HTTP access method <strong>not</strong> listed in the arguments;
1994 i.e., it is the opposite of a <directive type="section"
1995 module="core">Limit</directive> section and can be used to control
1996 both standard and nonstandard/unrecognized methods. See the
1997 documentation for <directive module="core"
1998 type="section">Limit</directive> for more details.</p>
2003 <LimitExcept POST GET><br />
2005 Require valid-user<br />
2007 </LimitExcept>
2011 </directivesynopsis>
2014 <name>LimitInternalRecursion</name>
2015 <description>Determine maximum number of internal redirects and nested
2016 subrequests</description>
2017 <syntax>LimitInternalRecursion <var>number</var> [<var>number</var>]</syntax>
2018 <default>LimitInternalRecursion 10</default>
2019 <contextlist><context>server config</context><context>virtual host</context>
2021 <compatibility>Available in Apache httpd 2.0.47 and later</compatibility>
2024 <p>An internal redirect happens, for example, when using the <directive
2025 module="mod_actions">Action</directive> directive, which internally
2026 redirects the original request to a CGI script. A subrequest is Apache httpd's
2027 mechanism to find out what would happen for some URI if it were requested.
2028 For example, <module>mod_dir</module> uses subrequests to look for the
2029 files listed in the <directive module="mod_dir">DirectoryIndex</directive>
2032 <p><directive>LimitInternalRecursion</directive> prevents the server
2033 from crashing when entering an infinite loop of internal redirects or
2034 subrequests. Such loops are usually caused by misconfigurations.</p>
2036 <p>The directive stores two different limits, which are evaluated on
2037 per-request basis. The first <var>number</var> is the maximum number of
2038 internal redirects, that may follow each other. The second <var>number</var>
2039 determines, how deep subrequests may be nested. If you specify only one
2040 <var>number</var>, it will be assigned to both limits.</p>
2042 <example><title>Example</title>
2043 LimitInternalRecursion 5
2046 </directivesynopsis>
2049 <name>LimitRequestBody</name>
2050 <description>Restricts the total size of the HTTP request body sent
2051 from the client</description>
2052 <syntax>LimitRequestBody <var>bytes</var></syntax>
2053 <default>LimitRequestBody 0</default>
2054 <contextlist><context>server config</context><context>virtual host</context>
2055 <context>directory</context><context>.htaccess</context>
2057 <override>All</override>
2060 <p>This directive specifies the number of <var>bytes</var> from 0
2061 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2062 request body. See the note below for the limited applicability
2063 to proxy requests.</p>
2065 <p>The <directive>LimitRequestBody</directive> directive allows
2066 the user to set a limit on the allowed size of an HTTP request
2067 message body within the context in which the directive is given
2068 (server, per-directory, per-file or per-location). If the client
2069 request exceeds that limit, the server will return an error
2070 response instead of servicing the request. The size of a normal
2071 request message body will vary greatly depending on the nature of
2072 the resource and the methods allowed on that resource. CGI scripts
2073 typically use the message body for retrieving form information.
2074 Implementations of the <code>PUT</code> method will require
2075 a value at least as large as any representation that the server
2076 wishes to accept for that resource.</p>
2078 <p>This directive gives the server administrator greater
2079 control over abnormal client request behavior, which may be
2080 useful for avoiding some forms of denial-of-service
2083 <p>If, for example, you are permitting file upload to a particular
2084 location, and wish to limit the size of the uploaded file to 100K,
2085 you might use the following directive:</p>
2088 LimitRequestBody 102400
2091 <note><p>For a full description of how this directive is interpreted by
2092 proxy requests, see the <module>mod_proxy</module> documentation.</p>
2096 </directivesynopsis>
2099 <name>LimitRequestFields</name>
2100 <description>Limits the number of HTTP request header fields that
2101 will be accepted from the client</description>
2102 <syntax>LimitRequestFields <var>number</var></syntax>
2103 <default>LimitRequestFields 100</default>
2104 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2107 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2108 32767. The default value is defined by the compile-time
2109 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2112 <p>The <directive>LimitRequestFields</directive> directive allows
2113 the server administrator to modify the limit on the number of
2114 request header fields allowed in an HTTP request. A server needs
2115 this value to be larger than the number of fields that a normal
2116 client request might include. The number of request header fields
2117 used by a client rarely exceeds 20, but this may vary among
2118 different client implementations, often depending upon the extent
2119 to which a user has configured their browser to support detailed
2120 content negotiation. Optional HTTP extensions are often expressed
2121 using request header fields.</p>
2123 <p>This directive gives the server administrator greater
2124 control over abnormal client request behavior, which may be
2125 useful for avoiding some forms of denial-of-service attacks.
2126 The value should be increased if normal clients see an error
2127 response from the server that indicates too many fields were
2128 sent in the request.</p>
2133 LimitRequestFields 50
2136 <note type="warning"><title>Warning</title>
2137 <p> When name-based virtual hosting is used, the value for this
2138 directive is taken from the default (first-listed) virtual host for the
2139 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2143 </directivesynopsis>
2146 <name>LimitRequestFieldSize</name>
2147 <description>Limits the size of the HTTP request header allowed from the
2148 client</description>
2149 <syntax>LimitRequestFieldSize <var>bytes</var></syntax>
2150 <default>LimitRequestFieldSize 8190</default>
2151 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2154 <p>This directive specifies the number of <var>bytes</var>
2155 that will be allowed in an HTTP request header.</p>
2157 <p>The <directive>LimitRequestFieldSize</directive> directive
2158 allows the server administrator to reduce or increase the limit
2159 on the allowed size of an HTTP request header field. A server
2160 needs this value to be large enough to hold any one header field
2161 from a normal client request. The size of a normal request header
2162 field will vary greatly among different client implementations,
2163 often depending upon the extent to which a user has configured
2164 their browser to support detailed content negotiation. SPNEGO
2165 authentication headers can be up to 12392 bytes.</p>
2167 <p>This directive gives the server administrator greater
2168 control over abnormal client request behavior, which may be
2169 useful for avoiding some forms of denial-of-service attacks.</p>
2174 LimitRequestFieldSize 4094
2177 <note>Under normal conditions, the value should not be changed from
2180 <note type="warning"><title>Warning</title>
2181 <p> When name-based virtual hosting is used, the value for this
2182 directive is taken from the default (first-listed) virtual host for the
2183 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2187 </directivesynopsis>
2190 <name>LimitRequestLine</name>
2191 <description>Limit the size of the HTTP request line that will be accepted
2192 from the client</description>
2193 <syntax>LimitRequestLine <var>bytes</var></syntax>
2194 <default>LimitRequestLine 8190</default>
2195 <contextlist><context>server config</context><context>virtual host</context></contextlist>
2198 <p>This directive sets the number of <var>bytes</var> that will be
2199 allowed on the HTTP request-line.</p>
2201 <p>The <directive>LimitRequestLine</directive> directive allows
2202 the server administrator to reduce or increase the limit on the allowed size
2203 of a client's HTTP request-line. Since the request-line consists of the
2204 HTTP method, URI, and protocol version, the
2205 <directive>LimitRequestLine</directive> directive places a
2206 restriction on the length of a request-URI allowed for a request
2207 on the server. A server needs this value to be large enough to
2208 hold any of its resource names, including any information that
2209 might be passed in the query part of a <code>GET</code> request.</p>
2211 <p>This directive gives the server administrator greater
2212 control over abnormal client request behavior, which may be
2213 useful for avoiding some forms of denial-of-service attacks.</p>
2218 LimitRequestLine 4094
2221 <note>Under normal conditions, the value should not be changed from
2224 <note type="warning"><title>Warning</title>
2225 <p> When name-based virtual hosting is used, the value for this
2226 directive is taken from the default (first-listed) virtual host for the
2227 <directive>NameVirtualHost</directive> the connection was mapped to.</p>
2231 </directivesynopsis>
2234 <name>LimitXMLRequestBody</name>
2235 <description>Limits the size of an XML-based request body</description>
2236 <syntax>LimitXMLRequestBody <var>bytes</var></syntax>
2237 <default>LimitXMLRequestBody 1000000</default>
2238 <contextlist><context>server config</context><context>virtual host</context>
2239 <context>directory</context><context>.htaccess</context></contextlist>
2240 <override>All</override>
2243 <p>Limit (in bytes) on maximum size of an XML-based request
2244 body. A value of <code>0</code> will disable any checking.</p>
2249 LimitXMLRequestBody 0
2253 </directivesynopsis>
2255 <directivesynopsis type="section">
2256 <name>Location</name>
2257 <description>Applies the enclosed directives only to matching
2259 <syntax><Location
2260 <var>URL-path</var>|<var>URL</var>> ... </Location></syntax>
2261 <contextlist><context>server config</context><context>virtual host</context>
2265 <p>The <directive type="section">Location</directive> directive
2266 limits the scope of the enclosed directives by URL. It is similar to the
2267 <directive type="section" module="core">Directory</directive>
2268 directive, and starts a subsection which is terminated with a
2269 <code></Location></code> directive. <directive
2270 type="section">Location</directive> sections are processed in the
2271 order they appear in the configuration file, after the <directive
2272 type="section" module="core">Directory</directive> sections and
2273 <code>.htaccess</code> files are read, and after the <directive
2274 type="section" module="core">Files</directive> sections.</p>
2276 <p><directive type="section">Location</directive> sections operate
2277 completely outside the filesystem. This has several consequences.
2278 Most importantly, <directive type="section">Location</directive>
2279 directives should not be used to control access to filesystem
2280 locations. Since several different URLs may map to the same
2281 filesystem location, such access controls may by circumvented.</p>
2283 <p>The enclosed directives will be applied to the request if the path component
2284 of the URL meets <em>any</em> of the following criteria:
2287 <li>The specified location matches exactly the path component of the URL.
2289 <li>The specified location, which ends in a forward slash, is a prefix
2290 of the path component of the URL (treated as a context root).
2292 <li>The specified location, with the addition of a trailing slash, is a
2293 prefix of the path component of the URL (also treated as a context root).
2297 In the example below, where no trailing slash is used, requests to
2298 /private1, /private1/ and /private1/file.txt will have the enclosed
2299 directives applied, but /private1other would not.
2302 <Location /private1>
2306 In the example below, where a trailing slash is used, requests to
2307 /private2/ and /private2/file.txt will have the enclosed
2308 directives applied, but /private2 and /private2other would not.
2311 <Location /private2<em>/</em>>
2315 <note><title>When to use <directive
2316 type="section">Location</directive></title>
2318 <p>Use <directive type="section">Location</directive> to apply
2319 directives to content that lives outside the filesystem. For
2320 content that lives in the filesystem, use <directive
2321 type="section" module="core">Directory</directive> and <directive
2322 type="section" module="core">Files</directive>. An exception is
2323 <code><Location /></code>, which is an easy way to
2324 apply a configuration to the entire server.</p>
2327 <p>For all origin (non-proxy) requests, the URL to be matched is a
2328 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2329 port, or query string may be included.</em> For proxy requests, the
2330 URL to be matched is of the form
2331 <code>scheme://servername/path</code>, and you must include the
2334 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2335 any single character, and <code>*</code> matches any sequences of
2336 characters. Neither wildcard character matches a / in the URL-path.</p>
2338 <p><glossary ref="regex">Regular expressions</glossary>
2339 can also be used, with the addition of the <code>~</code>
2340 character. For example:</p>
2343 <Location ~ "/(extra|special)/data">
2346 <p>would match URLs that contained the substring <code>/extra/data</code>
2347 or <code>/special/data</code>. The directive <directive
2348 type="section" module="core">LocationMatch</directive> behaves
2349 identical to the regex version of <directive
2350 type="section">Location</directive>, and is preferred, for the
2351 simple reason that <code>~</code> is hard to distinguish from
2352 <code>-</code> in many fonts.</p>
2354 <p>The <directive type="section">Location</directive>
2355 functionality is especially useful when combined with the
2356 <directive module="core">SetHandler</directive>
2357 directive. For example, to enable status requests, but allow them
2358 only from browsers at <code>example.com</code>, you might use:</p>
2361 <Location /status><br />
2363 SetHandler server-status<br />
2364 Require host example.com<br />
2369 <note><title>Note about / (slash)</title>
2370 <p>The slash character has special meaning depending on where in a
2371 URL it appears. People may be used to its behavior in the filesystem
2372 where multiple adjacent slashes are frequently collapsed to a single
2373 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2374 <code>/home/foo</code>). In URL-space this is not necessarily true.
2375 The <directive type="section" module="core">LocationMatch</directive>
2376 directive and the regex version of <directive type="section"
2377 >Location</directive> require you to explicitly specify multiple
2378 slashes if that is your intention.</p>
2380 <p>For example, <code><LocationMatch ^/abc></code> would match
2381 the request URL <code>/abc</code> but not the request URL <code>
2382 //abc</code>. The (non-regex) <directive type="section"
2383 >Location</directive> directive behaves similarly when used for
2384 proxy requests. But when (non-regex) <directive type="section"
2385 >Location</directive> is used for non-proxy requests it will
2386 implicitly match multiple slashes with a single slash. For example,
2387 if you specify <code><Location /abc/def></code> and the
2388 request is to <code>/abc//def</code> then it will match.</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 <seealso><directive module="core">LocationMatch</directive></seealso>
2395 </directivesynopsis>
2397 <directivesynopsis type="section">
2398 <name>LocationMatch</name>
2399 <description>Applies the enclosed directives only to regular-expression
2400 matching URLs</description>
2401 <syntax><LocationMatch
2402 <var>regex</var>> ... </LocationMatch></syntax>
2403 <contextlist><context>server config</context><context>virtual host</context>
2407 <p>The <directive type="section">LocationMatch</directive> directive
2408 limits the scope of the enclosed directives by URL, in an identical manner
2409 to <directive module="core" type="section">Location</directive>. However,
2410 it takes a <glossary ref="regex">regular expression</glossary>
2411 as an argument instead of a simple string. For example:</p>
2414 <LocationMatch "/(extra|special)/data">
2417 <p>would match URLs that contained the substring <code>/extra/data</code>
2418 or <code>/special/data</code>.</p>
2421 <seealso><a href="../sections.html">How <Directory>, <Location>
2422 and <Files> sections work</a> for an explanation of how these
2423 different sections are combined when a request is received</seealso>
2424 </directivesynopsis>
2427 <name>LogLevel</name>
2428 <description>Controls the verbosity of the ErrorLog</description>
2429 <syntax>LogLevel [<var>module</var>:]<var>level</var>
2430 [<var>module</var>:<var>level</var>] ...
2432 <default>LogLevel warn</default>
2433 <contextlist><context>server config</context><context>virtual host</context>
2434 <context>directory</context>
2436 <compatibility>Per-module and per-directory configuration is available in
2437 Apache HTTP Server 2.3.6 and later</compatibility>
2440 <p><directive>LogLevel</directive> adjusts the verbosity of the
2441 messages recorded in the error logs (see <directive
2442 module="core">ErrorLog</directive> directive). The following
2443 <var>level</var>s are available, in order of decreasing
2447 <columnspec><column width=".2"/><column width=".3"/><column width=".5"/>
2450 <th><strong>Level</strong> </th>
2452 <th><strong>Description</strong> </th>
2454 <th><strong>Example</strong> </th>
2458 <td><code>emerg</code> </td>
2460 <td>Emergencies - system is unusable.</td>
2462 <td>"Child cannot open lock file. Exiting"</td>
2466 <td><code>alert</code> </td>
2468 <td>Action must be taken immediately.</td>
2470 <td>"getpwuid: couldn't determine user name from uid"</td>
2474 <td><code>crit</code> </td>
2476 <td>Critical Conditions.</td>
2478 <td>"socket: Failed to get a socket, exiting child"</td>
2482 <td><code>error</code> </td>
2484 <td>Error conditions.</td>
2486 <td>"Premature end of script headers"</td>
2490 <td><code>warn</code> </td>
2492 <td>Warning conditions.</td>
2494 <td>"child process 1234 did not exit, sending another
2499 <td><code>notice</code> </td>
2501 <td>Normal but significant condition.</td>
2503 <td>"httpd: caught SIGBUS, attempting to dump core in
2508 <td><code>info</code> </td>
2510 <td>Informational.</td>
2512 <td>"Server seems busy, (you may need to increase
2513 StartServers, or Min/MaxSpareServers)..."</td>
2517 <td><code>debug</code> </td>
2519 <td>Debug-level messages</td>
2521 <td>"Opening config file ..."</td>
2524 <td><code>trace1</code> </td>
2526 <td>Trace messages</td>
2528 <td>"proxy: FTP: control connection complete"</td>
2531 <td><code>trace2</code> </td>
2533 <td>Trace messages</td>
2535 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2538 <td><code>trace3</code> </td>
2540 <td>Trace messages</td>
2542 <td>"openssl: Handshake: start"</td>
2545 <td><code>trace4</code> </td>
2547 <td>Trace messages</td>
2549 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2552 <td><code>trace5</code> </td>
2554 <td>Trace messages</td>
2556 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2559 <td><code>trace6</code> </td>
2561 <td>Trace messages</td>
2563 <td>"cache lookup FAILED, forcing new map lookup"</td>
2566 <td><code>trace7</code> </td>
2568 <td>Trace messages, dumping large amounts of data</td>
2570 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2573 <td><code>trace8</code> </td>
2575 <td>Trace messages, dumping large amounts of data</td>
2577 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2581 <p>When a particular level is specified, messages from all
2582 other levels of higher significance will be reported as well.
2583 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2584 then messages with log levels of <code>notice</code> and
2585 <code>warn</code> will also be posted.</p>
2587 <p>Using a level of at least <code>crit</code> is
2596 <note><title>Note</title>
2597 <p>When logging to a regular file messages of the level
2598 <code>notice</code> cannot be suppressed and thus are always
2599 logged. However, this doesn't apply when logging is done
2600 using <code>syslog</code>.</p>
2603 <p>Specifying a level without a module name will reset the level
2604 for all modules to that level. Specifying a level with a module
2605 name will set the level for that module only. It is possible to
2606 use the module source file name, the module identifier, or the
2607 module identifier with the trailing <code>_module</code> omitted
2608 as module specification. This means the following three specifications
2612 LogLevel info ssl:warn<br />
2613 LogLevel info mod_ssl.c:warn<br />
2614 LogLevel info ssl_module:warn<br />
2617 <p>It is also possible to change the level per directory:</p>
2621 <Directory /usr/local/apache/htdocs/app><br />
2622 LogLevel debug<br />
2627 Per directory loglevel configuration only affects messages that are
2628 logged after the request has been parsed and that are associated with
2629 the request. Log messages which are associated with the connection or
2630 the server are not affected.
2633 </directivesynopsis>
2636 <name>MaxKeepAliveRequests</name>
2637 <description>Number of requests allowed on a persistent
2638 connection</description>
2639 <syntax>MaxKeepAliveRequests <var>number</var></syntax>
2640 <default>MaxKeepAliveRequests 100</default>
2641 <contextlist><context>server config</context><context>virtual host</context>
2645 <p>The <directive>MaxKeepAliveRequests</directive> directive
2646 limits the number of requests allowed per connection when
2647 <directive module="core" >KeepAlive</directive> is on. If it is
2648 set to <code>0</code>, unlimited requests will be allowed. We
2649 recommend that this setting be kept to a high value for maximum
2650 server performance.</p>
2655 MaxKeepAliveRequests 500
2658 </directivesynopsis>
2662 <description>Configures mutex mechanism and lock file directory for all
2663 or specified mutexes</description>
2664 <syntax>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</syntax>
2665 <default>Mutex default</default>
2666 <contextlist><context>server config</context></contextlist>
2667 <compatibility>Available in Apache HTTP Server 2.3.4 and later</compatibility>
2670 <p>The <directive>Mutex</directive> directive sets the mechanism,
2671 and optionally the lock file location, that httpd and modules use
2672 to serialize access to resources. Specify <code>default</code> as
2673 the first argument to change the settings for all mutexes; specify
2674 a mutex name (see table below) as the first argument to override
2675 defaults only for that mutex.</p>
2677 <p>The <directive>Mutex</directive> directive is typically used in
2678 the following exceptional situations:</p>
2681 <li>change the mutex mechanism when the default mechanism selected
2682 by <glossary>APR</glossary> has a functional or performance
2685 <li>change the directory used by file-based mutexes when the
2686 default directory does not support locking</li>
2689 <note><title>Supported modules</title>
2690 <p>This directive only configures mutexes which have been registered
2691 with the core server using the <code>ap_mutex_register()</code> API.
2692 All modules bundled with httpd support the <directive>Mutex</directive>
2693 directive, but third-party modules may not. Consult the documentation
2694 of the third-party module, which must indicate the mutex name(s) which
2695 can be configured if this directive is supported.</p>
2698 <p>The following mutex <em>mechanisms</em> are available:</p>
2700 <li><code>default | yes</code>
2701 <p>This selects the default locking implementation, as determined by
2702 <glossary>APR</glossary>. The default locking implementation can
2703 be displayed by running <program>httpd</program> with the
2704 <code>-V</code> option.</p></li>
2706 <li><code>none | no</code>
2707 <p>This effectively disables the mutex, and is only allowed for a
2708 mutex if the module indicates that it is a valid choice. Consult the
2709 module documentation for more information.</p></li>
2711 <li><code>posixsem</code>
2712 <p>This is a mutex variant based on a Posix semaphore.</p>
2714 <note type="warning"><title>Warning</title>
2715 <p>The semaphore ownership is not recovered if a thread in the process
2716 holding the mutex segfaults, resulting in a hang of the web server.</p>
2720 <li><code>sysvsem</code>
2721 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2723 <note type="warning"><title>Warning</title>
2724 <p>It is possible to "leak" SysV semaphores if processes crash
2725 before the semaphore is removed.</p>
2728 <note type="warning"><title>Security</title>
2729 <p>The semaphore API allows for a denial of service attack by any
2730 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2731 all CGIs, unless you use something like <program>suexec</program>
2732 or <code>cgiwrapper</code>).</p>
2736 <li><code>sem</code>
2737 <p>This selects the "best" available semaphore implementation, choosing
2738 between Posix and SystemV IPC semaphores, in that order.</p></li>
2740 <li><code>pthread</code>
2741 <p>This is a mutex variant based on cross-process Posix thread
2744 <note type="warning"><title>Warning</title>
2745 <p>On most systems, if a child process terminates abnormally while
2746 holding a mutex that uses this implementation, the server will deadlock
2747 and stop responding to requests. When this occurs, the server will
2748 require a manual restart to recover.</p>
2749 <p>Solaris is a notable exception as it provides a mechanism which
2750 usually allows the mutex to be recovered after a child process
2751 terminates abnormally while holding a mutex.</p>
2752 <p>If your system implements the
2753 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2754 to use the <code>pthread</code> option safely.</p>
2758 <li><code>fcntl:/path/to/mutex</code>
2759 <p>This is a mutex variant where a physical (lock-)file and the
2760 <code>fcntl()</code> function are used as the mutex.</p>
2762 <note type="warning"><title>Warning</title>
2763 <p>When multiple mutexes based on this mechanism are used within
2764 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2765 can be reported for valid mutex operations if <code>fcntl()</code>
2766 is not thread-aware, such as on Solaris.</p>
2770 <li><code>flock:/path/to/mutex</code>
2771 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2772 with the exception that the <code>flock()</code> function is used to
2773 provide file locking.</p></li>
2775 <li><code>file:/path/to/mutex</code>
2776 <p>This selects the "best" available file locking implementation,
2777 choosing between <code>fcntl</code> and <code>flock</code>, in that
2781 <p>Most mechanisms are only available on selected platforms, where the
2782 underlying platform and <glossary>APR</glossary> support it. Mechanisms
2783 which aren't available on all platforms are <em>posixsem</em>,
2784 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2785 <em>flock</em>, and <em>file</em>.</p>
2787 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2788 the path, if provided, is a directory where the lock file will be created.
2789 The default directory is httpd's run-time file directory relative to
2790 <directive module="core">ServerRoot</directive>. Always use a local disk
2791 filesystem for <code>/path/to/mutex</code> and never a directory residing
2792 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2793 type, an optional instance string provided by the module, and unless the
2794 <code>OmitPID</code> keyword is specified, the process id of the httpd
2795 parent process will be appended to to make the file name unique, avoiding
2796 conflicts when multiple httpd instances share a lock file directory. For
2797 example, if the mutex name is <code>mpm-accept</code> and the lock file
2798 directory is <code>/var/httpd/locks</code>, the lock file name for the
2799 httpd instance with parent process id 12345 would be
2800 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2802 <note type="warning"><title>Security</title>
2803 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2804 directory such as <code>/var/tmp</code> because someone could create
2805 a denial of service attack and prevent the server from starting by
2806 creating a lockfile with the same name as the one the server will try
2810 <p>The following table documents the names of mutexes used by httpd
2811 and bundled modules.</p>
2813 <table border="1" style="zebra">
2817 <th>Protected resource</th>
2820 <td><code>mpm-accept</code></td>
2821 <td><module>prefork</module> and <module>worker</module> MPMs</td>
2822 <td>incoming connections, to avoid the thundering herd problem;
2823 for more information, refer to the
2824 <a href="../misc/perf-tuning.html">performance tuning</a>
2828 <td><code>authdigest-client</code></td>
2829 <td><module>mod_auth_digest</module></td>
2830 <td>client list in shared memory</td>
2833 <td><code>authdigest-opaque</code></td>
2834 <td><module>mod_auth_digest</module></td>
2835 <td>counter in shared memory</td>
2838 <td><code>ldap-cache</code></td>
2839 <td><module>mod_ldap</module></td>
2840 <td>LDAP result cache</td>
2843 <td><code>rewrite-map</code></td>
2844 <td><module>mod_rewrite</module></td>
2845 <td>communication with external mapping programs, to avoid
2846 intermixed I/O from multiple requests</td>
2849 <td><code>ssl-cache</code></td>
2850 <td><module>mod_ssl</module></td>
2851 <td>SSL session cache</td>
2854 <td><code>ssl-stapling</code></td>
2855 <td><module>mod_ssl</module></td>
2856 <td>OCSP stapling response cache</td>
2859 <td><code>watchdog-callback</code></td>
2860 <td><module>mod_watchdog</module></td>
2861 <td>callback function of a particular client module</td>
2865 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2866 parent process id from the lock file name.</p>
2868 <p>In the following example, the mutex mechanism for the MPM accept
2869 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2870 with the associated lock file created in directory
2871 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2872 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2875 Mutex default sysvsem<br />
2876 Mutex mpm-accept fcntl:/var/httpd/locks
2879 </directivesynopsis>
2882 <name>NameVirtualHost</name>
2883 <description>Designates an IP address for name-virtual
2884 hosting</description>
2885 <syntax>NameVirtualHost <var>addr</var>[:<var>port</var>]</syntax>
2886 <contextlist><context>server config</context></contextlist>
2890 <p>A single <directive>NameVirtualHost</directive> directive
2891 identifies a set of identical virtual hosts on which the server will
2892 further select from on the basis of the <em>hostname</em>
2893 requested by the client. The <directive>NameVirtualHost</directive>
2894 directive is a required directive if you want to configure
2895 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2897 <p>This directive, and the corresponding <directive >VirtualHost</directive>,
2898 <em>must</em> be qualified with a port number if the server supports both HTTP
2899 and HTTPS connections.</p>
2901 <p>Although <var>addr</var> can be a hostname, it is recommended
2902 that you always use an IP address or a wildcard. A wildcard
2903 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2904 as their argument.</p>
2906 <p>In cases where a firewall or other proxy receives the requests and
2907 forwards them on a different IP address to the server, you must specify the
2908 IP address of the physical interface on the machine which will be
2909 servicing the requests. </p>
2911 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2912 will only select among the first two virtual hosts. Requests received on
2913 port 80 on any other interface will only select among the third and fourth
2914 virtual hosts. In the common case where the interface isn't important
2915 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2919 NameVirtualHost 192.0.2.1:80<br />
2920 NameVirtualHost *:80<br /><br />
2922 <VirtualHost 192.0.2.1:80><br />
2923 ServerName namebased-a.example.com<br />
2924 </VirtualHost><br />
2926 <VirtualHost 192.0.2.1:80><br />
2927 Servername namebased-b.example.com<br />
2928 </VirtualHost><br />
2930 <VirtualHost *:80><br />
2931 ServerName namebased-c.example.com <br />
2932 </VirtualHost><br />
2934 <VirtualHost *:80><br />
2935 ServerName namebased-d.example.com <br />
2936 </VirtualHost><br />
2941 <p>If no matching virtual host is found, then the first listed
2942 virtual host that matches the IP address and port will be used.</p>
2945 <p>IPv6 addresses must be enclosed in square brackets, as shown
2946 in the following example:</p>
2949 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2952 <note><title>Argument to <directive type="section">VirtualHost</directive>
2954 <p>Note that the argument to the <directive
2955 type="section">VirtualHost</directive> directive must
2956 exactly match the argument to the <directive
2957 >NameVirtualHost</directive> directive.</p>
2960 NameVirtualHost 192.0.2.2:80<br />
2961 <VirtualHost 192.0.2.2:80><br />
2963 </VirtualHost><br />
2968 <seealso><a href="../vhosts/">Virtual Hosts
2969 documentation</a></seealso>
2971 </directivesynopsis>
2974 <name>Options</name>
2975 <description>Configures what features are available in a particular
2976 directory</description>
2978 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</syntax>
2979 <default>Options All</default>
2980 <contextlist><context>server config</context><context>virtual host</context>
2981 <context>directory</context><context>.htaccess</context>
2983 <override>Options</override>
2986 <p>The <directive>Options</directive> directive controls which
2987 server features are available in a particular directory.</p>
2989 <p><var>option</var> can be set to <code>None</code>, in which
2990 case none of the extra features are enabled, or one or more of
2994 <dt><code>All</code></dt>
2996 <dd>All options except for <code>MultiViews</code>. This is the default
2999 <dt><code>ExecCGI</code></dt>
3002 Execution of CGI scripts using <module>mod_cgi</module>
3005 <dt><code>FollowSymLinks</code></dt>
3009 The server will follow symbolic links in this directory.
3011 <p>Even though the server follows the symlink it does <em>not</em>
3012 change the pathname used to match against <directive type="section"
3013 module="core">Directory</directive> sections.</p>
3014 <p>Note also, that this option <strong>gets ignored</strong> if set
3015 inside a <directive type="section" module="core">Location</directive>
3017 <p>Omitting this option should not be considered a security restriction,
3018 since symlink testing is subject to race conditions that make it
3022 <dt><code>Includes</code></dt>
3025 Server-side includes provided by <module>mod_include</module>
3028 <dt><code>IncludesNOEXEC</code></dt>
3032 Server-side includes are permitted, but the <code>#exec
3033 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3034 possible to <code>#include virtual</code> CGI scripts from
3035 <directive module="mod_alias">ScriptAlias</directive>ed
3038 <dt><code>Indexes</code></dt>
3041 If a URL which maps to a directory is requested, and there
3042 is no <directive module="mod_dir">DirectoryIndex</directive>
3043 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3044 <module>mod_autoindex</module> will return a formatted listing
3045 of the directory.</dd>
3047 <dt><code>MultiViews</code></dt>
3050 <a href="../content-negotiation.html">Content negotiated</a>
3051 "MultiViews" are allowed using
3052 <module>mod_negotiation</module>.
3053 <note><title>Note</title> <p>This option gets ignored if set
3054 anywhere other than <directive module="core" type="section"
3055 >Directory</directive>, as <module>mod_negotiation</module>
3056 needs real resources to compare against and evaluate from.</p></note>
3059 <dt><code>SymLinksIfOwnerMatch</code></dt>
3061 <dd>The server will only follow symbolic links for which the
3062 target file or directory is owned by the same user id as the
3065 <note><title>Note</title> <p>This option gets ignored if
3066 set inside a <directive module="core"
3067 type="section">Location</directive> section.</p>
3068 <p>This option should not be considered a security restriction,
3069 since symlink testing is subject to race conditions that make it
3070 circumventable.</p></note>
3074 <p>Normally, if multiple <directive>Options</directive> could
3075 apply to a directory, then the most specific one is used and
3076 others are ignored; the options are not merged. (See <a
3077 href="../sections.html#mergin">how sections are merged</a>.)
3078 However if <em>all</em> the options on the
3079 <directive>Options</directive> directive are preceded by a
3080 <code>+</code> or <code>-</code> symbol, the options are
3081 merged. Any options preceded by a <code>+</code> are added to the
3082 options currently in force, and any options preceded by a
3083 <code>-</code> are removed from the options currently in
3086 <note type="warning"><title>Warning</title>
3087 <p>Mixing <directive>Options</directive> with a <code>+</code> or
3088 <code>-</code> with those without is not valid syntax, and is likely
3089 to cause unexpected results.</p>
3092 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3095 <Directory /web/docs><br />
3097 Options Indexes FollowSymLinks<br />
3099 </Directory><br />
3101 <Directory /web/docs/spec><br />
3103 Options Includes<br />
3108 <p>then only <code>Includes</code> will be set for the
3109 <code>/web/docs/spec</code> directory. However if the second
3110 <directive>Options</directive> directive uses the <code>+</code> and
3111 <code>-</code> symbols:</p>
3114 <Directory /web/docs><br />
3116 Options Indexes FollowSymLinks<br />
3118 </Directory><br />
3120 <Directory /web/docs/spec><br />
3122 Options +Includes -Indexes<br />
3127 <p>then the options <code>FollowSymLinks</code> and
3128 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3131 <note><title>Note</title>
3132 <p>Using <code>-IncludesNOEXEC</code> or
3133 <code>-Includes</code> disables server-side includes completely
3134 regardless of the previous setting.</p>
3137 <p>The default in the absence of any other settings is
3138 <code>All</code>.</p>
3140 </directivesynopsis>
3143 <name>Protocol</name>
3144 <description>Protocol for a listening socket</description>
3145 <syntax>Protocol <var>protocol</var></syntax>
3146 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3147 <compatibility>Available in Apache 2.1.5 and later.
3148 On Windows from Apache 2.3.3 and later.</compatibility>
3151 <p>This directive specifies the protocol used for a specific listening socket.
3152 The protocol is used to determine which module should handle a request, and
3153 to apply protocol specific optimizations with the <directive>AcceptFilter</directive>
3156 <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>
3158 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3164 <p>You can also specify the protocol using the <directive module="mpm_common">Listen</directive> directive.</p>
3166 <seealso><directive>AcceptFilter</directive></seealso>
3167 <seealso><directive module="mpm_common">Listen</directive></seealso>
3168 </directivesynopsis>
3172 <name>RLimitCPU</name>
3173 <description>Limits the CPU consumption of processes launched
3174 by Apache httpd children</description>
3175 <syntax>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</syntax>
3176 <default>Unset; uses operating system defaults</default>
3177 <contextlist><context>server config</context><context>virtual host</context>
3178 <context>directory</context><context>.htaccess</context></contextlist>
3179 <override>All</override>
3182 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3183 resource limit for all processes and the second parameter sets
3184 the maximum resource limit. Either parameter can be a number,
3185 or <code>max</code> to indicate to the server that the limit should
3186 be set to the maximum allowed by the operating system
3187 configuration. Raising the maximum resource limit requires that
3188 the server is running as <code>root</code>, or in the initial startup
3191 <p>This applies to processes forked off from Apache httpd children
3192 servicing requests, not the Apache httpd children themselves. This
3193 includes CGI scripts and SSI exec commands, but not any
3194 processes forked off from the Apache httpd parent such as piped
3197 <p>CPU resource limits are expressed in seconds per
3200 <seealso><directive module="core">RLimitMEM</directive></seealso>
3201 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3202 </directivesynopsis>
3205 <name>RLimitMEM</name>
3206 <description>Limits the memory consumption of processes launched
3207 by Apache httpd children</description>
3208 <syntax>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</syntax>
3209 <default>Unset; uses operating system defaults</default>
3210 <contextlist><context>server config</context><context>virtual host</context>
3211 <context>directory</context><context>.htaccess</context></contextlist>
3212 <override>All</override>
3215 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3216 resource limit for all processes and the second parameter sets
3217 the maximum resource limit. Either parameter can be a number,
3218 or <code>max</code> to indicate to the server that the limit should
3219 be set to the maximum allowed by the operating system
3220 configuration. Raising the maximum resource limit requires that
3221 the server is running as <code>root</code>, or in the initial startup
3224 <p>This applies to processes forked off from Apache httpd children
3225 servicing requests, not the Apache httpd children themselves. This
3226 includes CGI scripts and SSI exec commands, but not any
3227 processes forked off from the Apache httpd parent such as piped
3230 <p>Memory resource limits are expressed in bytes per
3233 <seealso><directive module="core">RLimitCPU</directive></seealso>
3234 <seealso><directive module="core">RLimitNPROC</directive></seealso>
3235 </directivesynopsis>
3238 <name>RLimitNPROC</name>
3239 <description>Limits the number of processes that can be launched by
3240 processes launched by Apache httpd children</description>
3241 <syntax>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</syntax>
3242 <default>Unset; uses operating system defaults</default>
3243 <contextlist><context>server config</context><context>virtual host</context>
3244 <context>directory</context><context>.htaccess</context></contextlist>
3245 <override>All</override>
3248 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3249 resource limit for all processes and the second parameter sets
3250 the maximum resource limit. Either parameter can be a number,
3251 or <code>max</code> to indicate to the server that the limit
3252 should be set to the maximum allowed by the operating system
3253 configuration. Raising the maximum resource limit requires that
3254 the server is running as <code>root</code>, or in the initial startup
3257 <p>This applies to processes forked off from Apache httpd children
3258 servicing requests, not the Apache httpd children themselves. This
3259 includes CGI scripts and SSI exec commands, but not any
3260 processes forked off from the Apache httpd parent such as piped
3263 <p>Process limits control the number of processes per user.</p>
3265 <note><title>Note</title>
3266 <p>If CGI processes are <strong>not</strong> running
3267 under user ids other than the web server user id, this directive
3268 will limit the number of processes that the server itself can
3269 create. Evidence of this situation will be indicated by
3270 <strong><code>cannot fork</code></strong> messages in the
3271 <code>error_log</code>.</p>
3274 <seealso><directive module="core">RLimitMEM</directive></seealso>
3275 <seealso><directive module="core">RLimitCPU</directive></seealso>
3276 </directivesynopsis>
3279 <name>ScriptInterpreterSource</name>
3280 <description>Technique for locating the interpreter for CGI
3281 scripts</description>
3282 <syntax>ScriptInterpreterSource Registry|Registry-Strict|Script</syntax>
3283 <default>ScriptInterpreterSource Script</default>
3284 <contextlist><context>server config</context><context>virtual host</context>
3285 <context>directory</context><context>.htaccess</context></contextlist>
3286 <override>FileInfo</override>
3287 <compatibility>Win32 only;
3288 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3289 later</compatibility>
3292 <p>This directive is used to control how Apache httpd finds the
3293 interpreter used to run CGI scripts. The default setting is
3294 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3295 by the shebang line (first line, starting with <code>#!</code>) in the
3296 script. On Win32 systems this line usually looks like:</p>
3299 #!C:/Perl/bin/perl.exe
3302 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3308 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3309 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3310 searched using the script file extension (e.g., <code>.pl</code>) as a
3311 search key. The command defined by the registry subkey
3312 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3313 <code>Shell\Open\Command</code> is used to open the script file. If the
3314 registry keys cannot be found, Apache httpd falls back to the behavior of the
3315 <code>Script</code> option.</p>
3317 <note type="warning"><title>Security</title>
3318 <p>Be careful when using <code>ScriptInterpreterSource
3319 Registry</code> with <directive
3320 module="mod_alias">ScriptAlias</directive>'ed directories, because
3321 Apache httpd will try to execute <strong>every</strong> file within this
3322 directory. The <code>Registry</code> setting may cause undesired
3323 program calls on files which are typically not executed. For
3324 example, the default open command on <code>.htm</code> files on
3325 most Windows systems will execute Microsoft Internet Explorer, so
3326 any HTTP request for an <code>.htm</code> file existing within the
3327 script directory would start the browser in the background on the
3328 server. This is a good way to crash your system within a minute or
3332 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3333 2.0 does the same thing as <code>Registry</code> but uses only the
3334 subkey <code>Shell\ExecCGI\Command</code>. The
3335 <code>ExecCGI</code> key is not a common one. It must be
3336 configured manually in the windows registry and hence prevents
3337 accidental program calls on your system.</p>
3339 </directivesynopsis>
3342 <name>SeeRequestTail</name>
3343 <description>Determine if mod_status displays the first 63 characters
3344 of a request or the last 63, assuming the request itself is greater than
3345 63 chars.</description>
3346 <syntax>SeeRequestTail On|Off</syntax>
3347 <default>SeeRequestTail Off</default>
3348 <contextlist><context>server config</context></contextlist>
3349 <compatibility>Available in Apache httpd 2.2.7 and later.</compatibility>
3352 <p>mod_status with <code>ExtendedStatus On</code>
3353 displays the actual request being handled.
3354 For historical purposes, only 63 characters of the request
3355 are actually stored for display purposes. This directive
3356 controls whether the 1st 63 characters are stored (the previous
3357 behavior and the default) or if the last 63 characters are. This
3358 is only applicable, of course, if the length of the request is
3359 64 characters or greater.</p>
3361 <p>If Apache httpd is handling <code
3362 >GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code
3363 > mod_status displays as follows:
3368 <th>Off (default)</th>
3369 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3373 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3378 </directivesynopsis>
3381 <name>ServerAdmin</name>
3382 <description>Email address that the server includes in error
3383 messages sent to the client</description>
3384 <syntax>ServerAdmin <var>email-address</var>|<var>URL</var></syntax>
3385 <contextlist><context>server config</context><context>virtual host</context>
3389 <p>The <directive>ServerAdmin</directive> sets the contact address
3390 that the server includes in any error messages it returns to the
3391 client. If the <code>httpd</code> doesn't recognize the supplied argument
3393 assumes, that it's an <var>email-address</var> and prepends it with
3394 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3395 actually use an email address, since there are a lot of CGI scripts that
3396 make that assumption. If you want to use an URL, it should point to another
3397 server under your control. Otherwise users may not be able to contact you in
3400 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3403 ServerAdmin www-admin@foo.example.com
3405 <p>as users do not always mention that they are talking about the
3408 </directivesynopsis>
3411 <name>ServerAlias</name>
3412 <description>Alternate names for a host used when matching requests
3413 to name-virtual hosts</description>
3414 <syntax>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</syntax>
3415 <contextlist><context>virtual host</context></contextlist>
3418 <p>The <directive>ServerAlias</directive> directive sets the
3419 alternate names for a host, for use with <a
3420 href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3421 <directive>ServerAlias</directive> may include wildcards, if appropriate.</p>
3424 <VirtualHost *:80><br />
3425 ServerName server.domain.com<br />
3426 ServerAlias server server2.domain.com server2<br />
3427 ServerAlias *.example.com<br />
3428 UseCanonicalName Off<br />
3430 </VirtualHost>
3433 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3434 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3435 </directivesynopsis>
3438 <name>ServerName</name>
3439 <description>Hostname and port that the server uses to identify
3440 itself</description>
3441 <syntax>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</syntax>
3442 <contextlist><context>server config</context><context>virtual host</context>
3446 <p>The <directive>ServerName</directive> directive sets the
3447 request scheme, hostname and
3448 port that the server uses to identify itself. This is used when
3449 creating redirection URLs.</p>
3451 <p>Additionally, <directive>ServerName</directive> is used (possibly
3452 in conjunction with <directive>ServerAlias</directive>) to uniquely
3453 identify a virtual host, when using <a
3454 href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3456 <p>For example, if the name of the
3457 machine hosting the web server is <code>simple.example.com</code>,
3458 but the machine also has the DNS alias <code>www.example.com</code>
3459 and you wish the web server to be so identified, the following
3460 directive should be used:</p>
3463 ServerName www.example.com:80
3466 <p>The <directive>ServerName</directive> directive
3467 may appear anywhere within the definition of a server. However,
3468 each appearance overrides the previous appearance (within that
3471 <p>If no <directive>ServerName</directive> is specified, then the
3472 server attempts to deduce the hostname by performing a reverse
3473 lookup on the IP address. If no port is specified in the
3474 <directive>ServerName</directive>, then the server will use the
3475 port from the incoming request. For optimal reliability and
3476 predictability, you should specify an explicit hostname and port
3477 using the <directive>ServerName</directive> directive.</p>
3479 <p>If you are using <a
3480 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3481 the <directive>ServerName</directive> inside a
3482 <directive type="section" module="core">VirtualHost</directive>
3483 section specifies what hostname must appear in the request's
3484 <code>Host:</code> header to match this virtual host.</p>
3486 <p>Sometimes, the server runs behind a device that processes SSL,
3487 such as a reverse proxy, load balancer or SSL offload
3488 appliance. When this is the case, specify the
3489 <code>https://</code> scheme and the port number to which the
3490 clients connect in the <directive>ServerName</directive> directive
3491 to make sure that the server generates the correct
3492 self-referential URLs.
3495 <p>See the description of the
3496 <directive module="core">UseCanonicalName</directive> and
3497 <directive module="core">UseCanonicalPhysicalPort</directive> directives for
3498 settings which determine whether self-referential URLs (e.g., by the
3499 <module>mod_dir</module> module) will refer to the
3500 specified port, or to the port number given in the client's request.
3503 <note type="warning">
3504 <p>Failure to set <directive>ServerName</directive> to a name that
3505 your server can resolve to an IP address will result in a startup
3506 warning. <code>httpd</code> will then use whatever hostname it can
3507 determine, using the system's <code>hostname</code> command. This
3508 will almost never be the hostname you actually want.</p>
3510 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3516 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
3517 Apache HTTP Server</a></seealso>
3518 <seealso><a href="../vhosts/">Apache HTTP Server virtual host
3519 documentation</a></seealso>
3520 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3521 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3522 <seealso><directive module="core">NameVirtualHost</directive></seealso>
3523 <seealso><directive module="core">ServerAlias</directive></seealso>
3524 </directivesynopsis>
3527 <name>ServerPath</name>
3528 <description>Legacy URL pathname for a name-based virtual host that
3529 is accessed by an incompatible browser</description>
3530 <syntax>ServerPath <var>URL-path</var></syntax>
3531 <contextlist><context>virtual host</context></contextlist>
3534 <p>The <directive>ServerPath</directive> directive sets the legacy
3535 URL pathname for a host, for use with <a
3536 href="../vhosts/">name-based virtual hosts</a>.</p>
3538 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
3539 </directivesynopsis>
3542 <name>ServerRoot</name>
3543 <description>Base directory for the server installation</description>
3544 <syntax>ServerRoot <var>directory-path</var></syntax>
3545 <default>ServerRoot /usr/local/apache</default>
3546 <contextlist><context>server config</context></contextlist>
3549 <p>The <directive>ServerRoot</directive> directive sets the
3550 directory in which the server lives. Typically it will contain the
3551 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3552 paths in other configuration directives (such as <directive
3553 module="core">Include</directive> or <directive
3554 module="mod_so">LoadModule</directive>, for example) are taken as
3555 relative to this directory.</p>
3557 <example><title>Example</title>
3558 ServerRoot /home/httpd
3562 <seealso><a href="../invoking.html">the <code>-d</code>
3563 option to <code>httpd</code></a></seealso>
3564 <seealso><a href="../misc/security_tips.html#serverroot">the
3565 security tips</a> for information on how to properly set
3566 permissions on the <directive>ServerRoot</directive></seealso>
3567 </directivesynopsis>
3570 <name>ServerSignature</name>
3571 <description>Configures the footer on server-generated documents</description>
3572 <syntax>ServerSignature On|Off|EMail</syntax>
3573 <default>ServerSignature Off</default>
3574 <contextlist><context>server config</context><context>virtual host</context>
3575 <context>directory</context><context>.htaccess</context>
3577 <override>All</override>
3580 <p>The <directive>ServerSignature</directive> directive allows the
3581 configuration of a trailing footer line under server-generated
3582 documents (error messages, <module>mod_proxy</module> ftp directory
3583 listings, <module>mod_info</module> output, ...). The reason why you
3584 would want to enable such a footer line is that in a chain of proxies,
3585 the user often has no possibility to tell which of the chained servers
3586 actually produced a returned error message.</p>
3588 <p>The <code>Off</code>
3589 setting, which is the default, suppresses the footer line (and is
3590 therefore compatible with the behavior of Apache-1.2 and
3591 below). The <code>On</code> setting simply adds a line with the
3592 server version number and <directive
3593 module="core">ServerName</directive> of the serving virtual host,
3594 and the <code>EMail</code> setting additionally creates a
3595 "mailto:" reference to the <directive
3596 module="core">ServerAdmin</directive> of the referenced
3599 <p>After version 2.0.44, the details of the server version number
3600 presented are controlled by the <directive
3601 module="core">ServerTokens</directive> directive.</p>
3603 <seealso><directive module="core">ServerTokens</directive></seealso>
3604 </directivesynopsis>
3607 <name>ServerTokens</name>
3608 <description>Configures the <code>Server</code> HTTP response
3609 header</description>
3610 <syntax>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</syntax>
3611 <default>ServerTokens Full</default>
3612 <contextlist><context>server config</context></contextlist>
3615 <p>This directive controls whether <code>Server</code> response
3616 header field which is sent back to clients includes a
3617 description of the generic OS-type of the server as well as
3618 information about compiled-in modules.</p>
3621 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3623 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3624 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3626 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3628 <dd>Server sends (<em>e.g.</em>): <code>Server:
3631 <dt><code>ServerTokens Major</code></dt>
3633 <dd>Server sends (<em>e.g.</em>): <code>Server:
3634 Apache/2</code></dd>
3636 <dt><code>ServerTokens Minor</code></dt>
3638 <dd>Server sends (<em>e.g.</em>): <code>Server:
3639 Apache/2.4</code></dd>
3641 <dt><code>ServerTokens Min[imal]</code></dt>
3643 <dd>Server sends (<em>e.g.</em>): <code>Server:
3644 Apache/2.4.1</code></dd>
3646 <dt><code>ServerTokens OS</code></dt>
3648 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3653 <p>This setting applies to the entire server, and cannot be
3654 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3656 <p>After version 2.0.44, this directive also controls the
3657 information presented by the <directive
3658 module="core">ServerSignature</directive> directive.</p>
3660 <note>Setting <directive>ServerTokens</directive> to less than
3661 <code>minimal</code> is not recommended because it makes it more
3662 difficult to debug interoperational problems. Also note that
3663 disabling the Server: header does nothing at all to make your
3664 server more secure; the idea of "security through obscurity"
3665 is a myth and leads to a false sense of safety.</note>
3668 <seealso><directive module="core">ServerSignature</directive></seealso>
3669 </directivesynopsis>
3672 <name>SetHandler</name>
3673 <description>Forces all matching files to be processed by a
3674 handler</description>
3675 <syntax>SetHandler <var>handler-name</var>|None</syntax>
3676 <contextlist><context>server config</context><context>virtual host</context>
3677 <context>directory</context><context>.htaccess</context>
3679 <override>FileInfo</override>
3680 <compatibility>Moved into the core in Apache httpd 2.0</compatibility>
3683 <p>When placed into an <code>.htaccess</code> file or a
3684 <directive type="section" module="core">Directory</directive> or
3685 <directive type="section" module="core">Location</directive>
3686 section, this directive forces all matching files to be parsed
3687 through the <a href="../handler.html">handler</a> given by
3688 <var>handler-name</var>. For example, if you had a directory you
3689 wanted to be parsed entirely as imagemap rule files, regardless
3690 of extension, you might put the following into an
3691 <code>.htaccess</code> file in that directory:</p>
3694 SetHandler imap-file
3697 <p>Another example: if you wanted to have the server display a
3698 status report whenever a URL of
3699 <code>http://servername/status</code> was called, you might put
3700 the following into <code>httpd.conf</code>:</p>
3703 <Location /status><br />
3705 SetHandler server-status<br />
3710 <p>You can override an earlier defined <directive>SetHandler</directive>
3711 directive by using the value <code>None</code>.</p>
3712 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3713 normal behaviour such as handling of URLs ending in a slash (/) as
3714 directories or index files is suppressed.</p>
3717 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
3719 </directivesynopsis>
3722 <name>SetInputFilter</name>
3723 <description>Sets the filters that will process client requests and POST
3725 <syntax>SetInputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3726 <contextlist><context>server config</context><context>virtual host</context>
3727 <context>directory</context><context>.htaccess</context>
3729 <override>FileInfo</override>
3732 <p>The <directive>SetInputFilter</directive> directive sets the
3733 filter or filters which will process client requests and POST
3734 input when they are received by the server. This is in addition to
3735 any filters defined elsewhere, including the
3736 <directive module="mod_mime">AddInputFilter</directive>
3739 <p>If more than one filter is specified, they must be separated
3740 by semicolons in the order in which they should process the
3743 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3744 </directivesynopsis>
3747 <name>SetOutputFilter</name>
3748 <description>Sets the filters that will process responses from the
3749 server</description>
3750 <syntax>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</syntax>
3751 <contextlist><context>server config</context><context>virtual host</context>
3752 <context>directory</context><context>.htaccess</context>
3754 <override>FileInfo</override>
3757 <p>The <directive>SetOutputFilter</directive> directive sets the filters
3758 which will process responses from the server before they are
3759 sent to the client. This is in addition to any filters defined
3760 elsewhere, including the
3761 <directive module="mod_mime">AddOutputFilter</directive>
3764 <p>For example, the following configuration will process all files
3765 in the <code>/www/data/</code> directory for server-side
3769 <Directory /www/data/><br />
3771 SetOutputFilter INCLUDES<br />
3776 <p>If more than one filter is specified, they must be separated
3777 by semicolons in the order in which they should process the
3780 <seealso><a href="../filter.html">Filters</a> documentation</seealso>
3781 </directivesynopsis>
3784 <name>TimeOut</name>
3785 <description>Amount of time the server will wait for
3786 certain events before failing a request</description>
3787 <syntax>TimeOut <var>seconds</var></syntax>
3788 <default>TimeOut 60</default>
3789 <contextlist><context>server config</context><context>virtual host</context></contextlist>
3792 <p>The <directive>TimeOut</directive> directive defines the length
3793 of time Apache httpd will wait for I/O in various circumstances:</p>
3796 <li>When reading data from the client, the length of time to
3797 wait for a TCP packet to arrive if the read buffer is
3800 <li>When writing data to the client, the length of time to wait
3801 for an acknowledgement of a packet if the send buffer is
3804 <li>In <module>mod_cgi</module>, the length of time to wait for
3805 output from a CGI script.</li>
3807 <li>In <module>mod_ext_filter</module>, the length of time to
3808 wait for output from a filtering process.</li>
3810 <li>In <module>mod_proxy</module>, the default timeout value if
3811 <directive module="mod_proxy">ProxyTimeout</directive> is not
3816 </directivesynopsis>
3819 <name>TraceEnable</name>
3820 <description>Determines the behaviour on <code>TRACE</code> requests</description>
3821 <syntax>TraceEnable <var>[on|off|extended]</var></syntax>
3822 <default>TraceEnable on</default>
3823 <contextlist><context>server config</context></contextlist>
3824 <compatibility>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</compatibility>
3827 <p>This directive overrides the behavior of <code>TRACE</code> for both
3828 the core server and <module>mod_proxy</module>. The default
3829 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3830 RFC 2616, which disallows any request body to accompany the request.
3831 <code>TraceEnable off</code> causes the core server and
3832 <module>mod_proxy</module> to return a <code>405</code> (Method not
3833 allowed) error to the client.</p>
3835 <p>Finally, for testing and diagnostic purposes only, request
3836 bodies may be allowed using the non-compliant <code>TraceEnable
3837 extended</code> directive. The core (as an origin server) will
3838 restrict the request body to 64k (plus 8k for chunk headers if
3839 <code>Transfer-Encoding: chunked</code> is used). The core will
3840 reflect the full headers and all chunk headers with the response
3841 body. As a proxy server, the request body is not restricted to 64k.</p>
3843 </directivesynopsis>
3846 <name>UnDefine</name>
3847 <description>Undefine the existence of a variable</description>
3848 <syntax>UnDefine <var>parameter-name</var></syntax>
3849 <contextlist><context>server config</context></contextlist>
3852 <p>Undoes the effect of a <directive module="core">Define</directive> or
3853 of passing a <code>-D</code> argument to <program>httpd</program>.</p>
3854 <p>This directive can be used to toggle the use of <directive module="core"
3855 type="section">IfDefine</directive> sections without needing to alter
3856 <code>-D</code> arguments in any startup scripts.</p>
3858 </directivesynopsis>
3861 <name>UseCanonicalName</name>
3862 <description>Configures how the server determines its own name and
3864 <syntax>UseCanonicalName On|Off|DNS</syntax>
3865 <default>UseCanonicalName Off</default>
3866 <contextlist><context>server config</context><context>virtual host</context>
3867 <context>directory</context></contextlist>
3870 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3871 URL -- that is, a URL that refers back to the same server. With
3872 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3873 specified in the <directive module="core">ServerName</directive>
3874 directive to construct the canonical name for the server. This name
3875 is used in all self-referential URLs, and for the values of
3876 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3878 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3879 self-referential URLs using the hostname and port supplied by
3880 the client if any are supplied (otherwise it will use the
3881 canonical name, as defined above). These values are the same
3882 that are used to implement <a
3883 href="../vhosts/name-based.html">name-based virtual hosts</a>,
3884 and are available with the same clients. The CGI variables
3885 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3886 constructed from the client supplied values as well.</p>
3888 <p>An example where this may be useful is on an intranet server
3889 where you have users connecting to the machine using short
3890 names such as <code>www</code>. You'll notice that if the users
3891 type a shortname, and a URL which is a directory, such as
3892 <code>http://www/splat</code>, <em>without the trailing
3893 slash</em> then Apache httpd will redirect them to
3894 <code>http://www.domain.com/splat/</code>. If you have
3895 authentication enabled, this will cause the user to have to
3896 authenticate twice (once for <code>www</code> and once again
3897 for <code>www.domain.com</code> -- see <a
3898 href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3899 FAQ on this subject for more information</a>). But if
3900 <directive>UseCanonicalName</directive> is set <code>Off</code>, then
3901 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3903 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3904 which is intended for use with mass IP-based virtual hosting to
3905 support ancient clients that do not provide a
3906 <code>Host:</code> header. With this option Apache httpd does a
3907 reverse DNS lookup on the server IP address that the client
3908 connected to in order to work out self-referential URLs.</p>
3910 <note type="warning"><title>Warning</title>
3911 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3912 they may be broken by this option. The client is essentially free
3913 to give whatever value they want as a hostname. But if the CGI is
3914 only using <code>SERVER_NAME</code> to construct self-referential URLs
3915 then it should be just fine.</p>
3918 <seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
3919 <seealso><directive module="core">ServerName</directive></seealso>
3920 <seealso><directive module="mpm_common">Listen</directive></seealso>
3921 </directivesynopsis>
3924 <name>UseCanonicalPhysicalPort</name>
3925 <description>Configures how the server determines its own name and
3927 <syntax>UseCanonicalPhysicalPort On|Off</syntax>
3928 <default>UseCanonicalPhysicalPort Off</default>
3929 <contextlist><context>server config</context><context>virtual host</context>
3930 <context>directory</context></contextlist>
3933 <p>In many situations Apache httpd must construct a <em>self-referential</em>
3934 URL -- that is, a URL that refers back to the same server. With
3935 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
3936 constructing the canonical port for the server to honor
3937 the <directive module="core">UseCanonicalName</directive> directive,
3938 provide the actual physical port number being used by this request
3939 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3940 Apache httpd will not ever use the actual physical port number, instead
3941 relying on all configured information to construct a valid port number.</p>
3943 <note><title>Note</title>
3944 <p>The ordering of when the physical port is used is as follows:<br /><br />
3945 <code>UseCanonicalName On</code></p>
3947 <li>Port provided in <code>Servername</code></li>
3948 <li>Physical port</li>
3949 <li>Default port</li>
3951 <code>UseCanonicalName Off | DNS</code>
3953 <li>Parsed port from <code>Host:</code> header</li>
3954 <li>Physical port</li>
3955 <li>Port provided in <code>Servername</code></li>
3956 <li>Default port</li>
3959 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3960 physical ports are removed from the ordering.</p>
3964 <seealso><directive module="core">UseCanonicalName</directive></seealso>
3965 <seealso><directive module="core">ServerName</directive></seealso>
3966 <seealso><directive module="mpm_common">Listen</directive></seealso>
3967 </directivesynopsis>
3969 <directivesynopsis type="section">
3970 <name>VirtualHost</name>
3971 <description>Contains directives that apply only to a specific
3972 hostname or IP address</description>
3973 <syntax><VirtualHost
3974 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3975 ...> ... </VirtualHost></syntax>
3976 <contextlist><context>server config</context></contextlist>
3979 <p><directive type="section">VirtualHost</directive> and
3980 <code></VirtualHost></code> are used to enclose a group of
3981 directives that will apply only to a particular virtual host. Any
3982 directive that is allowed in a virtual host context may be
3983 used. When the server receives a request for a document on a
3984 particular virtual host, it uses the configuration directives
3985 enclosed in the <directive type="section">VirtualHost</directive>
3986 section. <var>Addr</var> can be:</p>
3989 <li>The IP address of the virtual host;</li>
3991 <li>A fully qualified domain name for the IP address of the
3992 virtual host (not recommended);</li>
3994 <li>The character <code>*</code>, which is used only in combination with
3995 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3997 <li>The string <code>_default_</code>, which is used only
3998 with IP virtual hosting to catch unmatched IP addresses.</li>
4001 <example><title>Example</title>
4002 <VirtualHost 10.1.2.3><br />
4004 ServerAdmin webmaster@host.example.com<br />
4005 DocumentRoot /www/docs/host.example.com<br />
4006 ServerName host.example.com<br />
4007 ErrorLog logs/host.example.com-error_log<br />
4008 TransferLog logs/host.example.com-access_log<br />
4010 </VirtualHost>
4014 <p>IPv6 addresses must be specified in square brackets because
4015 the optional port number could not be determined otherwise. An
4016 IPv6 example is shown below:</p>
4019 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
4021 ServerAdmin webmaster@host.example.com<br />
4022 DocumentRoot /www/docs/host.example.com<br />
4023 ServerName host.example.com<br />
4024 ErrorLog logs/host.example.com-error_log<br />
4025 TransferLog logs/host.example.com-access_log<br />
4027 </VirtualHost>
4030 <p>Each Virtual Host must correspond to a different IP address,
4031 different port number or a different host name for the server,
4032 in the former case the server machine must be configured to
4033 accept IP packets for multiple addresses. (If the machine does
4034 not have multiple network interfaces, then this can be
4035 accomplished with the <code>ifconfig alias</code> command -- if
4036 your OS supports it).</p>
4038 <note><title>Note</title>
4039 <p>The use of <directive type="section">VirtualHost</directive> does
4040 <strong>not</strong> affect what addresses Apache httpd listens on. You
4041 may need to ensure that Apache httpd is listening on the correct addresses
4042 using <directive module="mpm_common">Listen</directive>.</p>
4045 <p>When using IP-based virtual hosting, the special name
4046 <code>_default_</code> can be specified in
4047 which case this virtual host will match any IP address that is
4048 not explicitly listed in another virtual host. In the absence
4049 of any <code>_default_</code> virtual host the "main" server config,
4050 consisting of all those definitions outside any VirtualHost
4051 section, is used when no IP-match occurs.</p>
4053 <p>You can specify a <code>:port</code> to change the port that is
4054 matched. If unspecified then it defaults to the same port as the
4055 most recent <directive module="mpm_common">Listen</directive>
4056 statement of the main server. You may also specify <code>:*</code>
4057 to match all ports on that address. (This is recommended when used
4058 with <code>_default_</code>.)</p>
4060 <p>A <directive module="core">ServerName</directive> should be
4061 specified inside each <directive
4062 type="section">VirtualHost</directive> block. If it is absent, the
4063 <directive module="core">ServerName</directive> from the "main"
4064 server configuration will be inherited.</p>
4066 <p>If no matching virtual host is found, then the first listed
4067 virtual host that matches the IP address will be used. As a
4068 consequence, the first listed virtual host is the default virtual
4071 <note type="warning"><title>Security</title>
4072 <p>See the <a href="../misc/security_tips.html">security tips</a>
4073 document for details on why your security could be compromised if the
4074 directory where log files are stored is writable by anyone other
4075 than the user that starts the server.</p>
4078 <seealso><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></seealso>
4079 <seealso><a href="../dns-caveats.html">Issues Regarding DNS and
4080 Apache HTTP Server</a></seealso>
4081 <seealso><a href="../bind.html">Setting
4082 which addresses and ports Apache HTTP Server uses</a></seealso>
4083 <seealso><a href="../sections.html">How <Directory>, <Location>
4084 and <Files> sections work</a> for an explanation of how these
4085 different sections are combined when a request is received</seealso>
4086 </directivesynopsis>