]> granicus.if.org Git - apache/blob - docs/manual/mod/core.html.en
40053607b93342bcbcdfd0984e11d0f7df144cbe
[apache] / docs / manual / mod / core.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>core - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Core Features</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
25 <a href="../en/mod/core.html" title="English">&nbsp;en&nbsp;</a> |
26 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
27 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
28 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
29 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
30 </div>
31 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
32 available</td></tr>
33 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
34 </div>
35 <div id="quickview"><h3 class="directives">Directives</h3>
36 <ul id="toc">
37 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#directory">&lt;Directory&gt;</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch">&lt;DirectoryMatch&gt;</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#else">&lt;Else&gt;</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#elseif">&lt;ElseIf&gt;</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#error">Error</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#errorlogformat">ErrorLogFormat</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#files">&lt;Files&gt;</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch">&lt;FilesMatch&gt;</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#gprofdir">GprofDir</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#if">&lt;If&gt;</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine">&lt;IfDefine&gt;</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule">&lt;IfModule&gt;</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#limit">&lt;Limit&gt;</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept">&lt;LimitExcept&gt;</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#location">&lt;Location&gt;</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch">&lt;LocationMatch&gt;</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
107 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost">&lt;VirtualHost&gt;</a></li>
108 </ul>
109 </div>
110
111 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
112 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
113 <table class="directive">
114 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
115 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
116 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
117 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
118 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
119 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.1.5 and later.
120 On Windows from Apache httpd 2.3.3 and later.</td></tr>
121 </table>
122     <p>This directive enables operating system specific optimizations for a
123        listening socket by the <code class="directive">Protocol</code>type.
124        The basic premise is for the kernel to not send a socket to the server
125        process until either data is received or an entire HTTP Request is buffered.
126        Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&amp;sektion=9">
127        FreeBSD's Accept Filters</a>, Linux's more primitive
128        <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
129        are currently supported.</p>
130
131     <p>Using <code>none</code> for an argument will disable any accept filters
132        for that protocol.  This is useful for protocols that require a server
133        send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
134     <div class="example"><p><code>AcceptFilter nntp none</code></p></div>
135
136     <p>The default protocol names are <code>https</code> for port 443
137        and <code>http</code> for all other ports.  To specify another protocol
138        is being used with a listening port, add the <var>protocol</var>
139        argument to the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
140        directive.</p>
141
142     <p>The default values on FreeBSD are:</p>
143     <div class="example"><p><code>
144         AcceptFilter http httpready <br />
145         AcceptFilter https dataready
146     </code></p></div>
147
148     <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
149        the kernel level.  Once an entire request is received, the kernel then
150        sends it to the server. See the
151        <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&amp;sektion=9">
152        accf_http(9)</a> man page for more details.  Since HTTPS requests are
153        encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&amp;sektion=9">
154        accf_data(9)</a> filter is used.</p>
155
156     <p>The default values on Linux are:</p>
157     <div class="example"><p><code>
158         AcceptFilter http data <br />
159         AcceptFilter https data
160     </code></p></div>
161
162     <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
163        requests.  Any value besides <code>none</code> will enable
164        <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
165        see the Linux
166        <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
167        tcp(7)</a> man page.</p>
168
169     <p>The default values on Windows are:</p>
170     <div class="example"><p><code>
171         AcceptFilter http data <br />
172         AcceptFilter https data
173     </code></p></div>
174
175     <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
176        API, and does not support http protocol buffering.  There are two values
177        which utilize the Windows AcceptEx() API and will recycle network
178        sockets between connections.  <code>data</code> waits until data has
179        been transmitted as documented above, and the initial data buffer and
180        network endpoint addresses are all retrieved from the single AcceptEx()
181        invocation.  <code>connect</code> will use the AcceptEx() API, also
182        retrieve the network endpoint addresses, but like <code>none</code>
183        the <code>connect</code> option does not wait for the initial data
184        transmission.</p>
185
186     <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
187        and will not recycle sockets between connections.  This is useful for
188        network adapters with broken driver support, as well as some virtual
189        network providers such as vpn drivers, or spam, virus or spyware
190        filters.</p>
191
192
193 <h3>See also</h3>
194 <ul>
195 <li><code class="directive">Protocol</code></li>
196 </ul>
197 </div>
198 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
199 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
200 <table class="directive">
201 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
202 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
203 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
204 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
205 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
206 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
207 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
208 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.30 and later</td></tr>
209 </table>
210
211     <p>This directive controls whether requests that contain trailing
212     pathname information that follows an actual filename (or
213     non-existent file in an existing directory) will be accepted or
214     rejected.  The trailing pathname information can be made
215     available to scripts in the <code>PATH_INFO</code> environment
216     variable.</p>
217
218     <p>For example, assume the location <code>/test/</code> points to
219     a directory that contains only the single file
220     <code>here.html</code>.  Then requests for
221     <code>/test/here.html/more</code> and
222     <code>/test/nothere.html/more</code> both collect
223     <code>/more</code> as <code>PATH_INFO</code>.</p>
224
225     <p>The three possible arguments for the
226     <code class="directive">AcceptPathInfo</code> directive are:</p>
227     <dl>
228     <dt><code>Off</code></dt><dd>A request will only be accepted if it
229     maps to a literal path that exists.  Therefore a request with
230     trailing pathname information after the true filename such as
231     <code>/test/here.html/more</code> in the above example will return
232     a 404 NOT FOUND error.</dd>
233
234     <dt><code>On</code></dt><dd>A request will be accepted if a
235     leading path component maps to a file that exists.  The above
236     example <code>/test/here.html/more</code> will be accepted if
237     <code>/test/here.html</code> maps to a valid file.</dd>
238
239     <dt><code>Default</code></dt><dd>The treatment of requests with
240     trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
241     The core handler for normal files defaults to rejecting
242     <code>PATH_INFO</code> requests. Handlers that serve scripts, such as <a href="mod_cgi.html">cgi-script</a> and <a href="mod_isapi.html">isapi-handler</a>, generally accept
243     <code>PATH_INFO</code> by default.</dd>
244     </dl>
245
246     <p>The primary purpose of the <code>AcceptPathInfo</code>
247     directive is to allow you to override the handler's choice of
248     accepting or rejecting <code>PATH_INFO</code>. This override is required,
249     for example, when you use a <a href="../filter.html">filter</a>, such
250     as <a href="mod_include.html">INCLUDES</a>, to generate content
251     based on <code>PATH_INFO</code>.  The core handler would usually reject
252     the request, so you can use the following configuration to enable
253     such a script:</p>
254
255     <div class="example"><p><code>
256       &lt;Files "mypaths.shtml"&gt;<br />
257       <span class="indent">
258         Options +Includes<br />
259         SetOutputFilter INCLUDES<br />
260         AcceptPathInfo On<br />
261       </span>
262       &lt;/Files&gt;
263     </code></p></div>
264
265
266 </div>
267 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
268 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
269 <table class="directive">
270 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
271 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
272 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
273 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
274 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
275 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
276 </table>
277     <p>While processing a request the server looks for
278     the first existing configuration file from this list of names in
279     every directory of the path to the document, if distributed
280     configuration files are <a href="#allowoverride">enabled for that
281     directory</a>. For example:</p>
282
283     <div class="example"><p><code>
284       AccessFileName .acl
285     </code></p></div>
286
287     <p>before returning the document
288     <code>/usr/local/web/index.html</code>, the server will read
289     <code>/.acl</code>, <code>/usr/.acl</code>,
290     <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
291     for directives, unless they have been disabled with</p>
292
293     <div class="example"><p><code>
294       &lt;Directory /&gt;<br />
295       <span class="indent">
296         AllowOverride None<br />
297       </span>
298       &lt;/Directory&gt;
299     </code></p></div>
300
301 <h3>See also</h3>
302 <ul>
303 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
304 <li><a href="../configuring.html">Configuration Files</a></li>
305 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
306 </ul>
307 </div>
308 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
309 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
310 <table class="directive">
311 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
312 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
313 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
314 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
315 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
316 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
317 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
318 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
319 </table>
320     <p>This directive specifies a default value for the media type
321     charset parameter (the name of a character encoding) to be added
322     to a response if and only if the response's content-type is either
323     <code>text/plain</code> or <code>text/html</code>.  This should override
324     any charset specified in the body of the response via a <code>META</code>
325     element, though the exact behavior is often dependent on the user's client
326     configuration. A setting of <code>AddDefaultCharset Off</code>
327     disables this functionality. <code>AddDefaultCharset On</code> enables
328     a default charset of <code>iso-8859-1</code>. Any other value is assumed
329     to be the <var>charset</var> to be used, which should be one of the
330     <a href="http://www.iana.org/assignments/character-sets">IANA registered
331     charset values</a> for use in Internet media types (MIME types).
332     For example:</p>
333
334     <div class="example"><p><code>
335       AddDefaultCharset utf-8
336     </code></p></div>
337
338     <p><code class="directive">AddDefaultCharset</code> should only be used when all
339     of the text resources to which it applies are known to be in that
340     character encoding and it is too inconvenient to label their charset
341     individually. One such example is to add the charset parameter
342     to resources containing generated content, such as legacy CGI
343     scripts, that might be vulnerable to cross-site scripting attacks
344     due to user-provided data being included in the output.  Note, however,
345     that a better solution is to just fix (or delete) those scripts, since
346     setting a default charset does not protect users that have enabled
347     the "auto-detect character encoding" feature on their browser.</p>
348
349 <h3>See also</h3>
350 <ul>
351 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
352 </ul>
353 </div>
354 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
355 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
356 <table class="directive">
357 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
358 be passed through</td></tr>
359 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off|NoDecode</code></td></tr>
360 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
361 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
362 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
363 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
364 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.46 and later.
365 NoDecode option available in 2.3.12 and later.</td></tr>
366 </table>
367     <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
368     which contain encoded path separators (<code>%2F</code> for <code>/</code>
369     and additionally <code>%5C</code> for <code>\</code> on according systems)
370     to be used in the path info.</p>
371
372     <p>With the default value, <code>Off</code>, such URLs are refused
373     with a 404 (Not found) error.</p>
374
375     <p>With the value <code>On</code>, such URLs are accepted, and encoded
376       slashes are decoded like all other encoded characters.</p>
377
378     <p>With the value <code>NoDecode</code>, such URLs are accepted, but
379       encoded slashes are not decoded but left in their encoded state.</p>
380
381     <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
382     mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
383
384     <div class="note"><h3>Note</h3>
385       <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
386       strongly recommended as a security measure.  Allowing slashes
387       to be decoded could potentially allow unsafe paths.</p>
388     </div>
389
390 <h3>See also</h3>
391 <ul>
392 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
393 </ul>
394 </div>
395 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
396 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
397 <table class="directive">
398 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
399 <code>.htaccess</code> files</td></tr>
400 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
401 [<var>directive-type</var>] ...</code></td></tr>
402 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</code></td></tr>
403 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
404 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
405 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
406 </table>
407     <p>When the server finds an <code>.htaccess</code> file (as
408     specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
409     it needs to know which directives declared in that file can override
410     earlier configuration directives.</p>
411
412     <div class="note"><h3>Only available in &lt;Directory&gt; sections</h3>
413     <code class="directive">AllowOverride</code> is valid only in
414     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
415     sections specified without regular expressions, not in <code class="directive"><a href="#location">&lt;Location&gt;</a></code>, <code class="directive"><a href="#directorymatch">&lt;DirectoryMatch&gt;</a></code> or
416     <code class="directive"><a href="#files">&lt;Files&gt;</a></code> sections.
417     </div>
418
419     <p>When this directive is set to <code>None</code>, then
420     <a href="#accessfilename">.htaccess</a> files are completely ignored.
421     In this case, the server will not even attempt to read
422     <code>.htaccess</code> files in the filesystem.</p>
423
424     <p>When this directive is set to <code>All</code>, then any
425     directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
426     <code>.htaccess</code> files.</p>
427
428     <p>The <var>directive-type</var> can be one of the following
429     groupings of directives.</p>
430
431     <dl>
432       <dt>AuthConfig</dt>
433
434       <dd>
435
436       Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
437       <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
438       <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
439       <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
440       <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code>, <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code>, <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>, <em>etc.</em>).</dd>
441
442       <dt>FileInfo</dt>
443
444       <dd>
445       Allow use of the directives controlling document types
446      (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
447       <code class="directive"><a href="#forcetype">ForceType</a></code>,
448       <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
449       <code class="directive"><a href="#sethandler">SetHandler</a></code>,
450       <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
451       <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
452       <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
453       document meta data (<code class="directive"><a href="../mod/mod_headers.html#header">Header</a></code>, <code class="directive"><a href="../mod/mod_headers.html#requestheader">RequestHeader</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#setenvifnocase">SetEnvIfNoCase</a></code>, <code class="directive"><a href="../mod/mod_setenvif.html#browsermatch">BrowserMatch</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookieexpires">CookieExpires</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiedomain">CookieDomain</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiestyle">CookieStyle</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookietracking">CookieTracking</a></code>, <code class="directive"><a href="../mod/mod_usertrack.html#cookiename">CookieName</a></code>),
454       <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> directives <code class="directive"><a href="../mod/mod_rewrite.html#rewriteengine">RewriteEngine</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriteoptions">RewriteOptions</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>) and
455       <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
456       <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
457       </dd>
458
459       <dt>Indexes</dt>
460
461       <dd>
462       Allow use of the directives controlling directory indexing
463       (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
464       <code class="directive"><a href="../mod/mod_autoindex.html#addicon">AddIcon</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#addiconbyencoding">AddIconByEncoding</a></code>,
465       <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
466       <code class="directive"><a href="../mod/mod_autoindex.html#defaulticon">DefaultIcon</a></code>, <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#fancyindexing">FancyIndexing</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#headername">HeaderName</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexignore">IndexIgnore</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexoptions">IndexOptions</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#readmename">ReadmeName</a></code>,
467       <em>etc.</em>).</dd>
468
469       <dt>Limit</dt>
470
471       <dd>
472       Allow use of the directives controlling host access (<code class="directive"><a href="../mod/mod_authz_host.html#allow">Allow</a></code>, <code class="directive"><a href="../mod/mod_authz_host.html#deny">Deny</a></code> and <code class="directive"><a href="../mod/mod_authz_host.html#order">Order</a></code>).</dd>
473
474       <dt>Options[=<var>Option</var>,...]</dt>
475
476       <dd>
477       Allow use of the directives controlling specific directory
478       features (<code class="directive"><a href="#options">Options</a></code> and
479       <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
480       An equal sign may be given followed by a comma (but no spaces)
481       separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.</dd>
482     </dl>
483
484     <p>Example:</p>
485
486     <div class="example"><p><code>
487       AllowOverride AuthConfig Indexes
488     </code></p></div>
489
490     <p>In the example above all directives that are neither in the group
491     <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
492     server error.</p>
493
494     <div class="note"><p>For security and performance reasons, do not set
495     <code>AllowOverride</code> to anything other than <code>None</code>
496     in your <code>&lt;Directory /&gt;</code> block. Instead, find (or
497     create) the <code>&lt;Directory&gt;</code> block that refers to the
498     directory where you're actually planning to place a
499     <code>.htaccess</code> file.</p>
500     </div>
501
502 <h3>See also</h3>
503 <ul>
504 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
505 <li><a href="../configuring.html">Configuration Files</a></li>
506 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
507 </ul>
508 </div>
509 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
510 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
511 <table class="directive">
512 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
513 scripts</td></tr>
514 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
515 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
516 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
517 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
518 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
519 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
520 </table>
521     <p>This directive is used to control how Apache httpd finds the
522     interpreter used to run CGI scripts. For example, setting
523     <code>CGIMapExtension sys:\foo.nlm .foo</code> will
524     cause all CGI script files with a <code>.foo</code> extension to
525     be passed to the FOO interpreter.</p>
526
527 </div>
528 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
529 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
530 <table class="directive">
531 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
532 headers</td></tr>
533 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
534 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
535 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
536 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
537 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
538 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
539 </table>
540     <p>This directive enables the generation of
541     <code>Content-MD5</code> headers as defined in RFC1864
542     respectively RFC2616.</p>
543
544     <p>MD5 is an algorithm for computing a "message digest"
545     (sometimes called "fingerprint") of arbitrary-length data, with
546     a high degree of confidence that any alterations in the data
547     will be reflected in alterations in the message digest.</p>
548
549     <p>The <code>Content-MD5</code> header provides an end-to-end
550     message integrity check (MIC) of the entity-body. A proxy or
551     client may check this header for detecting accidental
552     modification of the entity-body in transit. Example header:</p>
553
554     <div class="example"><p><code>
555       Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
556     </code></p></div>
557
558     <p>Note that this can cause performance problems on your server
559     since the message digest is computed on every request (the
560     values are not cached).</p>
561
562     <p><code>Content-MD5</code> is only sent for documents served
563     by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
564     SSI documents, output from CGI scripts, and byte range responses
565     do not have this header.</p>
566
567 </div>
568 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
569 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
570 <table class="directive">
571 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
572 if the value is not <code>none</code>. In prior versions, DefaultType
573 would specify a default media type to assign to response content for
574 which no other media type configuration could be found.
575 </td></tr>
576 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
577 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
578 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
579 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
580 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
581 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
582 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>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.</td></tr>
583 </table>
584     <p>This directive has been disabled.  For backwards compatibility
585     of configuration files, it may be specified with the value
586     <code>none</code>, meaning no default media type. For example:</p>
587
588     <div class="example"><p><code>
589       DefaultType None
590     </code></p></div>
591
592     <p><code>DefaultType None</code> is only available in
593     httpd-2.2.7 and later.</p>
594
595     <p>Use the mime.types configuration file and the
596     <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
597     type assignments via file extensions, or the
598     <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
599     the media type for specific resources. Otherwise, the server will
600     send the response without a Content-Type header field and the
601     recipient may attempt to guess the media type.</p>
602
603 </div>
604 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
605 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
606 <table class="directive">
607 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a variable</td></tr>
608 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Define <var>parameter-name</var> [<var>parameter-value</var>]</code></td></tr>
609 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
610 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
611 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
612 </table>
613     <p>In its one parameter form, <code class="directive">Define</code> is equivalent
614     to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>. It
615     can be used to toggle the use of
616     <code class="directive"><a href="#ifdefine">&lt;IfDefine&gt;</a></code> sections
617     without needing to alter <code>-D</code> arguments in any startup
618     scripts.</p>
619
620     <p>In addition to that, if the second parameter is given, a config variable
621     is set to this value. The variable can be used in the configuration using
622     the <code>${VAR}</code> syntax. The variable is always globally defined
623     and not limited to the scope of the surrounding config section.</p>
624
625     <div class="example"><p><code>
626       &lt;IfDefine TEST&gt;<br />
627       &nbsp;&nbsp;Define servername test.example.com<br />
628       &lt;/IfDefine&gt;<br />
629       &lt;IfDefine !TEST&gt;<br />
630       &nbsp;&nbsp;Define servername www.example.com<br />
631       &nbsp;&nbsp;Define SSL<br />
632       &lt;/IfDefine&gt;<br />
633     </code></p></div>
634
635     <p>Variable names may not contain colon ":" characters, to avoid clashes
636     with <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>'s syntax.</p>
637
638 </div>
639 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
640 <div class="directive-section"><h2><a name="Directory" id="Directory">&lt;Directory&gt;</a> <a name="directory" id="directory">Directive</a></h2>
641 <table class="directive">
642 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
643 named file-system directory, sub-directories, and their contents.</td></tr>
644 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Directory <var>directory-path</var>&gt;
645 ... &lt;/Directory&gt;</code></td></tr>
646 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
647 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
648 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
649 </table>
650     <p><code class="directive">&lt;Directory&gt;</code> and
651     <code>&lt;/Directory&gt;</code> are used to enclose a group of
652     directives that will apply only to the named directory,
653     sub-directories of that directory, and the files within the respective
654     directories.  Any directive that is allowed
655     in a directory context may be used. <var>Directory-path</var> is
656     either the full path to a directory, or a wild-card string using
657     Unix shell-style matching. In a wild-card string, <code>?</code> matches
658     any single character, and <code>*</code> matches any sequences of
659     characters. You may also use <code>[]</code> character ranges. None
660     of the wildcards match a `/' character, so <code>&lt;Directory
661     /*/public_html&gt;</code> will not match
662     <code>/home/user/public_html</code>, but <code>&lt;Directory
663     /home/*/public_html&gt;</code> will match. Example:</p>
664
665     <div class="example"><p><code>
666       &lt;Directory /usr/local/httpd/htdocs&gt;<br />
667       <span class="indent">
668         Options Indexes FollowSymLinks<br />
669       </span>
670       &lt;/Directory&gt;
671     </code></p></div>
672
673     <div class="note">
674       <p>Be careful with the <var>directory-path</var> arguments:
675       They have to literally match the filesystem path which Apache httpd uses
676       to access the files. Directives applied to a particular
677       <code>&lt;Directory&gt;</code> will not apply to files accessed from
678       that same directory via a different path, such as via different symbolic
679       links.</p>
680     </div>
681
682     <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
683     expressions</a> can also be used, with the addition of the
684     <code>~</code> character. For example:</p>
685
686     <div class="example"><p><code>
687       &lt;Directory ~ "^/www/.*/[0-9]{3}"&gt;
688     </code></p></div>
689
690     <p>would match directories in <code>/www/</code> that consisted of
691     three numbers.</p>
692
693     <p>If multiple (non-regular expression) <code class="directive">&lt;Directory&gt;</code> sections
694     match the directory (or one of its parents) containing a document,
695     then the directives are applied in the order of shortest match
696     first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
697     with</p>
698
699     <div class="example"><p><code>
700       &lt;Directory /&gt;<br />
701       <span class="indent">
702         AllowOverride None<br />
703       </span>
704       &lt;/Directory&gt;<br />
705       <br />
706       &lt;Directory /home&gt;<br />
707       <span class="indent">
708         AllowOverride FileInfo<br />
709       </span>
710       &lt;/Directory&gt;
711     </code></p></div>
712
713     <p>for access to the document <code>/home/web/dir/doc.html</code>
714     the steps are:</p>
715
716     <ul>
717       <li>Apply directive <code>AllowOverride None</code>
718       (disabling <code>.htaccess</code> files).</li>
719
720       <li>Apply directive <code>AllowOverride FileInfo</code> (for
721       directory <code>/home</code>).</li>
722
723       <li>Apply any <code>FileInfo</code> directives in
724       <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
725       <code>/home/web/dir/.htaccess</code> in that order.</li>
726     </ul>
727
728     <p>Regular expressions are not considered until after all of the
729     normal sections have been applied. Then all of the regular
730     expressions are tested in the order they appeared in the
731     configuration file. For example, with</p>
732
733     <div class="example"><p><code>
734       &lt;Directory ~ abc$&gt;<br />
735       <span class="indent">
736         # ... directives here ...<br />
737       </span>
738       &lt;/Directory&gt;
739     </code></p></div>
740
741     <p>the regular expression section won't be considered until after
742     all normal <code class="directive">&lt;Directory&gt;</code>s and
743     <code>.htaccess</code> files have been applied. Then the regular
744     expression will match on <code>/home/abc/public_html/abc</code> and
745     the corresponding <code class="directive">&lt;Directory&gt;</code> will
746     be applied.</p>
747
748    <p><strong>Note that the default access for
749     <code>&lt;Directory /&gt;</code> is to permit all access.
750     This means that Apache httpd will serve any file mapped from an URL. It is
751     recommended that you change this with a block such
752     as</strong></p>
753
754     <div class="example"><p><code>
755       &lt;Directory /&gt;<br />
756       <span class="indent">
757         Require all denied<br />
758       </span>
759       &lt;/Directory&gt;
760     </code></p></div>
761
762     <p><strong>and then override this for directories you
763     <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
764     details.</strong></p>
765
766     <p>The directory sections occur in the <code>httpd.conf</code> file.
767     <code class="directive">&lt;Directory&gt;</code> directives
768     cannot nest, and cannot appear in a <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> or <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section.</p>
769
770 <h3>See also</h3>
771 <ul>
772 <li><a href="../sections.html">How &lt;Directory&gt;,
773     &lt;Location&gt; and &lt;Files&gt; sections work</a> for an
774     explanation of how these different sections are combined when a
775     request is received</li>
776 </ul>
777 </div>
778 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
779 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch">&lt;DirectoryMatch&gt;</a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
780 <table class="directive">
781 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
782 the contents of file-system directories matching a regular expression.</td></tr>
783 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;DirectoryMatch <var>regex</var>&gt;
784 ... &lt;/DirectoryMatch&gt;</code></td></tr>
785 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
786 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
787 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
788 </table>
789     <p><code class="directive">&lt;DirectoryMatch&gt;</code> and
790     <code>&lt;/DirectoryMatch&gt;</code> are used to enclose a group
791     of directives which will apply only to the named directory (and the files within),
792     the same as <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>.
793     However, it takes as an argument a
794     <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>.  For example:</p>
795
796     <div class="example"><p><code>
797       &lt;DirectoryMatch "^/www/(.+/)?[0-9]{3}"&gt;
798     </code></p></div>
799
800     <p>would match directories in <code>/www/</code> that consisted of three
801     numbers.</p>
802
803    <div class="note"><h3>Compatability</h3>
804       Prior to 2.3.9, this directive implicitly applied to sub-directories
805       (like <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>) and
806       could not match the end of line symbol ($).  In 2.3.9 and later,
807       only directories that match the expression are affected by the enclosed
808       directives.
809     </div>
810
811     <div class="note"><h3>Trailing Slash</h3>
812       This directive applies to requests for directories that may or may
813       not end in a trailing slash, so expressions that are anchored to the
814       end of line ($) must be written with care.
815     </div>
816
817 <h3>See also</h3>
818 <ul>
819 <li><code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> for
820 a description of how regular expressions are mixed in with normal
821 <code class="directive">&lt;Directory&gt;</code>s</li>
822 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt; and
823 &lt;Files&gt; sections work</a> for an explanation of how these different
824 sections are combined when a request is received</li>
825 </ul>
826 </div>
827 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
828 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
829 <table class="directive">
830 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
831 from the web</td></tr>
832 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
833 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
834 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
835 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
836 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
837 </table>
838     <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
839     will serve files. Unless matched by a directive like <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>, the server appends the
840     path from the requested URL to the document root to make the
841     path to the document. Example:</p>
842
843     <div class="example"><p><code>
844       DocumentRoot /usr/web
845     </code></p></div>
846
847     <p>then an access to
848     <code>http://my.example.com/index.html</code> refers to
849     <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
850     not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
851
852     <p>The <code class="directive">DocumentRoot</code> should be specified without
853     a trailing slash.</p>
854
855 <h3>See also</h3>
856 <ul>
857 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
858 Locations</a></li>
859 </ul>
860 </div>
861 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
862 <div class="directive-section"><h2><a name="Else" id="Else">&lt;Else&gt;</a> <a name="else" id="else">Directive</a></h2>
863 <table class="directive">
864 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if the condition of a
865 previous <code class="directive"><a href="#if">&lt;If&gt;</a></code> or
866 <code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code> section is not
867 satisfied by a request at runtime</td></tr>
868 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Else&gt; ... &lt;/Else&gt;</code></td></tr>
869 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
870 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
871 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
872 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
873 </table>
874     <p>The <code class="directive">&lt;Else&gt;</code> applies the enclosed
875     directives if and only if the most recent
876     <code class="directive">&lt;If&gt;</code> or
877     <code class="directive">&lt;ElseIf&gt;</code> section
878     in the same scope has not been applied.
879     For example: In </p>
880
881     <div class="example"><p><code>
882         &lt;If "-z req('Host')"&gt;<br />
883         ...<br />
884         &lt;/If&gt;<br />
885         &lt;Else&gt;<br />
886         ...<br />
887         &lt;/Else&gt;<br />
888     </code></p></div>
889
890     <p> The <code class="directive">&lt;If&gt;</code> would match HTTP/1.0
891         requests without a <var>Host:</var> header and the
892         <code class="directive">&lt;Else&gt;</code> would match requests
893         with a <var>Host:</var> header.</p>
894
895
896 <h3>See also</h3>
897 <ul>
898 <li><code class="directive"><a href="#if">&lt;If&gt;</a></code></li>
899 <li><code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code></li>
900 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
901     &lt;Files&gt; sections work</a> for an explanation of how these
902     different sections are combined when a request is received.
903     <code class="directive">&lt;If&gt;</code>,
904     <code class="directive">&lt;ElseIf&gt;</code>, and
905     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
906 </ul>
907 </div>
908 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
909 <div class="directive-section"><h2><a name="ElseIf" id="ElseIf">&lt;ElseIf&gt;</a> <a name="elseif" id="elseif">Directive</a></h2>
910 <table class="directive">
911 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is satisfied
912 by a request at runtime while the condition of a previous
913 <code class="directive"><a href="#if">&lt;If&gt;</a></code> or
914 <code class="directive">&lt;ElseIf&gt;</code> section is not
915 satisfied</td></tr>
916 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;ElseIf <var>expression</var>&gt; ... &lt;/ElseIf&gt;</code></td></tr>
917 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
918 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
919 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
920 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
921 </table>
922     <p>The <code class="directive">&lt;ElseIf&gt;</code> applies the enclosed
923     directives if and only if both the given condition evaluates to true and
924     the most recent <code class="directive">&lt;If&gt;</code> or
925     <code class="directive">&lt;ElseIf&gt;</code> section in the same scope has
926     not been applied.  For example: In </p>
927
928     <div class="example"><p><code>
929         &lt;If "-R '10.1.0.0/16'"&gt;<br />
930         ...<br />
931         &lt;/If&gt;<br />
932         &lt;ElseIf "-R '10.0.0.0/8'"&gt;<br />
933         ...<br />
934         &lt;/ElseIf&gt;<br />
935         &lt;Else&gt;<br />
936         ...<br />
937         &lt;/Else&gt;<br />
938     </code></p></div>
939
940     <p>The <code class="directive">&lt;ElseIf&gt;</code> would match if
941     the remote address of a request belongs to the subnet 10.0.0.0/8 but
942     not to the subnet 10.1.0.0/16.</p>
943
944
945 <h3>See also</h3>
946 <ul>
947 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
948 for a complete reference and more examples.</li>
949 <li><code class="directive"><a href="#if">&lt;If&gt;</a></code></li>
950 <li><code class="directive"><a href="#else">&lt;Else&gt;</a></code></li>
951 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
952     &lt;Files&gt; sections work</a> for an explanation of how these
953     different sections are combined when a request is received.
954     <code class="directive">&lt;If&gt;</code>,
955     <code class="directive">&lt;ElseIf&gt;</code>, and
956     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
957 </ul>
958 </div>
959 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
960 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
961 <table class="directive">
962 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
963 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
964 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
965 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
966 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
967 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
968 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
969 </table>
970     <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
971     memory-mapping if it needs to read the contents of a file during
972     delivery.  By default, when the handling of a request requires
973     access to the data within a file -- for example, when delivering a
974     server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache httpd
975     memory-maps the file if the OS supports it.</p>
976
977     <p>This memory-mapping sometimes yields a performance improvement.
978     But in some environments, it is better to disable the memory-mapping
979     to prevent operational problems:</p>
980
981     <ul>
982     <li>On some multiprocessor systems, memory-mapping can reduce the
983     performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
984     <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
985       has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
986       crash with a segmentation fault.
987     </li>
988     </ul>
989
990     <p>For server configurations that are vulnerable to these problems,
991     you should disable memory-mapping of delivered files by specifying:</p>
992
993     <div class="example"><p><code>
994       EnableMMAP Off
995     </code></p></div>
996
997     <p>For NFS mounted files, this feature may be disabled explicitly for
998     the offending files by specifying:</p>
999
1000     <div class="example"><p><code>
1001       &lt;Directory "/path-to-nfs-files"&gt;
1002       <span class="indent">
1003         EnableMMAP Off
1004       </span>
1005       &lt;/Directory&gt;
1006     </code></p></div>
1007
1008 </div>
1009 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1010 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
1011 <table class="directive">
1012 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use the kernel sendfile support to deliver files to the client</td></tr>
1013 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
1014 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile Off</code></td></tr>
1015 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1016 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1017 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1018 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1019 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later. Default changed to Off in
1020 version 2.3.9.</td></tr>
1021 </table>
1022     <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
1023     sendfile support from the kernel to transmit file contents to the client.
1024     By default, when the handling of a request requires no access
1025     to the data within a file -- for example, when delivering a
1026     static file -- Apache httpd uses sendfile to deliver the file contents
1027     without ever reading the file if the OS supports it.</p>
1028
1029     <p>This sendfile mechanism avoids separate read and send operations,
1030     and buffer allocations. But on some platforms or within some
1031     filesystems, it is better to disable this feature to avoid
1032     operational problems:</p>
1033
1034     <ul>
1035     <li>Some platforms may have broken sendfile support that the build
1036     system did not detect, especially if the binaries were built on
1037     another box and moved to such a machine with broken sendfile
1038     support.</li>
1039     <li>On Linux the use of sendfile triggers TCP-checksum
1040     offloading bugs on certain networking cards when using IPv6.</li>
1041     <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1042     files over 2GB in size.</li>
1043     <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS, SMB, CIFS, FUSE),
1044     the kernel may be unable to serve the network file through
1045     its own cache.</li>
1046     </ul>
1047
1048     <p>For server configurations that are not vulnerable to these problems,
1049     you may enable this feature by specifying:</p>
1050
1051     <div class="example"><p><code>
1052       EnableSendfile On
1053     </code></p></div>
1054
1055     <p>For network mounted files, this feature may be disabled explicitly
1056     for the offending files by specifying:</p>
1057
1058     <div class="example"><p><code>
1059       &lt;Directory "/path-to-nfs-files"&gt;
1060       <span class="indent">
1061         EnableSendfile Off
1062       </span>
1063       &lt;/Directory&gt;
1064     </code></p></div>
1065     <p>Please note that the per-directory and .htaccess configuration
1066        of <code class="directive">EnableSendfile</code> is not supported by
1067        <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>.
1068        Only global definition of <code class="directive">EnableSendfile</code>
1069        is taken into account by the module.
1070     </p>
1071
1072 </div>
1073 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1074 <div class="directive-section"><h2><a name="Error" id="Error">Error</a> <a name="error" id="error">Directive</a></h2>
1075 <table class="directive">
1076 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Abort configuration parsing with a custom error message</td></tr>
1077 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Error <var>message</var></code></td></tr>
1078 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1079 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1080 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1081 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.3.9 and later</td></tr>
1082 </table>
1083     <p>If an error can be detected within the configuration, this
1084     directive can be used to generate a custom error message, and halt
1085     configuration parsing.  The typical use is for reporting required
1086     modules which are missing from the configuration.</p>
1087
1088     <div class="example"><h3>Example</h3><p><code>
1089       # ensure that mod_include is loaded<br />
1090       &lt;IfModule !include_module&gt;<br />
1091       Error mod_include is required by mod_foo.  Load it with LoadModule.<br />
1092       &lt;/IfModule&gt;<br />
1093       <br />
1094       # ensure that exactly one of SSL,NOSSL is defined<br />
1095       &lt;IfDefine SSL&gt;<br />
1096       &lt;IfDefine NOSSL&gt;<br />
1097       Error Both SSL and NOSSL are defined.  Define only one of them.<br />
1098       &lt;/IfDefine&gt;<br />
1099       &lt;/IfDefine&gt;<br />
1100       &lt;IfDefine !SSL&gt;<br />
1101       &lt;IfDefine !NOSSL&gt;<br />
1102       Error Either SSL or NOSSL must be defined.<br />
1103       &lt;/IfDefine&gt;<br />
1104       &lt;/IfDefine&gt;<br />
1105     </code></p></div>
1106
1107
1108 </div>
1109 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1110 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
1111 <table class="directive">
1112 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
1113 in case of an error</td></tr>
1114 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
1115 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1116 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1117 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1118 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1119 </table>
1120     <p>In the event of a problem or error, Apache httpd can be configured
1121     to do one of four things,</p>
1122
1123     <ol>
1124       <li>output a simple hardcoded error message</li>
1125
1126       <li>output a customized message</li>
1127
1128       <li>redirect to a local <var>URL-path</var> to handle the
1129       problem/error</li>
1130
1131       <li>redirect to an external <var>URL</var> to handle the
1132       problem/error</li>
1133     </ol>
1134
1135     <p>The first option is the default, while options 2-4 are
1136     configured using the <code class="directive">ErrorDocument</code>
1137     directive, which is followed by the HTTP response code and a URL
1138     or a message. Apache httpd will sometimes offer additional information
1139     regarding the problem/error.</p>
1140
1141     <p>URLs can begin with a slash (/) for local web-paths (relative
1142     to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1143     full URL which the client can resolve. Alternatively, a message
1144     can be provided to be displayed by the browser. Examples:</p>
1145
1146     <div class="example"><p><code>
1147       ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
1148       ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
1149       ErrorDocument 401 /subscription_info.html<br />
1150       ErrorDocument 403 "Sorry can't allow you access today"
1151     </code></p></div>
1152
1153     <p>Additionally, the special value <code>default</code> can be used
1154     to specify Apache httpd's simple hardcoded message.  While not required
1155     under normal circumstances, <code>default</code> will restore
1156     Apache httpd's simple hardcoded message for configurations that would
1157     otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1158
1159     <div class="example"><p><code>
1160       ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
1161       &lt;Directory /web/docs&gt;<br />
1162       <span class="indent">
1163         ErrorDocument 404 default<br />
1164       </span>
1165       &lt;/Directory&gt;
1166     </code></p></div>
1167
1168     <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1169     that points to a remote URL (ie. anything with a method such as
1170     <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1171     client to tell it where to find the document, even if the
1172     document ends up being on the same server. This has several
1173     implications, the most important being that the client will not
1174     receive the original error status code, but instead will
1175     receive a redirect status code. This in turn can confuse web
1176     robots and other clients which try to determine if a URL is
1177     valid using the status code. In addition, if you use a remote
1178     URL in an <code>ErrorDocument 401</code>, the client will not
1179     know to prompt the user for a password since it will not
1180     receive the 401 status code. Therefore, <strong>if you use an
1181     <code>ErrorDocument 401</code> directive then it must refer to a local
1182     document.</strong></p>
1183
1184     <p>Microsoft Internet Explorer (MSIE) will by default ignore
1185     server-generated error messages when they are "too small" and substitute
1186     its own "friendly" error messages. The size threshold varies depending on
1187     the type of error, but in general, if you make your error document
1188     greater than 512 bytes, then MSIE will show the server-generated
1189     error rather than masking it.  More information is available in
1190     Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1191
1192     <p>Although most error messages can be overriden, there are certain
1193     circumstances where the internal messages are used regardless of the
1194     setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>.  In
1195     particular, if a malformed request is detected, normal request processing
1196     will be immediately halted and the internal error message returned.
1197     This is necessary to guard against security problems caused by
1198     bad requests.</p>
1199
1200     <p>If you are using mod_proxy, you may wish to enable
1201     <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1202     custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1203     Apache httpd will not generate custom error documents for proxied content.</p>
1204
1205 <h3>See also</h3>
1206 <ul>
1207 <li><a href="../custom-error.html">documentation of
1208     customizable responses</a></li>
1209 </ul>
1210 </div>
1211 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1212 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1213 <table class="directive">
1214 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1215 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</code></td></tr>
1216 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</code></td></tr>
1217 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1218 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1219 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1220 </table>
1221     <p>The <code class="directive">ErrorLog</code> directive sets the name of
1222     the file to which the server will log any errors it encounters. If
1223     the <var>file-path</var> is not absolute then it is assumed to be
1224     relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1225
1226     <div class="example"><h3>Example</h3><p><code>
1227     ErrorLog /var/log/httpd/error_log
1228     </code></p></div>
1229
1230     <p>If the <var>file-path</var>
1231     begins with a pipe character "<code>|</code>" then it is assumed to be a
1232     command to spawn to handle the error log.</p>
1233
1234     <div class="example"><h3>Example</h3><p><code>
1235     ErrorLog "|/usr/local/bin/httpd_errors"
1236     </code></p></div>
1237
1238     <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1239     more information.</p>
1240
1241     <p>Using <code>syslog</code> instead of a filename enables logging
1242     via syslogd(8) if the system supports it. The default is to use
1243     syslog facility <code>local7</code>, but you can override this by
1244     using the <code>syslog:<var>facility</var></code> syntax where
1245     <var>facility</var> can be one of the names usually documented in
1246     syslog(1).  The facility is effectively global, and if it is changed
1247     in individual virtual hosts, the final facility specified affects the
1248     entire server.</p>
1249
1250     <div class="example"><h3>Example</h3><p><code>
1251     ErrorLog syslog:user
1252     </code></p></div>
1253
1254     <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1255     document for details on why your security could be compromised
1256     if the directory where log files are stored is writable by
1257     anyone other than the user that starts the server.</p>
1258     <div class="warning"><h3>Note</h3>
1259       <p>When entering a file path on non-Unix platforms, care should be taken
1260       to make sure that only forward slashes are used even though the platform
1261       may allow the use of back slashes. In general it is a good idea to always
1262       use forward slashes throughout the configuration files.</p>
1263     </div>
1264
1265 <h3>See also</h3>
1266 <ul>
1267 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1268 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1269 </ul>
1270 </div>
1271 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1272 <div class="directive-section"><h2><a name="ErrorLogFormat" id="ErrorLogFormat">ErrorLogFormat</a> <a name="errorlogformat" id="errorlogformat">Directive</a></h2>
1273 <table class="directive">
1274 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Format specification for error log entries</td></tr>
1275 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLog [connection|request] <var>format</var></code></td></tr>
1276 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1277 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1278 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1279 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.3.9 and later</td></tr>
1280 </table>
1281     <p><code class="directive">ErrorLogFormat</code> allows to specify what
1282     supplementary information is logged in the error log in addition to the
1283     actual log message.</p>
1284
1285     <div class="example"><h3>Simple example</h3><p><code>
1286         ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1287     </code></p></div>
1288
1289     <p>Specifying <code>connection</code> or <code>request</code> as first
1290     parameter allows to specify additional formats, causing additional
1291     information to be logged when the first message is logged for a specific
1292     connection or request, respectivly. This additional information is only
1293     logged once per connection/request. If a connection or request is processed
1294     without causing any log message, the additional information is not logged
1295     either.</p>
1296
1297     <p>It can happen that some format string items do not produce output.  For
1298     example, the Referer header is only present if the log message is
1299     associated to a request and the log message happens at a time when the
1300     Referer header has already been read from the client.  If no output is
1301     produced, the default behaviour is to delete everything from the preceeding
1302     space character to the next space character.  This means the log line is
1303     implicitly divided into fields on non-whitespace to whitespace transitions.
1304     If a format string item does not produce output, the whole field is
1305     ommitted.  For example, if the remote address <code>%a</code> in the log
1306     format <code>[%t] [%l] [%a] %M&nbsp;</code> is not available, the surrounding
1307     brackets are not logged either.  Space characters can be escaped with a
1308     backslash to prevent them from delimiting a field.  The combination '%&nbsp;'
1309     (percent space) is a zero-witdh field delimiter that does not produce any
1310     output.</p>
1311
1312     <p>The above behaviour can be changed by adding modifiers to the format
1313     string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1314     respective item does not produce any output. In once-per-connection/request
1315     formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1316     item with the plus modifier does not produce any output, the whole line is
1317     ommitted.</p>
1318
1319     <p>A number as modifier can be used to assign a log severity level to a
1320     format item. The item will only be logged if the severity of the log
1321     message is not higher than the specified log severity level. The number can
1322     range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1323
1324     <p>Some format string items accept additional parameters in braces.</p>
1325
1326     <table class="bordered"><tr class="header"><th>Format&nbsp;String</th> <th>Description</th></tr>
1327 <tr><td><code>%%</code></td>
1328         <td>The percent sign</td></tr>
1329 <tr class="odd"><td><code>%...a</code></td>
1330         <td>Remote IP-address and port</td></tr>
1331 <tr><td><code>%...A</code></td>
1332         <td>Local IP-address and port</td></tr>
1333 <tr class="odd"><td><code>%...{name}e</code></td>
1334         <td>Request environment variable <code>name</code></td></tr>
1335 <tr><td><code>%...E</code></td>
1336         <td>APR/OS error status code and string</td></tr>
1337 <tr class="odd"><td><code>%...F</code></td>
1338         <td>Source file name and line number of the log call</td></tr>
1339 <tr><td><code>%...{name}i</code></td>
1340         <td>Request header <code>name</code></td></tr>
1341 <tr class="odd"><td><code>%...k</code></td>
1342         <td>Number of keep-alive requests on this connection</td></tr>
1343 <tr><td><code>%...l</code></td>
1344         <td>Loglevel of the message</td></tr>
1345 <tr class="odd"><td><code>%...L</code></td>
1346         <td>Log ID of the request</td></tr>
1347 <tr><td><code>%...{c}L</code></td>
1348         <td>Log ID of the connection</td></tr>
1349 <tr class="odd"><td><code>%...{C}L</code></td>
1350         <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1351 <tr><td><code>%...m</code></td>
1352         <td>Name of the module logging the message</td></tr>
1353 <tr class="odd"><td><code>%M</code></td>
1354         <td>The actual log message</td></tr>
1355 <tr><td><code>%...{name}n</code></td>
1356         <td>Request note <code>name</code></td></tr>
1357 <tr class="odd"><td><code>%...P</code></td>
1358         <td>Process ID of current process</td></tr>
1359 <tr><td><code>%...T</code></td>
1360         <td>Thread ID of current thread</td></tr>
1361 <tr class="odd"><td><code>%...t</code></td>
1362         <td>The current time</td></tr>
1363 <tr><td><code>%...{u}t</code></td>
1364         <td>The current time including micro-seconds</td></tr>
1365 <tr class="odd"><td><code>%...{cu}t</code></td>
1366         <td>The current time in compact ISO 8601 format, including
1367             micro-seconds</td></tr>
1368 <tr><td><code>%...v</code></td>
1369         <td>The canonical <code class="directive"><a href="#servername">ServerName</a></code>
1370             of the current server.</td></tr>
1371 <tr class="odd"><td><code>%...V</code></td>
1372         <td>The server name of the server serving the request according to the
1373             <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
1374             setting.</td></tr>
1375 <tr><td><code>\&nbsp;</code> (backslash space)</td>
1376         <td>Non-field delimiting space</td></tr>
1377 <tr class="odd"><td><code>%&nbsp;</code> (percent space)</td>
1378         <td>Field delimiter (no output)</td></tr>
1379 </table>
1380
1381     <p>The log ID format <code>%L</code> produces a unique id for a connection
1382     or request. This can be used to correlate which log lines belong to the
1383     same connection or request, which request happens on which connection.
1384     A <code>%L</code> format string is also available in
1385     <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>, to allow to correlate access log entries
1386     with error log lines. If <code class="module"><a href="../mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its
1387     unique id will be used as log ID for requests.</p>
1388
1389     <div class="example"><h3>Example (somewhat similar to default format)</h3><p><code>
1390         ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a]
1391         %M%&nbsp;,\&nbsp;referer\&nbsp;%{Referer}i"
1392     </code></p></div>
1393
1394     <div class="example"><h3>Example (similar to the 2.2.x format)</h3><p><code>
1395         ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a]
1396         %M%&nbsp;,\&nbsp;referer\&nbsp;%{Referer}i"
1397     </code></p></div>
1398
1399     <div class="example"><h3>Advanced example with request/connection log IDs</h3><p><code>
1400         ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"<br />
1401         ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"<br />
1402         ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"<br />
1403         ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"<br />
1404         ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"<br />
1405     </code></p></div>
1406
1407
1408 <h3>See also</h3>
1409 <ul>
1410 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
1411 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1412 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1413 </ul>
1414 </div>
1415 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1416 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1417 <table class="directive">
1418 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1419 request</td></tr>
1420 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1421 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1422 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1423 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1424 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1425 </table>
1426     <p>This option tracks additional data per worker about the
1427     currently executing request, and a utilization summary; you
1428     can see these variables during runtime by configuring
1429     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.  Note that other modules may
1430     rely on this scoreboard.</p>
1431
1432     <p>This setting applies to the entire server, and cannot be
1433     enabled or disabled on a virtualhost-by-virtualhost basis.
1434     The collection of extended status information can slow down
1435     the server.  Also note that this setting cannot be changed
1436     during a graceful restart.</p>
1437
1438     <div class="note">
1439     <p>Note that loading <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> will change
1440     the default behavior to ExtendedStatus On, while other
1441     third party modules may do the same.  Such modules rely on
1442     collecting detailed information about the state of all workers.
1443     The default is changed by <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> beginning
1444     with version 2.3.6; the previous default was always Off.</p>
1445     </div>
1446
1447
1448 </div>
1449 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1450 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1451 <table class="directive">
1452 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1453 HTTP response header for static files</td></tr>
1454 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1455 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag INode MTime Size</code></td></tr>
1456 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1457 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1458 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1459 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1460 </table>
1461     <p>
1462     The <code class="directive">FileETag</code> directive configures the file
1463     attributes that are used to create the <code>ETag</code> (entity
1464     tag) response header field when the document is based on a static file.
1465     (The <code>ETag</code> value is used in cache management to save
1466     network bandwidth.) The
1467     <code class="directive">FileETag</code> directive allows you to choose
1468     which of these -- if any -- should be used. The recognized keywords are:
1469     </p>
1470
1471     <dl>
1472      <dt><strong>INode</strong></dt>
1473      <dd>The file's i-node number will be included in the calculation</dd>
1474      <dt><strong>MTime</strong></dt>
1475      <dd>The date and time the file was last modified will be included</dd>
1476      <dt><strong>Size</strong></dt>
1477      <dd>The number of bytes in the file will be included</dd>
1478      <dt><strong>All</strong></dt>
1479      <dd>All available fields will be used. This is equivalent to:
1480          <div class="example"><p><code>FileETag INode MTime Size</code></p></div></dd>
1481      <dt><strong>None</strong></dt>
1482      <dd>If a document is file-based, no <code>ETag</code> field will be
1483        included in the response</dd>
1484     </dl>
1485
1486     <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1487     keywords may be prefixed with either <code>+</code> or <code>-</code>,
1488     which allow changes to be made to the default setting inherited
1489     from a broader scope. Any keyword appearing without such a prefix
1490     immediately and completely cancels the inherited setting.</p>
1491
1492     <p>If a directory's configuration includes
1493     <code>FileETag&nbsp;INode&nbsp;MTime&nbsp;Size</code>, and a
1494     subdirectory's includes <code>FileETag&nbsp;-INode</code>,
1495     the setting for that subdirectory (which will be inherited by
1496     any sub-subdirectories that don't override it) will be equivalent to
1497     <code>FileETag&nbsp;MTime&nbsp;Size</code>.</p>
1498     <div class="warning"><h3>Warning</h3>
1499     Do not change the default for directories or locations that have WebDAV
1500     enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1501     <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>INode&nbsp;MTime&nbsp;Size</code>
1502     as a fixed format for <code>ETag</code> comparisons on conditional requests.
1503     These conditional requests will break if the <code>ETag</code> format is
1504     changed via <code class="directive">FileETag</code>.
1505     </div>
1506     <div class="note"><h3>Server Side Includes</h3>
1507     An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>,
1508     since the response entity can change without a change of the INode, MTime, or Size
1509     of the static file with embedded SSI directives.
1510     </div>
1511
1512
1513 </div>
1514 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1515 <div class="directive-section"><h2><a name="Files" id="Files">&lt;Files&gt;</a> <a name="files" id="files">Directive</a></h2>
1516 <table class="directive">
1517 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1518 filenames</td></tr>
1519 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Files <var>filename</var>&gt; ... &lt;/Files&gt;</code></td></tr>
1520 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1521 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1522 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1523 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1524 </table>
1525     <p>The <code class="directive">&lt;Files&gt;</code> directive
1526     limits the scope of the enclosed directives by filename. It is comparable
1527     to the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
1528     and <code class="directive"><a href="#location">&lt;Location&gt;</a></code>
1529     directives. It should be matched with a <code>&lt;/Files&gt;</code>
1530     directive. The directives given within this section will be applied to
1531     any object with a basename (last component of filename) matching the
1532     specified filename. <code class="directive">&lt;Files&gt;</code>
1533     sections are processed in the order they appear in the
1534     configuration file, after the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections and
1535     <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location">&lt;Location&gt;</a></code> sections. Note
1536     that <code class="directive">&lt;Files&gt;</code> can be nested
1537     inside <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections to restrict the
1538     portion of the filesystem they apply to.</p>
1539
1540     <p>The <var>filename</var> argument should include a filename, or
1541     a wild-card string, where <code>?</code> matches any single character,
1542     and <code>*</code> matches any sequences of characters.
1543     <a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1544     can also be used, with the addition of the
1545     <code>~</code> character. For example:</p>
1546
1547     <div class="example"><p><code>
1548       &lt;Files ~ "\.(gif|jpe?g|png)$"&gt;
1549     </code></p></div>
1550
1551     <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch">&lt;FilesMatch&gt;</a></code> is preferred,
1552     however.</p>
1553
1554     <p>Note that unlike <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> and <code class="directive"><a href="#location">&lt;Location&gt;</a></code> sections, <code class="directive">&lt;Files&gt;</code> sections can be used inside
1555     <code>.htaccess</code> files. This allows users to control access to
1556     their own files, at a file-by-file level.</p>
1557
1558
1559 <h3>See also</h3>
1560 <ul>
1561 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
1562     and &lt;Files&gt; sections work</a> for an explanation of how these
1563     different sections are combined when a request is received</li>
1564 </ul>
1565 </div>
1566 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1567 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch">&lt;FilesMatch&gt;</a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1568 <table class="directive">
1569 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1570 filenames</td></tr>
1571 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;FilesMatch <var>regex</var>&gt; ... &lt;/FilesMatch&gt;</code></td></tr>
1572 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1573 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1574 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1575 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1576 </table>
1577     <p>The <code class="directive">&lt;FilesMatch&gt;</code> directive
1578     limits the scope of the enclosed directives by filename, just as the
1579     <code class="directive"><a href="#files">&lt;Files&gt;</a></code> directive
1580     does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1581     expression</a>. For example:</p>
1582
1583     <div class="example"><p><code>
1584       &lt;FilesMatch "\.(gif|jpe?g|png)$"&gt;
1585     </code></p></div>
1586
1587     <p>would match most common Internet graphics formats.</p>
1588
1589 <h3>See also</h3>
1590 <ul>
1591 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
1592     and &lt;Files&gt; sections work</a> for an explanation of how these
1593     different sections are combined when a request is received</li>
1594 </ul>
1595 </div>
1596 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1597 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1598 <table class="directive">
1599 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1600 media type in the HTTP Content-Type header field</td></tr>
1601 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1602 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1603 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1604 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1605 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1606 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache httpd 2.0</td></tr>
1607 </table>
1608     <p>When placed into an <code>.htaccess</code> file or a
1609     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>, or
1610     <code class="directive"><a href="#location">&lt;Location&gt;</a></code> or
1611     <code class="directive"><a href="#files">&lt;Files&gt;</a></code>
1612     section, this directive forces all matching files to be served
1613     with the content type identification given by
1614     <var>media-type</var>. For example, if you had a directory full of
1615     GIF files, but did not want to label them all with <code>.gif</code>,
1616     you might want to use:</p>
1617
1618     <div class="example"><p><code>
1619       ForceType image/gif
1620     </code></p></div>
1621
1622     <p>Note that this directive overrides other indirect media type
1623     associations defined in mime.types or via the
1624     <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1625
1626     <p>You can also override more general
1627     <code class="directive">ForceType</code> settings
1628     by using the value of <code>None</code>:</p>
1629
1630     <div class="example"><p><code>
1631       # force all files to be image/gif:<br />
1632       &lt;Location /images&gt;<br />
1633         <span class="indent">
1634           ForceType image/gif<br />
1635         </span>
1636       &lt;/Location&gt;<br />
1637       <br />
1638       # but normal mime-type associations here:<br />
1639       &lt;Location /images/mixed&gt;<br />
1640       <span class="indent">
1641         ForceType None<br />
1642       </span>
1643       &lt;/Location&gt;
1644     </code></p></div>
1645
1646     <p>This directive primarily overrides the content types generated for
1647     static files served out of the filesystem.  For resources other than
1648     static files, where the generator of the response typically specifies
1649     a Content-Type, this directive has no effect.</p>
1650
1651
1652 </div>
1653 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1654 <div class="directive-section"><h2><a name="GprofDir" id="GprofDir">GprofDir</a> <a name="gprofdir" id="gprofdir">Directive</a></h2>
1655 <table class="directive">
1656 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory to write gmon.out profiling data to.  </td></tr>
1657 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</code></td></tr>
1658 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1659 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1660 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1661 </table>
1662     <p>When the server has been compiled with gprof profiling suppport,
1663     <code class="directive">GprofDir</code> causes <code>gmon.out</code> files to
1664     be written to the specified directory when the process exits.  If the
1665     argument ends with a percent symbol ('%'), subdirectories are created
1666     for each process id.</p>
1667
1668     <p>This directive currently only works with the <code class="module"><a href="../mod/prefork.html">prefork</a></code>
1669     MPM.</p>
1670
1671 </div>
1672 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1673 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1674 <table class="directive">
1675 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1676 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1677 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1678 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1679 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1680 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1681 </table>
1682     <p>This directive enables DNS lookups so that host names can be
1683     logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1684     The value <code>Double</code> refers to doing double-reverse
1685     DNS lookup. That is, after a reverse lookup is performed, a forward
1686     lookup is then performed on that result. At least one of the IP
1687     addresses in the forward lookup must match the original
1688     address. (In "tcpwrappers" terminology this is called
1689     <code>PARANOID</code>.)</p>
1690
1691     <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1692     used for controlling access by hostname, a double reverse lookup
1693     will be performed.  This is necessary for security. Note that the
1694     result of this double-reverse isn't generally available unless you
1695     set <code>HostnameLookups Double</code>. For example, if only
1696     <code>HostnameLookups On</code> and a request is made to an object
1697     that is protected by hostname restrictions, regardless of whether
1698     the double-reverse fails or not, CGIs will still be passed the
1699     single-reverse result in <code>REMOTE_HOST</code>.</p>
1700
1701     <p>The default is <code>Off</code> in order to save the network
1702     traffic for those sites that don't truly need the reverse
1703     lookups done. It is also better for the end users because they
1704     don't have to suffer the extra latency that a lookup entails.
1705     Heavily loaded sites should leave this directive
1706     <code>Off</code>, since DNS lookups can take considerable
1707     amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1708     default to the <code>bin</code> subdirectory of your installation
1709     directory, can be used to look up host names from logged IP addresses
1710     offline.</p>
1711
1712 </div>
1713 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1714 <div class="directive-section"><h2><a name="If" id="If">&lt;If&gt;</a> <a name="if" id="if">Directive</a></h2>
1715 <table class="directive">
1716 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1717 satisfied by a request at runtime</td></tr>
1718 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;If <var>expression</var>&gt; ... &lt;/If&gt;</code></td></tr>
1719 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1720 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1721 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1722 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1723 </table>
1724     <p>The <code class="directive">&lt;If&gt;</code> directive
1725     evaluates an expression at runtime, and applies the enclosed
1726     directives if and only if the expression evaluates to true.
1727     For example:</p>
1728
1729     <div class="example"><p><code>
1730         &lt;If "-z req('Host')"&gt;
1731     </code></p></div>
1732
1733     <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1734     Expressions may contain various shell-like operators for string
1735     comparison (<code>=</code>, <code>!=</code>, <code>&lt;</code>, ...),
1736     integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1737     and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1738     It is also possible to use regular expressions, </p>
1739
1740     <div class="example"><p><code>
1741         &lt;If "%{QUERY_STRING =~ /(delete|commit)=.*?elem/"&gt;
1742     </code></p></div>
1743
1744     <p>shell-like pattern matches and many other operations. These operations
1745     can be done on request headers (<code>req</code>), environment variables
1746     (<code>env</code>), and a large number of other properties. The full
1747     documentation is available in <a href="../expr.html">Expressions in
1748     Apache HTTP Server</a>.</p>
1749
1750
1751 <h3>See also</h3>
1752 <ul>
1753 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1754 for a complete reference and more examples.</li>
1755 <li><code class="directive"><a href="#elseif">&lt;ElseIf&gt;</a></code></li>
1756 <li><code class="directive"><a href="#else">&lt;Else&gt;</a></code></li>
1757 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;,
1758     &lt;Files&gt; sections work</a> for an explanation of how these
1759     different sections are combined when a request is received.
1760     <code class="directive">&lt;If&gt;</code>,
1761     <code class="directive">&lt;ElseIf&gt;</code>, and
1762     <code class="directive">&lt;Else&gt;</code> are applied last.</li>
1763 </ul>
1764 </div>
1765 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1766 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine">&lt;IfDefine&gt;</a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1767 <table class="directive">
1768 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1769 if a test is true at startup</td></tr>
1770 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;IfDefine [!]<var>parameter-name</var>&gt; ...
1771     &lt;/IfDefine&gt;</code></td></tr>
1772 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1773 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1774 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1775 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1776 </table>
1777     <p>The <code>&lt;IfDefine <var>test</var>&gt;...&lt;/IfDefine&gt;
1778     </code> section is used to mark directives that are conditional. The
1779     directives within an <code class="directive">&lt;IfDefine&gt;</code>
1780     section are only processed if the <var>test</var> is true. If <var>
1781     test</var> is false, everything between the start and end markers is
1782     ignored.</p>
1783
1784     <p>The <var>test</var> in the <code class="directive">&lt;IfDefine&gt;</code> section directive can be one of two forms:</p>
1785
1786     <ul>
1787       <li><var>parameter-name</var></li>
1788
1789       <li><code>!</code><var>parameter-name</var></li>
1790     </ul>
1791
1792     <p>In the former case, the directives between the start and end
1793     markers are only processed if the parameter named
1794     <var>parameter-name</var> is defined. The second format reverses
1795     the test, and only processes the directives if
1796     <var>parameter-name</var> is <strong>not</strong> defined.</p>
1797
1798     <p>The <var>parameter-name</var> argument is a define as given on the
1799     <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
1800     </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
1801
1802     <p><code class="directive">&lt;IfDefine&gt;</code> sections are
1803     nest-able, which can be used to implement simple
1804     multiple-parameter tests. Example:</p>
1805
1806     <div class="example"><p><code>
1807       httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1808       <br />
1809       # httpd.conf<br />
1810       &lt;IfDefine ReverseProxy&gt;<br />
1811       <span class="indent">
1812         LoadModule proxy_module   modules/mod_proxy.so<br />
1813         LoadModule proxy_http_module   modules/mod_proxy_http.so<br />
1814         &lt;IfDefine UseCache&gt;<br />
1815         <span class="indent">
1816           LoadModule cache_module   modules/mod_cache.so<br />
1817           &lt;IfDefine MemCache&gt;<br />
1818           <span class="indent">
1819             LoadModule mem_cache_module   modules/mod_mem_cache.so<br />
1820           </span>
1821           &lt;/IfDefine&gt;<br />
1822           &lt;IfDefine !MemCache&gt;<br />
1823           <span class="indent">
1824             LoadModule cache_disk_module   modules/mod_cache_disk.so<br />
1825           </span>
1826           &lt;/IfDefine&gt;
1827         </span>
1828         &lt;/IfDefine&gt;
1829       </span>
1830       &lt;/IfDefine&gt;
1831     </code></p></div>
1832
1833 </div>
1834 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1835 <div class="directive-section"><h2><a name="IfModule" id="IfModule">&lt;IfModule&gt;</a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
1836 <table class="directive">
1837 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
1838 presence or absence of a specific module</td></tr>
1839 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;IfModule [!]<var>module-file</var>|<var>module-identifier</var>&gt; ...
1840     &lt;/IfModule&gt;</code></td></tr>
1841 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1842 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1843 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1844 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1845 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Module identifiers are available in version 2.1 and
1846 later.</td></tr>
1847 </table>
1848     <p>The <code>&lt;IfModule <var>test</var>&gt;...&lt;/IfModule&gt;</code>
1849     section is used to mark directives that are conditional on the presence of
1850     a specific module. The directives within an <code class="directive">&lt;IfModule&gt;</code> section are only processed if the <var>test</var>
1851     is true. If <var>test</var> is false, everything between the start and
1852     end markers is ignored.</p>
1853
1854     <p>The <var>test</var> in the <code class="directive">&lt;IfModule&gt;</code> section directive can be one of two forms:</p>
1855
1856     <ul>
1857       <li><var>module</var></li>
1858
1859       <li>!<var>module</var></li>
1860     </ul>
1861
1862     <p>In the former case, the directives between the start and end
1863     markers are only processed if the module named <var>module</var>
1864     is included in Apache httpd -- either compiled in or
1865     dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
1866     and only processes the directives if <var>module</var> is
1867     <strong>not</strong> included.</p>
1868
1869     <p>The <var>module</var> argument can be either the module identifier or
1870     the file name of the module, at the time it was compiled.  For example,
1871     <code>rewrite_module</code> is the identifier and
1872     <code>mod_rewrite.c</code> is the file name. If a module consists of
1873     several source files, use the name of the file containing the string
1874     <code>STANDARD20_MODULE_STUFF</code>.</p>
1875
1876     <p><code class="directive">&lt;IfModule&gt;</code> sections are
1877     nest-able, which can be used to implement simple multiple-module
1878     tests.</p>
1879
1880     <div class="note">This section should only be used if you need to have one
1881     configuration file that works whether or not a specific module
1882     is available. In normal operation, directives need not be
1883     placed in <code class="directive">&lt;IfModule&gt;</code>
1884     sections.</div>
1885
1886 </div>
1887 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1888 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
1889 <table class="directive">
1890 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
1891 the server configuration files</td></tr>
1892 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Include [<var>optional</var>|<var>strict</var>] <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></code></td></tr>
1893 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1894 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1895 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1896 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later, directory
1897 wildcard matching available in 2.3.6 and later</td></tr>
1898 </table>
1899     <p>This directive allows inclusion of other configuration files
1900     from within the server configuration files.</p>
1901
1902     <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
1903     in the filename or directory parts of the path to include several files
1904     at once, in alphabetical order. In addition, if
1905     <code class="directive">Include</code> points to a directory, rather than a file,
1906     Apache httpd will read all files in that directory and any subdirectory.
1907     However, including entire directories is not recommended, because it is
1908     easy to accidentally leave temporary files in a directory that can cause
1909     <code class="program"><a href="../programs/httpd.html">httpd</a></code> to fail. Instead, we encourage you to use the
1910     wildcard syntax shown below, to include files that match a particular
1911     pattern, such as *.conf, for example.</p>
1912
1913     <p>When a wildcard is specified for a <strong>file</strong> component of
1914     the path, and no file matches the wildcard, the
1915     <code class="directive"><a href="#include">Include</a></code>
1916     directive will be <strong>silently ignored</strong>. When a wildcard is
1917     specified for a <strong>directory</strong> component of the path, and
1918     no directory matches the wildcard, the
1919     <code class="directive"><a href="#include">Include</a></code> directive will
1920     <strong>fail with an error</strong> saying the directory cannot be found.
1921     </p>
1922
1923     <p>For further control over the behaviour of the server when no files or
1924     directories match, prefix the path with the modifiers <var>optional</var>
1925     or <var>strict</var>. If <var>optional</var> is specified, any wildcard
1926     file or directory that does not match will be silently ignored. If
1927     <var>strict</var> is specified, any wildcard file or directory that does
1928     not match at least one file will cause server startup to fail.</p>
1929
1930     <p>When a directory or file component of the path is
1931     specified exactly, and that directory or file does not exist,
1932     <code class="directive"><a href="#include">Include</a></code> directive will fail with an
1933     error saying the file or directory cannot be found.</p>
1934
1935     <p>The file path specified may be an absolute path, or may be relative
1936     to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
1937
1938     <p>Examples:</p>
1939
1940     <div class="example"><p><code>
1941       Include /usr/local/apache2/conf/ssl.conf<br />
1942       Include /usr/local/apache2/conf/vhosts/*.conf
1943     </code></p></div>
1944
1945     <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
1946
1947     <div class="example"><p><code>
1948       Include conf/ssl.conf<br />
1949       Include conf/vhosts/*.conf
1950     </code></p></div>
1951
1952     <p>Wildcards may be included in the directory or file portion of the
1953     path. In the following example, the server will fail to load if no
1954     directories match conf/vhosts/*, but will load successfully if no
1955     files match *.conf.</p>
1956
1957     <div class="example"><p><code>
1958       Include conf/vhosts/*/vhost.conf<br />
1959       Include conf/vhosts/*/*.conf
1960     </code></p></div>
1961
1962     <p>In this example, the server will fail to load if either
1963     conf/vhosts/* matches no directories, or if *.conf matches no files:</p>
1964
1965     <div class="example"><p><code>
1966       Include strict conf/vhosts/*/*.conf
1967     </code></p></div>
1968
1969     <p>In this example, the server load successfully if either conf/vhosts/*
1970     matches no directories, or if *.conf matches no files:</p>
1971
1972     <div class="example"><p><code>
1973       Include optional conf/vhosts/*/*.conf
1974     </code></p></div>
1975
1976
1977 <h3>See also</h3>
1978 <ul>
1979 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
1980 </ul>
1981 </div>
1982 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1983 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
1984 <table class="directive">
1985 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
1986 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
1987 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
1988 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1989 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1990 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1991 </table>
1992     <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1993     connection feature of HTTP/1.1 provide long-lived HTTP sessions
1994     which allow multiple requests to be sent over the same TCP
1995     connection. In some cases this has been shown to result in an
1996     almost 50% speedup in latency times for HTML documents with
1997     many images. To enable Keep-Alive connections, set
1998     <code>KeepAlive On</code>.</p>
1999
2000     <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2001     used if they are specifically requested by a client. In
2002     addition, a Keep-Alive connection with an HTTP/1.0 client can
2003     only be used when the length of the content is known in
2004     advance. This implies that dynamic content such as CGI output,
2005     SSI pages, and server-generated directory listings will
2006     generally not use Keep-Alive connections to HTTP/1.0 clients.
2007     For HTTP/1.1 clients, persistent connections are the default
2008     unless otherwise specified. If the client requests it, chunked
2009     encoding will be used in order to send content of unknown
2010     length over persistent connections.</p>
2011
2012     <p>When a client uses a Keep-Alive connection it will be counted
2013     as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> directive, regardless
2014     of how many requests are sent using the connection.</p>
2015
2016 <h3>See also</h3>
2017 <ul>
2018 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
2019 </ul>
2020 </div>
2021 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2022 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
2023 <table class="directive">
2024 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
2025 requests on a persistent connection</td></tr>
2026 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
2027 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
2028 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2029 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2030 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2031 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Specifying a value in milliseconds is available in
2032 Apache httpd 2.3.2 and later</td></tr>
2033 </table>
2034     <p>The number of seconds Apache httpd will wait for a subsequent
2035     request before closing the connection. By adding a postfix of ms the
2036     timeout can be also set in milliseconds. Once a request has been
2037     received, the timeout value specified by the
2038     <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
2039
2040     <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
2041     may cause performance problems in heavily loaded servers. The
2042     higher the timeout, the more server processes will be kept
2043     occupied waiting on connections with idle clients.</p>
2044
2045     <p>In a name-based virtual host context, the value of the first
2046     defined virtual host best matching the local IP and port will be used.</p>
2047
2048 </div>
2049 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2050 <div class="directive-section"><h2><a name="Limit" id="Limit">&lt;Limit&gt;</a> <a name="limit" id="limit">Directive</a></h2>
2051 <table class="directive">
2052 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
2053 methods</td></tr>
2054 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Limit <var>method</var> [<var>method</var>] ... &gt; ...
2055     &lt;/Limit&gt;</code></td></tr>
2056 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2057 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2058 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2059 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2060 </table>
2061     <p>Access controls are normally effective for
2062     <strong>all</strong> access methods, and this is the usual
2063     desired behavior. <strong>In the general case, access control
2064     directives should not be placed within a
2065     <code class="directive">&lt;Limit&gt;</code> section.</strong></p>
2066
2067     <p>The purpose of the <code class="directive">&lt;Limit&gt;</code>
2068     directive is to restrict the effect of the access controls to the
2069     nominated HTTP methods. For all other methods, the access
2070     restrictions that are enclosed in the <code class="directive">&lt;Limit&gt;</code> bracket <strong>will have no
2071     effect</strong>. The following example applies the access control
2072     only to the methods <code>POST</code>, <code>PUT</code>, and
2073     <code>DELETE</code>, leaving all other methods unprotected:</p>
2074
2075     <div class="example"><p><code>
2076       &lt;Limit POST PUT DELETE&gt;<br />
2077       <span class="indent">
2078         Require valid-user<br />
2079       </span>
2080       &lt;/Limit&gt;
2081     </code></p></div>
2082
2083     <p>The method names listed can be one or more of: <code>GET</code>,
2084     <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2085     <code>CONNECT</code>, <code>OPTIONS</code>,
2086     <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2087     <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2088     <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2089     case-sensitive.</strong> If <code>GET</code> is used it will also
2090     restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2091     cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
2092
2093     <div class="warning">A <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section should always be
2094     used in preference to a <code class="directive">&lt;Limit&gt;</code>
2095     section when restricting access, since a <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> section provides protection
2096     against arbitrary methods.</div>
2097
2098     <p>The <code class="directive">&lt;Limit&gt;</code> and
2099     <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code>
2100     directives may be nested.  In this case, each successive level of
2101     <code class="directive">&lt;Limit&gt;</code> or <code class="directive"><a href="#limitexcept">&lt;LimitExcept&gt;</a></code> directives must
2102     further restrict the set of methods to which access controls apply.</p>
2103
2104     <div class="warning">When using
2105     <code class="directive">&lt;Limit&gt;</code> or
2106     <code class="directive">&lt;LimitExcept&gt;</code> directives with
2107     the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
2108     note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
2109     to succeed authorizes the request, regardless of the presence of other
2110     <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
2111
2112     <p>For example, given the following configuration, all users will
2113     be authorized for <code>POST</code> requests, and the
2114     <code>Require group editors</code> directive will be ignored
2115     in all cases:</p>
2116
2117     <div class="example"><p><code>
2118       &lt;LimitExcept GET&gt;
2119       <span class="indent">
2120         Require valid-user
2121       </span>
2122       &lt;/LimitExcept&gt;<br />
2123       &lt;Limit POST&gt;
2124       <span class="indent">
2125         Require group editors
2126       </span>
2127       &lt;/Limit&gt;
2128     </code></p></div>
2129
2130 </div>
2131 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2132 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept">&lt;LimitExcept&gt;</a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
2133 <table class="directive">
2134 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
2135 except the named ones</td></tr>
2136 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;LimitExcept <var>method</var> [<var>method</var>] ... &gt; ...
2137     &lt;/LimitExcept&gt;</code></td></tr>
2138 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2139 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2140 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2141 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2142 </table>
2143     <p><code class="directive">&lt;LimitExcept&gt;</code> and
2144     <code>&lt;/LimitExcept&gt;</code> are used to enclose
2145     a group of access control directives which will then apply to any
2146     HTTP access method <strong>not</strong> listed in the arguments;
2147     i.e., it is the opposite of a <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> section and can be used to control
2148     both standard and nonstandard/unrecognized methods. See the
2149     documentation for <code class="directive"><a href="#limit">&lt;Limit&gt;</a></code> for more details.</p>
2150
2151     <p>For example:</p>
2152
2153     <div class="example"><p><code>
2154       &lt;LimitExcept POST GET&gt;<br />
2155       <span class="indent">
2156         Require valid-user<br />
2157       </span>
2158       &lt;/LimitExcept&gt;
2159     </code></p></div>
2160
2161
2162 </div>
2163 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2164 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
2165 <table class="directive">
2166 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
2167 subrequests</td></tr>
2168 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
2169 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
2170 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2171 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2172 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2173 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.47 and later</td></tr>
2174 </table>
2175     <p>An internal redirect happens, for example, when using the <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> directive, which internally
2176     redirects the original request to a CGI script. A subrequest is Apache httpd's
2177     mechanism to find out what would happen for some URI if it were requested.
2178     For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
2179     files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2180     directive.</p>
2181
2182     <p><code class="directive">LimitInternalRecursion</code> prevents the server
2183     from crashing when entering an infinite loop of internal redirects or
2184     subrequests. Such loops are usually caused by misconfigurations.</p>
2185
2186     <p>The directive stores two different limits, which are evaluated on
2187     per-request basis. The first <var>number</var> is the maximum number of
2188     internal redirects, that may follow each other. The second <var>number</var>
2189     determines, how deep subrequests may be nested. If you specify only one
2190     <var>number</var>, it will be assigned to both limits.</p>
2191
2192     <div class="example"><h3>Example</h3><p><code>
2193       LimitInternalRecursion 5
2194     </code></p></div>
2195
2196 </div>
2197 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2198 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
2199 <table class="directive">
2200 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
2201 from the client</td></tr>
2202 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
2203 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
2204 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2205 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2206 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2207 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2208 </table>
2209     <p>This directive specifies the number of <var>bytes</var> from 0
2210     (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2211     request body. See the note below for the limited applicability
2212     to proxy requests.</p>
2213
2214     <p>The <code class="directive">LimitRequestBody</code> directive allows
2215     the user to set a limit on the allowed size of an HTTP request
2216     message body within the context in which the directive is given
2217     (server, per-directory, per-file or per-location). If the client
2218     request exceeds that limit, the server will return an error
2219     response instead of servicing the request. The size of a normal
2220     request message body will vary greatly depending on the nature of
2221     the resource and the methods allowed on that resource. CGI scripts
2222     typically use the message body for retrieving form information.
2223     Implementations of the <code>PUT</code> method will require
2224     a value at least as large as any representation that the server
2225     wishes to accept for that resource.</p>
2226
2227     <p>This directive gives the server administrator greater
2228     control over abnormal client request behavior, which may be
2229     useful for avoiding some forms of denial-of-service
2230     attacks.</p>
2231
2232     <p>If, for example, you are permitting file upload to a particular
2233     location, and wish to limit the size of the uploaded file to 100K,
2234     you might use the following directive:</p>
2235
2236     <div class="example"><p><code>
2237       LimitRequestBody 102400
2238     </code></p></div>
2239
2240     <div class="note"><p>For a full description of how this directive is interpreted by
2241     proxy requests, see the <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> documentation.</p>
2242     </div>
2243
2244
2245 </div>
2246 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2247 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
2248 <table class="directive">
2249 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
2250 will be accepted from the client</td></tr>
2251 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
2252 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
2253 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2254 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2255 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2256 </table>
2257     <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2258     32767. The default value is defined by the compile-time
2259     constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2260     distributed).</p>
2261
2262     <p>The <code class="directive">LimitRequestFields</code> directive allows
2263     the server administrator to modify the limit on the number of
2264     request header fields allowed in an HTTP request. A server needs
2265     this value to be larger than the number of fields that a normal
2266     client request might include. The number of request header fields
2267     used by a client rarely exceeds 20, but this may vary among
2268     different client implementations, often depending upon the extent
2269     to which a user has configured their browser to support detailed
2270     content negotiation. Optional HTTP extensions are often expressed
2271     using request header fields.</p>
2272
2273     <p>This directive gives the server administrator greater
2274     control over abnormal client request behavior, which may be
2275     useful for avoiding some forms of denial-of-service attacks.
2276     The value should be increased if normal clients see an error
2277     response from the server that indicates too many fields were
2278     sent in the request.</p>
2279
2280     <p>For example:</p>
2281
2282     <div class="example"><p><code>
2283       LimitRequestFields 50
2284     </code></p></div>
2285
2286      <div class="warning"><h3>Warning</h3>
2287      <p> When name-based virtual hosting is used, the value for this
2288      directive is taken from the default (first-listed) virtual host for the
2289      local IP and port combination</p>.
2290      </div>
2291
2292
2293 </div>
2294 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2295 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
2296 <table class="directive">
2297 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
2298 client</td></tr>
2299 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
2300 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
2301 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2302 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2303 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2304 </table>
2305     <p>This directive specifies the number of <var>bytes</var>
2306     that will be allowed in an HTTP request header.</p>
2307
2308     <p>The <code class="directive">LimitRequestFieldSize</code> directive
2309     allows the server administrator to reduce or increase the limit
2310     on the allowed size of an HTTP request header field. A server
2311     needs this value to be large enough to hold any one header field
2312     from a normal client request. The size of a normal request header
2313     field will vary greatly among different client implementations,
2314     often depending upon the extent to which a user has configured
2315     their browser to support detailed content negotiation. SPNEGO
2316     authentication headers can be up to 12392 bytes.</p>
2317
2318     <p>This directive gives the server administrator greater
2319     control over abnormal client request behavior, which may be
2320     useful for avoiding some forms of denial-of-service attacks.</p>
2321
2322     <p>For example:</p>
2323
2324     <div class="example"><p><code>
2325       LimitRequestFieldSize 4094
2326     </code></p></div>
2327
2328     <div class="note">Under normal conditions, the value should not be changed from
2329     the default.</div>
2330
2331     <div class="warning"><h3>Warning</h3>
2332     <p> When name-based virtual hosting is used, the value for this
2333     directive is taken from the default (first-listed) virtual host best 
2334     matching the current IP address and port combination.</p>
2335     </div>
2336
2337 </div>
2338 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2339 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
2340 <table class="directive">
2341 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
2342 from the client</td></tr>
2343 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
2344 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
2345 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2346 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2347 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2348 </table>
2349     <p>This directive sets the number of <var>bytes</var> that will be
2350     allowed on the HTTP request-line.</p>
2351
2352     <p>The <code class="directive">LimitRequestLine</code> directive allows
2353     the server administrator to reduce or increase the limit on the allowed size
2354     of a client's HTTP request-line. Since the request-line consists of the
2355     HTTP method, URI, and protocol version, the
2356     <code class="directive">LimitRequestLine</code> directive places a
2357     restriction on the length of a request-URI allowed for a request
2358     on the server. A server needs this value to be large enough to
2359     hold any of its resource names, including any information that
2360     might be passed in the query part of a <code>GET</code> request.</p>
2361
2362     <p>This directive gives the server administrator greater
2363     control over abnormal client request behavior, which may be
2364     useful for avoiding some forms of denial-of-service attacks.</p>
2365
2366     <p>For example:</p>
2367
2368     <div class="example"><p><code>
2369       LimitRequestLine 4094
2370     </code></p></div>
2371
2372     <div class="note">Under normal conditions, the value should not be changed from
2373     the default.</div>
2374
2375     <div class="warning"><h3>Warning</h3>
2376     <p> When name-based virtual hosting is used, the value for this
2377     directive is taken from the default (first-listed) virtual host best 
2378     matching the current IP address and port combination.</p>
2379     </div>
2380
2381
2382 </div>
2383 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2384 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
2385 <table class="directive">
2386 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
2387 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
2388 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
2389 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2390 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2391 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2392 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2393 </table>
2394     <p>Limit (in bytes) on maximum size of an XML-based request
2395     body. A value of <code>0</code> will disable any checking.</p>
2396
2397     <p>Example:</p>
2398
2399     <div class="example"><p><code>
2400       LimitXMLRequestBody 0
2401     </code></p></div>
2402
2403
2404 </div>
2405 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2406 <div class="directive-section"><h2><a name="Location" id="Location">&lt;Location&gt;</a> <a name="location" id="location">Directive</a></h2>
2407 <table class="directive">
2408 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2409 URLs</td></tr>
2410 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Location
2411     <var>URL-path</var>|<var>URL</var>&gt; ... &lt;/Location&gt;</code></td></tr>
2412 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2413 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2414 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2415 </table>
2416     <p>The <code class="directive">&lt;Location&gt;</code> directive
2417     limits the scope of the enclosed directives by URL. It is similar to the
2418     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>
2419     directive, and starts a subsection which is terminated with a
2420     <code>&lt;/Location&gt;</code> directive. <code class="directive">&lt;Location&gt;</code> sections are processed in the
2421     order they appear in the configuration file, after the <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections and
2422     <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files">&lt;Files&gt;</a></code> sections.</p>
2423
2424     <p><code class="directive">&lt;Location&gt;</code> sections operate
2425     completely outside the filesystem.  This has several consequences.
2426     Most importantly, <code class="directive">&lt;Location&gt;</code>
2427     directives should not be used to control access to filesystem
2428     locations.  Since several different URLs may map to the same
2429     filesystem location, such access controls may by circumvented.</p>
2430
2431     <p>The enclosed directives will be applied to the request if the path component
2432     of the URL meets <em>any</em> of the following criteria:
2433     </p>
2434     <ul>
2435       <li>The specified location matches exactly the path component of the URL.
2436       </li>
2437       <li>The specified location, which ends in a forward slash, is a prefix
2438       of the path component of the URL (treated as a context root).
2439       </li>
2440       <li>The specified location, with the addition of a trailing slash, is a
2441       prefix of the path component of the URL (also treated as a context root).
2442       </li>
2443     </ul>
2444     <p>
2445     In the example below, where no trailing slash is used, requests to
2446     /private1, /private1/ and /private1/file.txt will have the enclosed
2447     directives applied, but /private1other would not.
2448     </p>
2449     <div class="example"><p><code>
2450       &lt;Location /private1&gt;
2451           ...
2452     </code></p></div>
2453     <p>
2454     In the example below, where a trailing slash is used, requests to
2455     /private2/ and /private2/file.txt will have the enclosed
2456     directives applied, but /private2 and /private2other would not.
2457     </p>
2458     <div class="example"><p><code>
2459       &lt;Location /private2<em>/</em>&gt;
2460           ...
2461     </code></p></div>
2462
2463     <div class="note"><h3>When to use <code class="directive">&lt;Location&gt;</code></h3>
2464
2465     <p>Use <code class="directive">&lt;Location&gt;</code> to apply
2466     directives to content that lives outside the filesystem.  For
2467     content that lives in the filesystem, use <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> and <code class="directive"><a href="#files">&lt;Files&gt;</a></code>.  An exception is
2468     <code>&lt;Location /&gt;</code>, which is an easy way to
2469     apply a configuration to the entire server.</p>
2470     </div>
2471
2472     <p>For all origin (non-proxy) requests, the URL to be matched is a
2473     URL-path of the form <code>/path/</code>.  <em>No scheme, hostname,
2474     port, or query string may be included.</em>  For proxy requests, the
2475     URL to be matched is of the form
2476     <code>scheme://servername/path</code>, and you must include the
2477     prefix.</p>
2478
2479     <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2480     any single character, and <code>*</code> matches any sequences of
2481     characters. Neither wildcard character matches a / in the URL-path.</p>
2482
2483     <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
2484     can also be used, with the addition of the <code>~</code>
2485     character. For example:</p>
2486
2487     <div class="example"><p><code>
2488       &lt;Location ~ "/(extra|special)/data"&gt;
2489     </code></p></div>
2490
2491     <p>would match URLs that contained the substring <code>/extra/data</code>
2492     or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch">&lt;LocationMatch&gt;</a></code> behaves
2493     identical to the regex version of <code class="directive">&lt;Location&gt;</code>, and is preferred, for the
2494     simple reason that <code>~</code> is hard to distinguish from
2495     <code>-</code> in many fonts.</p>
2496
2497     <p>The <code class="directive">&lt;Location&gt;</code>
2498     functionality is especially useful when combined with the
2499     <code class="directive"><a href="#sethandler">SetHandler</a></code>
2500     directive. For example, to enable status requests, but allow them
2501     only from browsers at <code>example.com</code>, you might use:</p>
2502
2503     <div class="example"><p><code>
2504       &lt;Location /status&gt;<br />
2505       <span class="indent">
2506         SetHandler server-status<br />
2507         Require host example.com<br />
2508       </span>
2509       &lt;/Location&gt;
2510     </code></p></div>
2511
2512     <div class="note"><h3>Note about / (slash)</h3>
2513       <p>The slash character has special meaning depending on where in a
2514       URL it appears. People may be used to its behavior in the filesystem
2515       where multiple adjacent slashes are frequently collapsed to a single
2516       slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2517       <code>/home/foo</code>). In URL-space this is not necessarily true.
2518       The <code class="directive"><a href="#locationmatch">&lt;LocationMatch&gt;</a></code>
2519       directive and the regex version of <code class="directive">&lt;Location&gt;</code> require you to explicitly specify multiple
2520       slashes if that is your intention.</p>
2521
2522       <p>For example, <code>&lt;LocationMatch ^/abc&gt;</code> would match
2523       the request URL <code>/abc</code> but not the request URL <code>
2524       //abc</code>. The (non-regex) <code class="directive">&lt;Location&gt;</code> directive behaves similarly when used for
2525       proxy requests. But when (non-regex) <code class="directive">&lt;Location&gt;</code> is used for non-proxy requests it will
2526       implicitly match multiple slashes with a single slash. For example,
2527       if you specify <code>&lt;Location /abc/def&gt;</code> and the
2528       request is to <code>/abc//def</code> then it will match.</p>
2529     </div>
2530
2531 <h3>See also</h3>
2532 <ul>
2533 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
2534     and &lt;Files&gt; sections work</a> for an explanation of how these
2535     different sections are combined when a request is received.</li>
2536 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
2537 </ul>
2538 </div>
2539 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2540 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch">&lt;LocationMatch&gt;</a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2541 <table class="directive">
2542 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2543 matching URLs</td></tr>
2544 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;LocationMatch
2545     <var>regex</var>&gt; ... &lt;/LocationMatch&gt;</code></td></tr>
2546 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2547 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2548 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2549 </table>
2550     <p>The <code class="directive">&lt;LocationMatch&gt;</code> directive
2551     limits the scope of the enclosed directives by URL, in an identical manner
2552     to <code class="directive"><a href="#location">&lt;Location&gt;</a></code>. However,
2553     it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2554     as an argument instead of a simple string. For example:</p>
2555
2556     <div class="example"><p><code>
2557       &lt;LocationMatch "/(extra|special)/data"&gt;
2558     </code></p></div>
2559
2560     <p>would match URLs that contained the substring <code>/extra/data</code>
2561     or <code>/special/data</code>.</p>
2562
2563 <h3>See also</h3>
2564 <ul>
2565 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
2566     and &lt;Files&gt; sections work</a> for an explanation of how these
2567     different sections are combined when a request is received</li>
2568 </ul>
2569 </div>
2570 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2571 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2572 <table class="directive">
2573 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2574 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel [<var>module</var>:]<var>level</var>
2575     [<var>module</var>:<var>level</var>] ...
2576 </code></td></tr>
2577 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2578 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2579 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2580 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2581 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Per-module and per-directory configuration is available in
2582     Apache HTTP Server 2.3.6 and later</td></tr>
2583 </table>
2584     <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2585     messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2586     <var>level</var>s are available, in order of decreasing
2587     significance:</p>
2588
2589     <table class="bordered">
2590     
2591       <tr>
2592         <th><strong>Level</strong> </th>
2593
2594         <th><strong>Description</strong> </th>
2595
2596         <th><strong>Example</strong> </th>
2597       </tr>
2598
2599       <tr>
2600         <td><code>emerg</code> </td>
2601
2602         <td>Emergencies - system is unusable.</td>
2603
2604         <td>"Child cannot open lock file. Exiting"</td>
2605       </tr>
2606
2607       <tr>
2608         <td><code>alert</code> </td>
2609
2610         <td>Action must be taken immediately.</td>
2611
2612         <td>"getpwuid: couldn't determine user name from uid"</td>
2613       </tr>
2614
2615       <tr>
2616         <td><code>crit</code> </td>
2617
2618         <td>Critical Conditions.</td>
2619
2620         <td>"socket: Failed to get a socket, exiting child"</td>
2621       </tr>
2622
2623       <tr>
2624         <td><code>error</code> </td>
2625
2626         <td>Error conditions.</td>
2627
2628         <td>"Premature end of script headers"</td>
2629       </tr>
2630
2631       <tr>
2632         <td><code>warn</code> </td>
2633
2634         <td>Warning conditions.</td>
2635
2636         <td>"child process 1234 did not exit, sending another
2637         SIGHUP"</td>
2638       </tr>
2639
2640       <tr>
2641         <td><code>notice</code> </td>
2642
2643         <td>Normal but significant condition.</td>
2644
2645         <td>"httpd: caught SIGBUS, attempting to dump core in
2646         ..."</td>
2647       </tr>
2648
2649       <tr>
2650         <td><code>info</code> </td>
2651
2652         <td>Informational.</td>
2653
2654         <td>"Server seems busy, (you may need to increase
2655         StartServers, or Min/MaxSpareServers)..."</td>
2656       </tr>
2657
2658       <tr>
2659         <td><code>debug</code> </td>
2660
2661         <td>Debug-level messages</td>
2662
2663         <td>"Opening config file ..."</td>
2664       </tr>
2665       <tr>
2666         <td><code>trace1</code> </td>
2667
2668         <td>Trace messages</td>
2669
2670         <td>"proxy: FTP: control connection complete"</td>
2671       </tr>
2672       <tr>
2673         <td><code>trace2</code> </td>
2674
2675         <td>Trace messages</td>
2676
2677         <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2678       </tr>
2679       <tr>
2680         <td><code>trace3</code> </td>
2681
2682         <td>Trace messages</td>
2683
2684         <td>"openssl: Handshake: start"</td>
2685       </tr>
2686       <tr>
2687         <td><code>trace4</code> </td>
2688
2689         <td>Trace messages</td>
2690
2691         <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2692       </tr>
2693       <tr>
2694         <td><code>trace5</code> </td>
2695
2696         <td>Trace messages</td>
2697
2698         <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2699       </tr>
2700       <tr>
2701         <td><code>trace6</code> </td>
2702
2703         <td>Trace messages</td>
2704
2705         <td>"cache lookup FAILED, forcing new map lookup"</td>
2706       </tr>
2707       <tr>
2708         <td><code>trace7</code> </td>
2709
2710         <td>Trace messages, dumping large amounts of data</td>
2711
2712         <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2713       </tr>
2714       <tr>
2715         <td><code>trace8</code> </td>
2716
2717         <td>Trace messages, dumping large amounts of data</td>
2718
2719         <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2720       </tr>
2721     </table>
2722
2723     <p>When a particular level is specified, messages from all
2724     other levels of higher significance will be reported as well.
2725     <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2726     then messages with log levels of <code>notice</code> and
2727     <code>warn</code> will also be posted.</p>
2728
2729     <p>Using a level of at least <code>crit</code> is
2730     recommended.</p>
2731
2732     <p>For example:</p>
2733
2734     <div class="example"><p><code>
2735       LogLevel notice
2736     </code></p></div>
2737
2738     <div class="note"><h3>Note</h3>
2739       <p>When logging to a regular file messages of the level
2740       <code>notice</code> cannot be suppressed and thus are always
2741       logged. However, this doesn't apply when logging is done
2742       using <code>syslog</code>.</p>
2743     </div>
2744
2745     <p>Specifying a level without a module name will reset the level
2746     for all modules to that level.  Specifying a level with a module
2747     name will set the level for that module only. It is possible to
2748     use the module source file name, the module identifier, or the
2749     module identifier with the trailing <code>_module</code> omitted
2750     as module specification. This means the following three specifications
2751     are equivalent:</p>
2752
2753     <div class="example"><p><code>
2754       LogLevel info ssl:warn<br />
2755       LogLevel info mod_ssl.c:warn<br />
2756       LogLevel info ssl_module:warn<br />
2757     </code></p></div>
2758
2759     <p>It is also possible to change the level per directory:</p>
2760
2761     <div class="example"><p><code>
2762         LogLevel info<br />
2763         &lt;Directory /usr/local/apache/htdocs/app&gt;<br />
2764         &nbsp; LogLevel debug<br />
2765         &lt;/Files&gt;
2766     </code></p></div>
2767
2768     <div class="note">
2769         Per directory loglevel configuration only affects messages that are
2770         logged after the request has been parsed and that are associated with
2771         the request. Log messages which are associated with the connection or
2772         the server are not affected.
2773     </div>
2774
2775 </div>
2776 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2777 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
2778 <table class="directive">
2779 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
2780 connection</td></tr>
2781 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
2782 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
2783 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2784 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2785 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2786 </table>
2787     <p>The <code class="directive">MaxKeepAliveRequests</code> directive
2788     limits the number of requests allowed per connection when
2789     <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
2790     set to <code>0</code>, unlimited requests will be allowed. We
2791     recommend that this setting be kept to a high value for maximum
2792     server performance.</p>
2793
2794     <p>For example:</p>
2795
2796     <div class="example"><p><code>
2797       MaxKeepAliveRequests 500
2798     </code></p></div>
2799
2800 </div>
2801 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2802 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
2803 <table class="directive">
2804 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
2805 or specified mutexes</td></tr>
2806 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Mutex <var>mechanism</var> [default|<var>mutex-name</var>] ... [OmitPID]</code></td></tr>
2807 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
2808 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2809 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2810 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2811 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.4 and later</td></tr>
2812 </table>
2813     <p>The <code class="directive">Mutex</code> directive sets the mechanism,
2814     and optionally the lock file location, that httpd and modules use
2815     to serialize access to resources.  Specify <code>default</code> as
2816     the first argument to change the settings for all mutexes; specify
2817     a mutex name (see table below) as the first argument to override
2818     defaults only for that mutex.</p>
2819
2820     <p>The <code class="directive">Mutex</code> directive is typically used in
2821     the following exceptional situations:</p>
2822
2823     <ul>
2824         <li>change the mutex mechanism when the default mechanism selected
2825         by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
2826         problem</li>
2827
2828         <li>change the directory used by file-based mutexes when the
2829         default directory does not support locking</li>
2830     </ul>
2831
2832     <div class="note"><h3>Supported modules</h3>
2833     <p>This directive only configures mutexes which have been registered
2834     with the core server using the <code>ap_mutex_register()</code> API.
2835     All modules bundled with httpd support the <code class="directive">Mutex</code>
2836     directive, but third-party modules may not.  Consult the documentation
2837     of the third-party module, which must indicate the mutex name(s) which
2838     can be configured if this directive is supported.</p>
2839     </div>
2840
2841     <p>The following mutex <em>mechanisms</em> are available:</p>
2842     <ul>
2843         <li><code>default | yes</code>
2844         <p>This selects the default locking implementation, as determined by
2845         <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>.  The default locking implementation can
2846         be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
2847         <code>-V</code> option.</p></li>
2848
2849         <li><code>none | no</code>
2850         <p>This effectively disables the mutex, and is only allowed for a
2851         mutex if the module indicates that it is a valid choice.  Consult the
2852         module documentation for more information.</p></li>
2853
2854         <li><code>posixsem</code>
2855         <p>This is a mutex variant based on a Posix semaphore.</p>
2856
2857         <div class="warning"><h3>Warning</h3>
2858         <p>The semaphore ownership is not recovered if a thread in the process
2859         holding the mutex segfaults, resulting in a hang of the web server.</p>
2860         </div>
2861         </li>
2862
2863         <li><code>sysvsem</code>
2864         <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2865
2866         <div class="warning"><h3>Warning</h3>
2867         <p>It is possible to "leak" SysV semaphores if processes crash
2868         before the semaphore is removed.</p>
2869         </div>
2870
2871         <div class="warning"><h3>Security</h3>
2872         <p>The semaphore API allows for a denial of service attack by any
2873         CGIs running under the same uid as the webserver (<em>i.e.</em>,
2874         all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
2875         or <code>cgiwrapper</code>).</p>
2876         </div>
2877         </li>
2878
2879         <li><code>sem</code>
2880         <p>This selects the "best" available semaphore implementation, choosing
2881         between Posix and SystemV IPC semaphores, in that order.</p></li>
2882
2883         <li><code>pthread</code>
2884         <p>This is a mutex variant based on cross-process Posix thread
2885         mutexes.</p>
2886
2887         <div class="warning"><h3>Warning</h3>
2888         <p>On most systems, if a child process terminates abnormally while
2889         holding a mutex that uses this implementation, the server will deadlock
2890         and stop responding to requests.  When this occurs, the server will
2891         require a manual restart to recover.</p>
2892         <p>Solaris is a notable exception as it provides a mechanism which
2893         usually allows the mutex to be recovered after a child process
2894         terminates abnormally while holding a mutex.</p>
2895         <p>If your system implements the
2896         <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2897         to use the <code>pthread</code> option safely.</p>
2898         </div>
2899         </li>
2900
2901         <li><code>fcntl:/path/to/mutex</code>
2902         <p>This is a mutex variant where a physical (lock-)file and the
2903         <code>fcntl()</code> function are used as the mutex.</p>
2904
2905         <div class="warning"><h3>Warning</h3>
2906         <p>When multiple mutexes based on this mechanism are used within
2907         multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2908         can be reported for valid mutex operations if <code>fcntl()</code>
2909         is not thread-aware, such as on Solaris.</p>
2910         </div>
2911         </li>
2912
2913         <li><code>flock:/path/to/mutex</code>
2914         <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2915         with the exception that the <code>flock()</code> function is used to
2916         provide file locking.</p></li>
2917
2918         <li><code>file:/path/to/mutex</code>
2919         <p>This selects the "best" available file locking implementation,
2920         choosing between <code>fcntl</code> and <code>flock</code>, in that
2921         order.</p></li>
2922     </ul>
2923
2924     <p>Most mechanisms are only available on selected platforms, where the
2925     underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it.  Mechanisms
2926     which aren't available on all platforms are <em>posixsem</em>,
2927     <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2928     <em>flock</em>, and <em>file</em>.</p>
2929
2930     <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2931     the path, if provided, is a directory where the lock file will be created.
2932     The default directory is httpd's run-time file directory relative to
2933     <code class="directive"><a href="#serverroot">ServerRoot</a></code>.  Always use a local disk
2934     filesystem for <code>/path/to/mutex</code> and never a directory residing
2935     on a NFS- or AFS-filesystem.  The basename of the file will be the mutex
2936     type, an optional instance string provided by the module, and unless the
2937     <code>OmitPID</code> keyword is specified, the process id of the httpd
2938     parent process will be appended to to make the file name unique, avoiding
2939     conflicts when multiple httpd instances share a lock file directory.  For
2940     example, if the mutex name is <code>mpm-accept</code> and the lock file
2941     directory is <code>/var/httpd/locks</code>, the lock file name for the
2942     httpd instance with parent process id 12345 would be
2943     <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2944
2945     <div class="warning"><h3>Security</h3>
2946     <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2947     directory such as <code>/var/tmp</code> because someone could create
2948     a denial of service attack and prevent the server from starting by
2949     creating a lockfile with the same name as the one the server will try
2950     to create.</p>
2951     </div>
2952
2953     <p>The following table documents the names of mutexes used by httpd
2954     and bundled modules.</p>
2955
2956     <table class="bordered"><tr class="header">
2957             <th>Mutex name</th>
2958             <th>Module(s)</th>
2959             <th>Protected resource</th>
2960         </tr>
2961 <tr>
2962             <td><code>mpm-accept</code></td>
2963             <td><code class="module"><a href="../mod/prefork.html">prefork</a></code> and <code class="module"><a href="../mod/worker.html">worker</a></code> MPMs</td>
2964             <td>incoming connections, to avoid the thundering herd problem;
2965             for more information, refer to the
2966             <a href="../misc/perf-tuning.html">performance tuning</a>
2967             documentation</td>
2968         </tr>
2969 <tr class="odd">
2970             <td><code>authdigest-client</code></td>
2971             <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
2972             <td>client list in shared memory</td>
2973         </tr>
2974 <tr>
2975             <td><code>authdigest-opaque</code></td>
2976             <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
2977             <td>counter in shared memory</td>
2978         </tr>
2979 <tr class="odd">
2980             <td><code>ldap-cache</code></td>
2981             <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
2982             <td>LDAP result cache</td>
2983         </tr>
2984 <tr>
2985             <td><code>rewrite-map</code></td>
2986             <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
2987             <td>communication with external mapping programs, to avoid
2988             intermixed I/O from multiple requests</td>
2989         </tr>
2990 <tr class="odd">
2991             <td><code>ssl-cache</code></td>
2992             <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
2993             <td>SSL session cache</td>
2994         </tr>
2995 <tr>
2996             <td><code>ssl-stapling</code></td>
2997             <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
2998             <td>OCSP stapling response cache</td>
2999         </tr>
3000 <tr class="odd">
3001             <td><code>watchdog-callback</code></td>
3002             <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
3003             <td>callback function of a particular client module</td>
3004         </tr>
3005 </table>
3006
3007     <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3008     parent process id from the lock file name.</p>
3009
3010     <p>In the following example, the mutex mechanism for the MPM accept
3011     mutex will be changed from the compiled-in default to <code>fcntl</code>,
3012     with the associated lock file created in directory
3013     <code>/var/httpd/locks</code>.  The mutex mechanism for all other mutexes
3014     will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3015
3016     <div class="example"><p><code>
3017     Mutex default sysvsem<br />
3018     Mutex mpm-accept fcntl:/var/httpd/locks
3019     </code></p></div>
3020
3021 </div>
3022 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3023 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
3024 <table class="directive">
3025 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Designates an IP address for name-virtual
3026 hosting</td></tr>
3027 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
3028 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3029 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3030 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3031 </table>
3032
3033 <p>Prior to 2.3.11, <code class="directive">NameVirtualHost</code> was required
3034 to instruct the server that a particular IP address and port combination
3035 was usable as a name-based virtual host.  In 2.3.11 and later,
3036 any time an IP address and port combination is used in multiple virtual
3037 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3038
3039 <p>This directive currently has no effect.</p>
3040
3041 <h3>See also</h3>
3042 <ul>
3043 <li><a href="../vhosts/">Virtual Hosts
3044 documentation</a></li>
3045 </ul>
3046 </div>
3047 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3048 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
3049 <table class="directive">
3050 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
3051 directory</td></tr>
3052 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
3053     [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
3054 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options FollowSymlinks</code></td></tr>
3055 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3056 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
3057 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3058 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3059 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default was changed from All to FollowSymlinks in 2.3.11</td></tr>
3060 </table>
3061     <p>The <code class="directive">Options</code> directive controls which
3062     server features are available in a particular directory.</p>
3063
3064     <p><var>option</var> can be set to <code>None</code>, in which
3065     case none of the extra features are enabled, or one or more of
3066     the following:</p>
3067
3068     <dl>
3069       <dt><code>All</code></dt>
3070
3071       <dd>All options except for <code>MultiViews</code>.</dd>
3072
3073       <dt><code>ExecCGI</code></dt>
3074
3075       <dd>
3076       Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
3077       is permitted.</dd>
3078
3079       <dt><code>FollowSymLinks</code></dt>
3080
3081       <dd>
3082       The server will follow symbolic links in this directory. This is
3083       the default setting.
3084       <div class="note">
3085       <p>Even though the server follows the symlink it does <em>not</em>
3086       change the pathname used to match against <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> sections.</p>
3087       <p>Note also, that this option <strong>gets ignored</strong> if set
3088       inside a <code class="directive"><a href="#location">&lt;Location&gt;</a></code>
3089       section.</p>
3090       <p>Omitting this option should not be considered a security restriction,
3091       since symlink testing is subject to race conditions that make it
3092       circumventable.</p>
3093       </div></dd>
3094
3095       <dt><code>Includes</code></dt>
3096
3097       <dd>
3098       Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
3099       are permitted.</dd>
3100
3101       <dt><code>IncludesNOEXEC</code></dt>
3102
3103       <dd>
3104
3105       Server-side includes are permitted, but the <code>#exec
3106       cmd</code> and <code>#exec cgi</code> are disabled. It is still
3107       possible to <code>#include virtual</code> CGI scripts from
3108       <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
3109       directories.</dd>
3110
3111       <dt><code>Indexes</code></dt>
3112
3113       <dd>
3114       If a URL which maps to a directory is requested, and there
3115       is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
3116       (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3117       <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
3118       of the directory.</dd>
3119
3120       <dt><code>MultiViews</code></dt>
3121
3122       <dd>
3123       <a href="../content-negotiation.html">Content negotiated</a>
3124       "MultiViews" are allowed using
3125       <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.
3126       <div class="note"><h3>Note</h3> <p>This option gets ignored if set
3127       anywhere other than <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code>, as <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>
3128       needs real resources to compare against and evaluate from.</p></div>
3129       </dd>
3130
3131       <dt><code>SymLinksIfOwnerMatch</code></dt>
3132
3133       <dd>The server will only follow symbolic links for which the
3134       target file or directory is owned by the same user id as the
3135       link.
3136
3137       <div class="note"><h3>Note</h3> <p>This option gets ignored if
3138       set inside a <code class="directive"><a href="#location">&lt;Location&gt;</a></code> section.</p>
3139       <p>This option should not be considered a security restriction,
3140       since symlink testing is subject to race conditions that make it
3141       circumventable.</p></div>
3142       </dd>
3143     </dl>
3144
3145     <p>Normally, if multiple <code class="directive">Options</code> could
3146     apply to a directory, then the most specific one is used and
3147     others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
3148     However if <em>all</em> the options on the
3149     <code class="directive">Options</code> directive are preceded by a
3150     <code>+</code> or <code>-</code> symbol, the options are
3151     merged. Any options preceded by a <code>+</code> are added to the
3152     options currently in force, and any options preceded by a
3153     <code>-</code> are removed from the options currently in
3154     force. </p>
3155
3156     <div class="note"><h3>Note</h3>
3157     <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
3158     <code>-</code> with those without is not valid syntax, and will be
3159     rejected during server startup by the syntax check with an abort.</p>
3160     </div>
3161
3162     <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3163
3164     <div class="example"><p><code>
3165       &lt;Directory /web/docs&gt;<br />
3166       <span class="indent">
3167         Options Indexes FollowSymLinks<br />
3168       </span>
3169       &lt;/Directory&gt;<br />
3170       <br />
3171       &lt;Directory /web/docs/spec&gt;<br />
3172       <span class="indent">
3173         Options Includes<br />
3174       </span>
3175       &lt;/Directory&gt;
3176     </code></p></div>
3177
3178     <p>then only <code>Includes</code> will be set for the
3179     <code>/web/docs/spec</code> directory. However if the second
3180     <code class="directive">Options</code> directive uses the <code>+</code> and
3181     <code>-</code> symbols:</p>
3182
3183     <div class="example"><p><code>
3184       &lt;Directory /web/docs&gt;<br />
3185       <span class="indent">
3186         Options Indexes FollowSymLinks<br />
3187       </span>
3188       &lt;/Directory&gt;<br />
3189       <br />
3190       &lt;Directory /web/docs/spec&gt;<br />
3191       <span class="indent">
3192         Options +Includes -Indexes<br />
3193       </span>
3194       &lt;/Directory&gt;
3195     </code></p></div>
3196
3197     <p>then the options <code>FollowSymLinks</code> and
3198     <code>Includes</code> are set for the <code>/web/docs/spec</code>
3199     directory.</p>
3200
3201     <div class="note"><h3>Note</h3>
3202       <p>Using <code>-IncludesNOEXEC</code> or
3203       <code>-Includes</code> disables server-side includes completely
3204       regardless of the previous setting.</p>
3205     </div>
3206
3207     <p>The default in the absence of any other settings is
3208     <code>FollowSymlinks</code>.</p>
3209
3210 </div>
3211 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3212 <div class="directive-section"><h2><a name="Protocol" id="Protocol">Protocol</a> <a name="protocol" id="protocol">Directive</a></h2>
3213 <table class="directive">
3214 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocol for a listening socket</td></tr>
3215 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocol <var>protocol</var></code></td></tr>
3216 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3217 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3218 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3219 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1.5 and later.
3220 On Windows from Apache 2.3.3 and later.</td></tr>
3221 </table>
3222     <p>This directive specifies the protocol used for a specific listening socket.
3223        The protocol is used to determine which module should handle a request, and
3224        to apply protocol specific optimizations with the <code class="directive">AcceptFilter</code>
3225        directive.</p>
3226
3227     <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>
3228
3229     <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3230
3231     <div class="example"><p><code>
3232       Protocol https
3233     </code></p></div>
3234
3235     <p>You can also specify the protocol using the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive.</p>
3236
3237 <h3>See also</h3>
3238 <ul>
3239 <li><code class="directive">AcceptFilter</code></li>
3240 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3241 </ul>
3242 </div>
3243 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3244 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
3245 <table class="directive">
3246 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
3247 by Apache httpd children</td></tr>
3248 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitCPU <var>seconds</var>|max [<var>seconds</var>|max]</code></td></tr>
3249 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3250 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3251 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3252 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3253 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3254 </table>
3255     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3256     resource limit for all processes and the second parameter sets
3257     the maximum resource limit. Either parameter can be a number,
3258     or <code>max</code> to indicate to the server that the limit should
3259     be set to the maximum allowed by the operating system
3260     configuration. Raising the maximum resource limit requires that
3261     the server is running as <code>root</code>, or in the initial startup
3262     phase.</p>
3263
3264     <p>This applies to processes forked off from Apache httpd children
3265     servicing requests, not the Apache httpd children themselves. This
3266     includes CGI scripts and SSI exec commands, but not any
3267     processes forked off from the Apache httpd parent such as piped
3268     logs.</p>
3269
3270     <p>CPU resource limits are expressed in seconds per
3271     process.</p>
3272
3273 <h3>See also</h3>
3274 <ul>
3275 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3276 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3277 </ul>
3278 </div>
3279 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3280 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
3281 <table class="directive">
3282 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
3283 by Apache httpd children</td></tr>
3284 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitMEM <var>bytes</var>|max [<var>bytes</var>|max]</code></td></tr>
3285 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3286 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3287 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3288 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3289 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3290 </table>
3291     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3292     resource limit for all processes and the second parameter sets
3293     the maximum resource limit. Either parameter can be a number,
3294     or <code>max</code> to indicate to the server that the limit should
3295     be set to the maximum allowed by the operating system
3296     configuration. Raising the maximum resource limit requires that
3297     the server is running as <code>root</code>, or in the initial startup
3298     phase.</p>
3299
3300     <p>This applies to processes forked off from Apache httpd children
3301     servicing requests, not the Apache httpd children themselves. This
3302     includes CGI scripts and SSI exec commands, but not any
3303     processes forked off from the Apache httpd parent such as piped
3304     logs.</p>
3305
3306     <p>Memory resource limits are expressed in bytes per
3307     process.</p>
3308
3309 <h3>See also</h3>
3310 <ul>
3311 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3312 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3313 </ul>
3314 </div>
3315 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3316 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
3317 <table class="directive">
3318 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
3319 processes launched by Apache httpd children</td></tr>
3320 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitNPROC <var>number</var>|max [<var>number</var>|max]</code></td></tr>
3321 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3322 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3323 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3324 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3325 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3326 </table>
3327     <p>Takes 1 or 2 parameters. The first parameter sets the soft
3328     resource limit for all processes and the second parameter sets
3329     the maximum resource limit. Either parameter can be a number,
3330     or <code>max</code> to indicate to the server that the limit
3331     should be set to the maximum allowed by the operating system
3332     configuration. Raising the maximum resource limit requires that
3333     the server is running as <code>root</code>, or in the initial startup
3334     phase.</p>
3335
3336     <p>This applies to processes forked off from Apache httpd children
3337     servicing requests, not the Apache httpd children themselves. This
3338     includes CGI scripts and SSI exec commands, but not any
3339     processes forked off from the Apache httpd parent such as piped
3340     logs.</p>
3341
3342     <p>Process limits control the number of processes per user.</p>
3343
3344     <div class="note"><h3>Note</h3>
3345       <p>If CGI processes are <strong>not</strong> running
3346       under user ids other than the web server user id, this directive
3347       will limit the number of processes that the server itself can
3348       create. Evidence of this situation will be indicated by
3349       <strong><code>cannot fork</code></strong> messages in the
3350       <code>error_log</code>.</p>
3351     </div>
3352
3353 <h3>See also</h3>
3354 <ul>
3355 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3356 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3357 </ul>
3358 </div>
3359 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3360 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
3361 <table class="directive">
3362 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
3363 scripts</td></tr>
3364 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
3365 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
3366 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3367 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3368 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3369 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3370 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only;
3371 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3372 later</td></tr>
3373 </table>
3374     <p>This directive is used to control how Apache httpd finds the
3375     interpreter used to run CGI scripts. The default setting is
3376     <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3377     by the shebang line (first line, starting with <code>#!</code>) in the
3378     script. On Win32 systems this line usually looks like:</p>
3379
3380     <div class="example"><p><code>
3381       #!C:/Perl/bin/perl.exe
3382     </code></p></div>
3383
3384     <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3385
3386     <div class="example"><p><code>
3387       #!perl
3388     </code></p></div>
3389
3390     <p>Setting <code>ScriptInterpreterSource Registry</code> will
3391     cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3392     searched using the script file extension (e.g., <code>.pl</code>) as a
3393     search key. The command defined by the registry subkey
3394     <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3395     <code>Shell\Open\Command</code> is used to open the script file. If the
3396     registry keys cannot be found, Apache httpd falls back to the behavior of the
3397     <code>Script</code> option.</p>
3398
3399     <div class="warning"><h3>Security</h3>
3400     <p>Be careful when using <code>ScriptInterpreterSource
3401     Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
3402     Apache httpd will try to execute <strong>every</strong> file within this
3403     directory. The <code>Registry</code> setting may cause undesired
3404     program calls on files which are typically not executed. For
3405     example, the default open command on <code>.htm</code> files on
3406     most Windows systems will execute Microsoft Internet Explorer, so
3407     any HTTP request for an <code>.htm</code> file existing within the
3408     script directory would start the browser in the background on the
3409     server. This is a good way to crash your system within a minute or
3410     so.</p>
3411     </div>
3412
3413     <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3414     2.0 does the same thing as <code>Registry</code> but uses only the
3415     subkey <code>Shell\ExecCGI\Command</code>. The
3416     <code>ExecCGI</code> key is not a common one. It must be
3417     configured manually in the windows registry and hence prevents
3418     accidental program calls on your system.</p>
3419
3420 </div>
3421 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3422 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
3423 <table class="directive">
3424 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
3425 of a request or the last 63, assuming the request itself is greater than
3426 63 chars.</td></tr>
3427 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
3428 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
3429 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3430 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3431 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3432 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.2.7 and later.</td></tr>
3433 </table>
3434     <p>mod_status with <code>ExtendedStatus On</code>
3435     displays the actual request being handled.
3436     For historical purposes, only 63 characters of the request
3437     are actually stored for display purposes. This directive
3438     controls whether the 1st 63 characters are stored (the previous
3439     behavior and the default) or if the last 63 characters are. This
3440     is only applicable, of course, if the length of the request is
3441     64 characters or greater.</p>
3442
3443     <p>If Apache httpd is handling <code>GET&nbsp;/disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg&nbsp;HTTP/1.1</code> mod_status displays as follows:
3444     </p>
3445
3446     <table class="bordered">
3447       <tr>
3448         <th>Off (default)</th>
3449         <td>GET&nbsp;/disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3450       </tr>
3451       <tr>
3452         <th>On</th>
3453         <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg&nbsp;HTTP/1.1</td>
3454       </tr>
3455     </table>
3456
3457
3458 </div>
3459 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3460 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
3461 <table class="directive">
3462 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
3463 messages sent to the client</td></tr>
3464 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
3465 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3466 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3467 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3468 </table>
3469     <p>The <code class="directive">ServerAdmin</code> sets the contact address
3470     that the server includes in any error messages it returns to the
3471     client. If the <code>httpd</code> doesn't recognize the supplied argument
3472     as an URL, it
3473     assumes, that it's an <var>email-address</var> and prepends it with
3474     <code>mailto:</code> in hyperlink targets. However, it's recommended to
3475     actually use an email address, since there are a lot of CGI scripts that
3476     make that assumption. If you want to use an URL, it should point to another
3477     server under your control. Otherwise users may not be able to contact you in
3478     case of errors.</p>
3479
3480     <p>It may be worth setting up a dedicated address for this, e.g.</p>
3481
3482     <div class="example"><p><code>
3483       ServerAdmin www-admin@foo.example.com
3484     </code></p></div>
3485     <p>as users do not always mention that they are talking about the
3486     server!</p>
3487
3488 </div>
3489 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3490 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
3491 <table class="directive">
3492 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
3493 to name-virtual hosts</td></tr>
3494 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
3495 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3496 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3497 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3498 </table>
3499     <p>The <code class="directive">ServerAlias</code> directive sets the
3500     alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3501     <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
3502
3503     <div class="example"><p><code>
3504       &lt;VirtualHost *:80&gt;<br />
3505       ServerName server.example.com<br />
3506       ServerAlias server server2.example.com server2<br />
3507       ServerAlias *.example.com<br />
3508       UseCanonicalName Off<br />
3509       # ...<br />
3510       &lt;/VirtualHost&gt;
3511     </code></p></div>
3512
3513 <h3>See also</h3>
3514 <ul>
3515 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3516 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
3517 </ul>
3518 </div>
3519 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3520 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
3521 <table class="directive">
3522 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
3523 itself</td></tr>
3524 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</code></td></tr>
3525 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3526 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3527 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3528 </table>
3529     <p>The <code class="directive">ServerName</code> directive sets the
3530     request scheme, hostname and
3531     port that the server uses to identify itself.  This is used when
3532     creating redirection URLs.</p>
3533
3534     <p>Additionally, <code class="directive">ServerName</code> is used (possibly
3535     in conjunction with <code class="directive">ServerAlias</code>) to uniquely
3536     identify a virtual host, when using <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3537
3538     <p>For example, if the name of the
3539     machine hosting the web server is <code>simple.example.com</code>,
3540     but the machine also has the DNS alias <code>www.example.com</code>
3541     and you wish the web server to be so identified, the following
3542     directive should be used:</p>
3543
3544     <div class="example"><p><code>
3545       ServerName www.example.com
3546     </code></p></div>
3547
3548     <p>The <code class="directive">ServerName</code> directive
3549     may appear anywhere within the definition of a server. However,
3550     each appearance overrides the previous appearance (within that
3551     server).</p>
3552
3553     <p>If no <code class="directive">ServerName</code> is specified, then the
3554     server attempts to deduce the hostname by performing a reverse
3555     lookup on the IP address. If no port is specified in the
3556     <code class="directive">ServerName</code>, then the server will use the
3557     port from the incoming request. For optimal reliability and
3558     predictability, you should specify an explicit hostname and port
3559     using the <code class="directive">ServerName</code> directive.</p>
3560
3561     <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
3562     the <code class="directive">ServerName</code> inside a
3563     <code class="directive"><a href="#virtualhost">&lt;VirtualHost&gt;</a></code>
3564     section specifies what hostname must appear in the request's
3565     <code>Host:</code> header to match this virtual host.</p>
3566
3567     <p>Sometimes, the server runs behind a device that processes SSL,
3568     such as a reverse proxy, load balancer or SSL offload
3569     appliance. When this is the case, specify the
3570     <code>https://</code> scheme and the port number to which the
3571     clients connect in the <code class="directive">ServerName</code> directive
3572     to make sure that the server generates the correct
3573     self-referential URLs.
3574     </p>
3575
3576     <p>See the description of the
3577     <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
3578     <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
3579     settings which determine whether self-referential URLs (e.g., by the
3580     <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
3581     specified port, or to the port number given in the client's request.
3582     </p>
3583
3584     <div class="warning">
3585     <p>Failure to set <code class="directive">ServerName</code> to a name that
3586     your server can resolve to an IP address will result in a startup
3587     warning. <code>httpd</code> will then use whatever hostname it can
3588     determine, using the system's <code>hostname</code> command. This
3589     will almost never be the hostname you actually want.</p>
3590     <div class="example"><p><code>
3591     httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3592     </code></p></div>
3593     </div>
3594
3595
3596 <h3>See also</h3>
3597 <ul>
3598 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3599     Apache HTTP Server</a></li>
3600 <li><a href="../vhosts/">Apache HTTP Server virtual host
3601     documentation</a></li>
3602 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3603 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3604 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
3605 </ul>
3606 </div>
3607 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3608 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
3609 <table class="directive">
3610 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
3611 is accessed by an incompatible browser</td></tr>
3612 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
3613 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3614 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3615 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3616 </table>
3617     <p>The <code class="directive">ServerPath</code> directive sets the legacy
3618     URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
3619
3620 <h3>See also</h3>
3621 <ul>
3622 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
3623 </ul>
3624 </div>
3625 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3626 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
3627 <table class="directive">
3628 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
3629 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
3630 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
3631 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3632 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3633 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3634 </table>
3635     <p>The <code class="directive">ServerRoot</code> directive sets the
3636     directory in which the server lives. Typically it will contain the
3637     subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3638     paths in other configuration directives (such as <code class="directive"><a href="#include">Include</a></code> or <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>, for example) are taken as
3639     relative to this directory.</p>
3640
3641     <div class="example"><h3>Example</h3><p><code>
3642       ServerRoot /home/httpd
3643     </code></p></div>
3644
3645
3646 <h3>See also</h3>
3647 <ul>
3648 <li><a href="../invoking.html">the <code>-d</code>
3649     option to <code>httpd</code></a></li>
3650 <li><a href="../misc/security_tips.html#serverroot">the
3651     security tips</a> for information on how to properly set
3652     permissions on the <code class="directive">ServerRoot</code></li>
3653 </ul>
3654 </div>
3655 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3656 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
3657 <table class="directive">
3658 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
3659 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
3660 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
3661 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3662 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3663 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3664 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3665 </table>
3666     <p>The <code class="directive">ServerSignature</code> directive allows the
3667     configuration of a trailing footer line under server-generated
3668     documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
3669     listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
3670     would want to enable such a footer line is that in a chain of proxies,
3671     the user often has no possibility to tell which of the chained servers
3672     actually produced a returned error message.</p>
3673
3674     <p>The <code>Off</code>
3675     setting, which is the default, suppresses the footer line (and is
3676     therefore compatible with the behavior of Apache-1.2 and
3677     below). The <code>On</code> setting simply adds a line with the
3678     server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
3679     and the <code>EMail</code> setting additionally creates a
3680     "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
3681     document.</p>
3682
3683     <p>After version 2.0.44, the details of the server version number
3684     presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
3685
3686 <h3>See also</h3>
3687 <ul>
3688 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
3689 </ul>
3690 </div>
3691 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3692 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
3693 <table class="directive">
3694 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
3695 header</td></tr>
3696 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full</code></td></tr>
3697 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
3698 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3699 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3700 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3701 </table>
3702     <p>This directive controls whether <code>Server</code> response
3703     header field which is sent back to clients includes a
3704     description of the generic OS-type of the server as well as
3705     information about compiled-in modules.</p>
3706
3707     <dl>
3708       <dt><code>ServerTokens Full</code> (or not specified)</dt>
3709
3710       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3711       (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3712
3713       <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3714
3715       <dd>Server sends (<em>e.g.</em>): <code>Server:
3716       Apache</code></dd>
3717
3718       <dt><code>ServerTokens Major</code></dt>
3719
3720       <dd>Server sends (<em>e.g.</em>): <code>Server:
3721       Apache/2</code></dd>
3722
3723       <dt><code>ServerTokens Minor</code></dt>
3724
3725       <dd>Server sends (<em>e.g.</em>): <code>Server:
3726       Apache/2.4</code></dd>
3727
3728       <dt><code>ServerTokens Min[imal]</code></dt>
3729
3730       <dd>Server sends (<em>e.g.</em>): <code>Server:
3731       Apache/2.4.1</code></dd>
3732
3733       <dt><code>ServerTokens OS</code></dt>
3734
3735       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3736       (Unix)</code></dd>
3737
3738     </dl>
3739
3740     <p>This setting applies to the entire server, and cannot be
3741     enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3742
3743     <p>After version 2.0.44, this directive also controls the
3744     information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
3745
3746     <div class="note">Setting <code class="directive">ServerTokens</code> to less than
3747     <code>minimal</code> is not recommended because it makes it more
3748     difficult to debug interoperational problems. Also note that
3749     disabling the Server: header does nothing at all to make your
3750     server more secure; the idea of "security through obscurity"
3751     is a myth and leads to a false sense of safety.</div>
3752
3753
3754 <h3>See also</h3>
3755 <ul>
3756 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
3757 </ul>
3758 </div>
3759 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3760 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
3761 <table class="directive">
3762 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
3763 handler</td></tr>
3764 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
3765 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3766 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3767 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3768 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3769 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache httpd 2.0</td></tr>
3770 </table>
3771     <p>When placed into an <code>.htaccess</code> file or a
3772     <code class="directive"><a href="#directory">&lt;Directory&gt;</a></code> or
3773     <code class="directive"><a href="#location">&lt;Location&gt;</a></code>
3774     section, this directive forces all matching files to be parsed
3775     through the <a href="../handler.html">handler</a> given by
3776     <var>handler-name</var>. For example, if you had a directory you
3777     wanted to be parsed entirely as imagemap rule files, regardless
3778     of extension, you might put the following into an
3779     <code>.htaccess</code> file in that directory:</p>
3780
3781     <div class="example"><p><code>
3782       SetHandler imap-file
3783     </code></p></div>
3784
3785     <p>Another example: if you wanted to have the server display a
3786     status report whenever a URL of
3787     <code>http://servername/status</code> was called, you might put
3788     the following into <code>httpd.conf</code>:</p>
3789
3790     <div class="example"><p><code>
3791       &lt;Location /status&gt;<br />
3792       <span class="indent">
3793         SetHandler server-status<br />
3794       </span>
3795       &lt;/Location&gt;
3796     </code></p></div>
3797
3798     <p>You can override an earlier defined <code class="directive">SetHandler</code>
3799     directive by using the value <code>None</code>.</p>
3800
3801     <div class="note"><h3>Note</h3>
3802     <p>Because <code class="directive">SetHandler</code> overrides default handlers,
3803     normal behaviour such as handling of URLs ending in a slash (/) as
3804     directories or index files is suppressed.</p></div>
3805
3806 <h3>See also</h3>
3807 <ul>
3808 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
3809 </ul>
3810 </div>
3811 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3812 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
3813 <table class="directive">
3814 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
3815 input</td></tr>
3816 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
3817 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3818 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3819 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3820 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3821 </table>
3822     <p>The <code class="directive">SetInputFilter</code> directive sets the
3823     filter or filters which will process client requests and POST
3824     input when they are received by the server. This is in addition to
3825     any filters defined elsewhere, including the
3826     <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
3827     directive.</p>
3828
3829     <p>If more than one filter is specified, they must be separated
3830     by semicolons in the order in which they should process the
3831     content.</p>
3832
3833 <h3>See also</h3>
3834 <ul>
3835 <li><a href="../filter.html">Filters</a> documentation</li>
3836 </ul>
3837 </div>
3838 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3839 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
3840 <table class="directive">
3841 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
3842 server</td></tr>
3843 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
3844 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3845 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3846 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3847 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3848 </table>
3849     <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
3850     which will process responses from the server before they are
3851     sent to the client. This is in addition to any filters defined
3852     elsewhere, including the
3853     <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
3854     directive.</p>
3855
3856     <p>For example, the following configuration will process all files
3857     in the <code>/www/data/</code> directory for server-side
3858     includes.</p>
3859
3860     <div class="example"><p><code>
3861       &lt;Directory /www/data/&gt;<br />
3862       <span class="indent">
3863         SetOutputFilter INCLUDES<br />
3864       </span>
3865       &lt;/Directory&gt;
3866     </code></p></div>
3867
3868     <p>If more than one filter is specified, they must be separated
3869     by semicolons in the order in which they should process the
3870     content.</p>
3871
3872 <h3>See also</h3>
3873 <ul>
3874 <li><a href="../filter.html">Filters</a> documentation</li>
3875 </ul>
3876 </div>
3877 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3878 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
3879 <table class="directive">
3880 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
3881 certain events before failing a request</td></tr>
3882 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
3883 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 300</code></td></tr>
3884 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3885 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3886 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3887 </table>
3888     <p>The <code class="directive">TimeOut</code> directive defines the length
3889     of time Apache httpd will wait for I/O in various circumstances:</p>
3890
3891     <ol>
3892       <li>When reading data from the client, the length of time to
3893       wait for a TCP packet to arrive if the read buffer is
3894       empty.</li>
3895
3896       <li>When writing data to the client, the length of time to wait
3897       for an acknowledgement of a packet if the send buffer is
3898       full.</li>
3899
3900       <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, the length of time to wait for
3901       output from a CGI script.</li>
3902
3903       <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
3904       wait for output from a filtering process.</li>
3905
3906       <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
3907       <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
3908       configured.</li>
3909     </ol>
3910
3911
3912 </div>
3913 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3914 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
3915 <table class="directive">
3916 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behaviour on <code>TRACE</code> requests</td></tr>
3917 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
3918 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
3919 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3920 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3921 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3922 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</td></tr>
3923 </table>
3924     <p>This directive overrides the behavior of <code>TRACE</code> for both
3925     the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>.  The default
3926     <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3927     RFC 2616, which disallows any request body to accompany the request.
3928     <code>TraceEnable off</code> causes the core server and
3929     <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
3930     allowed) error to the client.</p>
3931
3932     <p>Finally, for testing and diagnostic purposes only, request
3933     bodies may be allowed using the non-compliant <code>TraceEnable
3934     extended</code> directive.  The core (as an origin server) will
3935     restrict the request body to 64k (plus 8k for chunk headers if
3936     <code>Transfer-Encoding: chunked</code> is used).  The core will
3937     reflect the full headers and all chunk headers with the response
3938     body.  As a proxy server, the request body is not restricted to 64k.</p>
3939
3940 </div>
3941 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3942 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
3943 <table class="directive">
3944 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
3945 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
3946 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3947 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3948 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3949 </table>
3950     <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
3951     of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
3952     <p>This directive can be used to toggle the use of <code class="directive"><a href="#ifdefine">&lt;IfDefine&gt;</a></code> sections without needing to alter
3953     <code>-D</code> arguments in any startup scripts.</p>
3954
3955 </div>
3956 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3957 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
3958 <table class="directive">
3959 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3960 port</td></tr>
3961 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
3962 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
3963 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3964 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3965 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3966 </table>
3967     <p>In many situations Apache httpd must construct a <em>self-referential</em>
3968     URL -- that is, a URL that refers back to the same server. With
3969     <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
3970     specified in the <code class="directive"><a href="#servername">ServerName</a></code>
3971     directive to construct the canonical name for the server. This name
3972     is used in all self-referential URLs, and for the values of
3973     <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3974
3975     <p>With <code>UseCanonicalName Off</code> Apache httpd will form
3976     self-referential URLs using the hostname and port supplied by
3977     the client if any are supplied (otherwise it will use the
3978     canonical name, as defined above). These values are the same
3979     that are used to implement <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
3980     and are available with the same clients. The CGI variables
3981     <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3982     constructed from the client supplied values as well.</p>
3983
3984     <p>An example where this may be useful is on an intranet server
3985     where you have users connecting to the machine using short
3986     names such as <code>www</code>. You'll notice that if the users
3987     type a shortname, and a URL which is a directory, such as
3988     <code>http://www/splat</code>, <em>without the trailing
3989     slash</em> then Apache httpd will redirect them to
3990     <code>http://www.example.com/splat/</code>. If you have
3991     authentication enabled, this will cause the user to have to
3992     authenticate twice (once for <code>www</code> and once again
3993     for <code>www.example.com</code> -- see <a href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3994     FAQ on this subject for more information</a>). But if
3995     <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
3996     Apache httpd will redirect to <code>http://www/splat/</code>.</p>
3997
3998     <p>There is a third option, <code>UseCanonicalName DNS</code>,
3999     which is intended for use with mass IP-based virtual hosting to
4000     support ancient clients that do not provide a
4001     <code>Host:</code> header. With this option Apache httpd does a
4002     reverse DNS lookup on the server IP address that the client
4003     connected to in order to work out self-referential URLs.</p>
4004
4005     <div class="warning"><h3>Warning</h3>
4006     <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
4007     they may be broken by this option. The client is essentially free
4008     to give whatever value they want as a hostname. But if the CGI is
4009     only using <code>SERVER_NAME</code> to construct self-referential URLs
4010     then it should be just fine.</p>
4011     </div>
4012
4013 <h3>See also</h3>
4014 <ul>
4015 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4016 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4017 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4018 </ul>
4019 </div>
4020 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4021 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
4022 <table class="directive">
4023 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own port</td></tr>
4024 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
4025 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
4026 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4027 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4028 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4029 </table>
4030     <p>In many situations Apache httpd must construct a <em>self-referential</em>
4031     URL -- that is, a URL that refers back to the same server. With
4032     <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
4033     constructing the canonical port for the server to honor
4034     the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
4035     provide the actual physical port number being used by this request
4036     as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
4037     Apache httpd will not ever use the actual physical port number, instead
4038     relying on all configured information to construct a valid port number.</p>
4039
4040     <div class="note"><h3>Note</h3>
4041     <p>The ordering of the lookup when the physical port is used is as
4042     follows:</p>
4043      <dl>
4044      <dt><code>UseCanonicalName On</code></dt>
4045      <dd>
4046      <ol>
4047       <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4048       <li>Physical port</li>
4049       <li>Default port</li>
4050      </ol>
4051      </dd>
4052      <dt><code>UseCanonicalName Off | DNS</code></dt>
4053      <dd>
4054      <ol>
4055       <li>Parsed port from <code>Host:</code> header</li>
4056       <li>Physical port</li>
4057       <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4058       <li>Default port</li>
4059      </ol>
4060      </dd>
4061      </dl>
4062
4063     <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4064     physical ports are removed from the ordering.</p>
4065     </div>
4066
4067
4068 <h3>See also</h3>
4069 <ul>
4070 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4071 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4072 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4073 </ul>
4074 </div>
4075 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4076 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost">&lt;VirtualHost&gt;</a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
4077 <table class="directive">
4078 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
4079 hostname or IP address</td></tr>
4080 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;VirtualHost
4081     <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4082     ...&gt; ... &lt;/VirtualHost&gt;</code></td></tr>
4083 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4084 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4085 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4086 </table>
4087     <p><code class="directive">&lt;VirtualHost&gt;</code> and
4088     <code>&lt;/VirtualHost&gt;</code> are used to enclose a group of
4089     directives that will apply only to a particular virtual host. Any
4090     directive that is allowed in a virtual host context may be
4091     used. When the server receives a request for a document on a
4092     particular virtual host, it uses the configuration directives
4093     enclosed in the <code class="directive">&lt;VirtualHost&gt;</code>
4094     section. <var>Addr</var> can be any of the following, optionally followed by
4095     a colon and a port number (or *):</p>
4096
4097     <ul>
4098       <li>The IP address of the virtual host;</li>
4099
4100       <li>A fully qualified domain name for the IP address of the
4101       virtual host (not recommended);</li>
4102
4103       <li>The character <code>*</code>, which acts as a wildcard and matches 
4104       any IP address.</li>
4105   
4106       <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4107
4108     </ul>
4109
4110     <div class="example"><h3>Example</h3><p><code>
4111       &lt;VirtualHost 10.1.2.3:80&gt;<br />
4112       <span class="indent">
4113         ServerAdmin webmaster@host.example.com<br />
4114         DocumentRoot /www/docs/host.example.com<br />
4115         ServerName host.example.com<br />
4116         ErrorLog logs/host.example.com-error_log<br />
4117         TransferLog logs/host.example.com-access_log<br />
4118       </span>
4119       &lt;/VirtualHost&gt;
4120     </code></p></div>
4121
4122
4123     <p>IPv6 addresses must be specified in square brackets because
4124     the optional port number could not be determined otherwise.  An
4125     IPv6 example is shown below:</p>
4126
4127     <div class="example"><p><code>
4128       &lt;VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80&gt;<br />
4129       <span class="indent">
4130         ServerAdmin webmaster@host.example.com<br />
4131         DocumentRoot /www/docs/host.example.com<br />
4132         ServerName host.example.com<br />
4133         ErrorLog logs/host.example.com-error_log<br />
4134         TransferLog logs/host.example.com-access_log<br />
4135       </span>
4136       &lt;/VirtualHost&gt;
4137     </code></p></div>
4138
4139     <p>Each Virtual Host must correspond to a different IP address,
4140     different port number or a different host name for the server,
4141     in the former case the server machine must be configured to
4142     accept IP packets for multiple addresses. (If the machine does
4143     not have multiple network interfaces, then this can be
4144     accomplished with the <code>ifconfig alias</code> command -- if
4145     your OS supports it).</p>
4146
4147     <div class="note"><h3>Note</h3>
4148     <p>The use of <code class="directive">&lt;VirtualHost&gt;</code> does
4149     <strong>not</strong> affect what addresses Apache httpd listens on. You
4150     may need to ensure that Apache httpd is listening on the correct addresses
4151     using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
4152     </div>
4153
4154     <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
4155     specified inside each <code class="directive">&lt;VirtualHost&gt;</code> block. If it is absent, the
4156     <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
4157     server configuration will be inherited.</p>
4158
4159     <p>When a request is received, the server first maps it to the best matching 
4160     <code class="directive">&lt;VirtualHost&gt;</code> based on the local 
4161     IP address and port combination only.  Non-wildcards have a higher 
4162     precedence. If no match based on IP and port occurs at all, the 
4163     "main" server configuration is used.</p>
4164     
4165     <p>If multiple virtual hosts contain the best matching IP address and port,
4166     the server selects from these virtual hosts the best match based on the 
4167     requested hostname.  If no matching name-based virtual host is found, 
4168     then the first listed virtual host that matched the IP address will be 
4169     used.  As a consequence, the first listed virtual host for a given IP address
4170     and port combination is default virtual host for that IP and port 
4171     combination.</p>
4172
4173     <div class="warning"><h3>Security</h3>
4174     <p>See the <a href="../misc/security_tips.html">security tips</a>
4175     document for details on why your security could be compromised if the
4176     directory where log files are stored is writable by anyone other
4177     than the user that starts the server.</p>
4178     </div>
4179
4180 <h3>See also</h3>
4181 <ul>
4182 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4183 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4184     Apache HTTP Server</a></li>
4185 <li><a href="../bind.html">Setting
4186     which addresses and ports Apache HTTP Server uses</a></li>
4187 <li><a href="../sections.html">How &lt;Directory&gt;, &lt;Location&gt;
4188     and &lt;Files&gt; sections work</a> for an explanation of how these
4189     different sections are combined when a request is received</li>
4190 </ul>
4191 </div>
4192 </div>
4193 <div class="bottomlang">
4194 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
4195 <a href="../en/mod/core.html" title="English">&nbsp;en&nbsp;</a> |
4196 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
4197 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
4198 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
4199 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
4200 </div><div id="footer">
4201 <p class="apache">Copyright 2011 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
4202 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
4203 </body></html>