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
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>
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="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Core Features</h1>
24 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
25 <a href="../en/mod/core.html" title="English"> en </a> |
26 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
27 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
28 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
30 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
32 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
34 <div id="quickview"><h3 class="directives">Directives</h3>
36 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
37 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilterbytype">AddOutputFilterByType</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"><Directory></a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></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="#enablemmap">EnableMMAP</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#if"><If></a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
105 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
106 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
107 <table class="directive">
108 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
109 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
110 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
111 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
112 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
113 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1.5 and later.
114 On Windows from Apache 2.3.3 and later.</td></tr>
116 <p>This directive enables operating system specific optimizations for a
117 listening socket by the Protocol type. The basic premise is for the
118 kernel to not send a socket to the server process until either data
119 is received or an entire HTTP Request is buffered. Only
120 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
121 FreeBSD's Accept Filters</a>, Linux's more primitive
122 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
123 are currently supported.</p>
125 <p>Using <code>none</code> for an argument will disable any accept filters
126 for that protocol. This is useful for protocols that require a server
127 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
128 <div class="example"><p><code>AcceptFilter nntp none</code></p></div>
130 <p>The default values on FreeBSD are:</p>
131 <div class="example"><p><code>
132 AcceptFilter http httpready <br />
133 AcceptFilter https dataready
136 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
137 the kernel level. Once an entire request is received, the kernel then
138 sends it to the server. See the
139 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
140 accf_http(9)</a> man page for more details. Since HTTPS requests are
141 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
142 accf_data(9)</a> filter is used.</p>
144 <p>The default values on Linux are:</p>
145 <div class="example"><p><code>
146 AcceptFilter http data <br />
147 AcceptFilter https data
150 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
151 requests. Any value besides <code>none</code> will enable
152 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
154 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
155 tcp(7)</a> man page.</p>
157 <p>The default values on Windows are:</p>
158 <div class="example"><p><code>
159 AcceptFilter http data <br />
160 AcceptFilter https data
163 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
164 API, and does not support http protocol buffering. There are two values
165 which utilize the Windows AcceptEx() API and will recycle network
166 sockets between connections. <code>data</code> waits until data has
167 been transmitted as documented above, and the initial data buffer and
168 network endpoint addresses are all retrieved from the single AcceptEx()
169 invocation. <code>connect</code> will use the AcceptEx() API, also
170 retrieve the network endpoint addresses, but like <code>none</code>
171 the <code>connect</code> option does not wait for the initial data
174 <p>On Windows, <code>none</code> uses accept() rather than than AcceptEx()
175 and will not recycle sockets between connections. This is useful for
176 network adapters with broken driver support, as well as some virtual
177 network providers such as vpn drivers, or spam, virus or spyware
182 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
183 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
184 <table class="directive">
185 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
186 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
187 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
188 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
189 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
190 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
191 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
192 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.30 and later</td></tr>
195 <p>This directive controls whether requests that contain trailing
196 pathname information that follows an actual filename (or
197 non-existent file in an existing directory) will be accepted or
198 rejected. The trailing pathname information can be made
199 available to scripts in the <code>PATH_INFO</code> environment
202 <p>For example, assume the location <code>/test/</code> points to
203 a directory that contains only the single file
204 <code>here.html</code>. Then requests for
205 <code>/test/here.html/more</code> and
206 <code>/test/nothere.html/more</code> both collect
207 <code>/more</code> as <code>PATH_INFO</code>.</p>
209 <p>The three possible arguments for the
210 <code class="directive">AcceptPathInfo</code> directive are:</p>
212 <dt><code>Off</code></dt><dd>A request will only be accepted if it
213 maps to a literal path that exists. Therefore a request with
214 trailing pathname information after the true filename such as
215 <code>/test/here.html/more</code> in the above example will return
216 a 404 NOT FOUND error.</dd>
218 <dt><code>On</code></dt><dd>A request will be accepted if a
219 leading path component maps to a file that exists. The above
220 example <code>/test/here.html/more</code> will be accepted if
221 <code>/test/here.html</code> maps to a valid file.</dd>
223 <dt><code>Default</code></dt><dd>The treatment of requests with
224 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
225 The core handler for normal files defaults to rejecting
226 <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
227 <code>PATH_INFO</code> by default.</dd>
230 <p>The primary purpose of the <code>AcceptPathInfo</code>
231 directive is to allow you to override the handler's choice of
232 accepting or rejecting <code>PATH_INFO</code>. This override is required,
233 for example, when you use a <a href="../filter.html">filter</a>, such
234 as <a href="mod_include.html">INCLUDES</a>, to generate content
235 based on <code>PATH_INFO</code>. The core handler would usually reject
236 the request, so you can use the following configuration to enable
239 <div class="example"><p><code>
240 <Files "mypaths.shtml"><br />
241 <span class="indent">
242 Options +Includes<br />
243 SetOutputFilter INCLUDES<br />
244 AcceptPathInfo On<br />
251 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
252 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
253 <table class="directive">
254 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
255 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
256 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
257 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
258 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
259 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
261 <p>While processing a request the server looks for
262 the first existing configuration file from this list of names in
263 every directory of the path to the document, if distributed
264 configuration files are <a href="#allowoverride">enabled for that
265 directory</a>. For example:</p>
267 <div class="example"><p><code>
271 <p>before returning the document
272 <code>/usr/local/web/index.html</code>, the server will read
273 <code>/.acl</code>, <code>/usr/.acl</code>,
274 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
275 for directives, unless they have been disabled with</p>
277 <div class="example"><p><code>
278 <Directory /><br />
279 <span class="indent">
280 AllowOverride None<br />
287 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
288 <li><a href="../configuring.html">Configuration Files</a></li>
289 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
292 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
293 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
294 <table class="directive">
295 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
296 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
297 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
298 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
299 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
300 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
301 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
302 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
304 <p>This directive specifies a default value for the media type
305 charset parameter (the name of a character encoding) to be added
306 to a response if and only if the response's content-type is either
307 <code>text/plain</code> or <code>text/html</code>. This should override
308 any charset specified in the body of the response via a <code>META</code>
309 element, though the exact behavior is often dependent on the user's client
310 configuration. A setting of <code>AddDefaultCharset Off</code>
311 disables this functionality. <code>AddDefaultCharset On</code> enables
312 a default charset of <code>iso-8859-1</code>. Any other value is assumed
313 to be the <var>charset</var> to be used, which should be one of the
314 <a href="http://www.iana.org/assignments/character-sets">IANA registered
315 charset values</a> for use in Internet media types (MIME types).
318 <div class="example"><p><code>
319 AddDefaultCharset utf-8
322 <p><code class="directive">AddDefaultCharset</code> should only be used when all
323 of the text resources to which it applies are known to be in that
324 character encoding and it is too inconvenient to label their charset
325 individually. One such example is to add the charset parameter
326 to resources containing generated content, such as legacy CGI
327 scripts, that might be vulnerable to cross-site scripting attacks
328 due to user-provided data being included in the output. Note, however,
329 that a better solution is to just fix (or delete) those scripts, since
330 setting a default charset does not protect users that have enabled
331 the "auto-detect character encoding" feature on their browser.</p>
335 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
338 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
339 <div class="directive-section"><h2><a name="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2>
340 <table class="directive">
341 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular media-type</td></tr>
342 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
343 <var>media-type</var> [<var>media-type</var>] ...</code></td></tr>
344 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
345 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
346 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
347 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
348 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.33 and later; deprecated in Apache 2.1 and later</td></tr>
350 <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the
351 response <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a>. Because of certain
352 problems discussed below, this directive is deprecated. The same
353 functionality is available using <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>.</p>
355 <p>The following example uses the <code>DEFLATE</code> filter, which
356 is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all
357 output (either static or dynamic) which is labeled as
358 <code>text/html</code> or <code>text/plain</code> before it is sent
361 <div class="example"><p><code>
362 AddOutputFilterByType DEFLATE text/html text/plain
365 <p>If you want the content to be processed by more than one filter, their
366 names have to be separated by semicolons. It's also possible to use one
367 <code class="directive">AddOutputFilterByType</code> directive for each of
370 <p>The configuration below causes all script output labeled as
371 <code>text/html</code> to be processed at first by the
372 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
375 <div class="example"><p><code>
376 <Location /cgi-bin/><br />
377 <span class="indent">
378 Options Includes<br />
379 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
384 <div class="warning"><h3>Note</h3>
385 <p>Enabling filters with <code class="directive">AddOutputFilterByType</code>
386 may fail partially or completely in some cases. For example, no
387 filters are applied if the <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a> could not
388 be determined. If you want to make sure that the filters will be
389 applied, assign the content type to a resource explicitly; for
390 example, with <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> or
391 <code class="directive"><a href="#forcetype">ForceType</a></code>. Setting the
392 content type within a (non-nph) CGI script is also safe.</p>
398 <li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li>
399 <li><code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code></li>
400 <li><a href="../filter.html">filters</a></li>
403 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
404 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
405 <table class="directive">
406 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
407 be passed through</td></tr>
408 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off</code></td></tr>
409 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
410 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
411 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
412 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
413 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.46 and later</td></tr>
415 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
416 which contain encoded path separators (<code>%2F</code> for <code>/</code>
417 and additionally <code>%5C</code> for <code>\</code> on according systems)
418 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
420 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
421 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
423 <div class="note"><h3>Note</h3>
424 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
425 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
426 according systems) will be left as such in the otherwise decoded URL
432 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
435 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
436 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
437 <table class="directive">
438 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
439 <code>.htaccess</code> files</td></tr>
440 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
441 [<var>directive-type</var>] ...</code></td></tr>
442 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride All</code></td></tr>
443 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
444 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
445 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
447 <p>When the server finds an <code>.htaccess</code> file (as
448 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
449 it needs to know which directives declared in that file can override
450 earlier configuration directives.</p>
452 <div class="note"><h3>Only available in <Directory> sections</h3>
453 <code class="directive">AllowOverride</code> is valid only in
454 <code class="directive"><a href="#directory"><Directory></a></code>
455 sections specified without regular expressions, not in <code class="directive"><a href="#location"><Location></a></code>, <code class="directive"><a href="#directorymatch"><DirectoryMatch></a></code> or
456 <code class="directive"><a href="#files"><Files></a></code> sections.
459 <p>When this directive is set to <code>None</code>, then
460 <a href="#accessfilename">.htaccess</a> files are completely ignored.
461 In this case, the server will not even attempt to read
462 <code>.htaccess</code> files in the filesystem.</p>
464 <p>When this directive is set to <code>All</code>, then any
465 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
466 <code>.htaccess</code> files.</p>
468 <p>The <var>directive-type</var> can be one of the following
469 groupings of directives.</p>
476 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
477 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
478 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
479 <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
480 <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>
485 Allow use of the directives controlling document types
486 (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
487 <code class="directive"><a href="#forcetype">ForceType</a></code>,
488 <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
489 <code class="directive"><a href="#sethandler">SetHandler</a></code>,
490 <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
491 <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
492 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
493 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>),
494 <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
495 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
496 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
502 Allow use of the directives controlling directory indexing
503 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
504 <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>,
505 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
506 <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>,
512 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>
514 <dt>Options[=<var>Option</var>,...]</dt>
517 Allow use of the directives controlling specific directory
518 features (<code class="directive"><a href="#options">Options</a></code> and
519 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
520 An equal sign may be given followed by a comma (but no spaces)
521 separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.</dd>
526 <div class="example"><p><code>
527 AllowOverride AuthConfig Indexes
530 <p>In the example above all directives that are neither in the group
531 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
534 <div class="note"><p>For security and performance reasons, do not set
535 <code>AllowOverride</code> to anything other than <code>None</code>
536 in your <code><Directory /></code> block. Instead, find (or
537 create) the <code><Directory></code> block that refers to the
538 directory where you're actually planning to place a
539 <code>.htaccess</code> file.</p>
544 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
545 <li><a href="../configuring.html">Configuration Files</a></li>
546 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
549 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
550 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
551 <table class="directive">
552 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
554 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
555 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
556 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
557 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
558 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
559 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
561 <p>This directive is used to control how Apache finds the
562 interpreter used to run CGI scripts. For example, setting
563 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
564 cause all CGI script files with a <code>.foo</code> extension to
565 be passed to the FOO interpreter.</p>
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="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
570 <table class="directive">
571 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
573 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
574 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
575 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
576 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
577 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
578 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
580 <p>This directive enables the generation of
581 <code>Content-MD5</code> headers as defined in RFC1864
582 respectively RFC2616.</p>
584 <p>MD5 is an algorithm for computing a "message digest"
585 (sometimes called "fingerprint") of arbitrary-length data, with
586 a high degree of confidence that any alterations in the data
587 will be reflected in alterations in the message digest.</p>
589 <p>The <code>Content-MD5</code> header provides an end-to-end
590 message integrity check (MIC) of the entity-body. A proxy or
591 client may check this header for detecting accidental
592 modification of the entity-body in transit. Example header:</p>
594 <div class="example"><p><code>
595 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
598 <p>Note that this can cause performance problems on your server
599 since the message digest is computed on every request (the
600 values are not cached).</p>
602 <p><code>Content-MD5</code> is only sent for documents served
603 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
604 SSI documents, output from CGI scripts, and byte range responses
605 do not have this header.</p>
608 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
609 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
610 <table class="directive">
611 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
612 if the value is not <code>none</code>. In prior versions, DefaultType
613 would specify a default media type to assign to response content for
614 which no other media type configuration could be found.
616 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
617 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
618 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
619 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
620 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
621 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
622 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The argument <code>none</code> is available in Apache 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.</td></tr>
624 <p>This directive has been disabled. For backwards compatibility
625 of configuration files, it may be specified with the value
626 <code>none</code>, meaning no default media type. For example:</p>
628 <div class="example"><p><code>
632 <p><code>DefaultType None</code> is only available in
633 httpd-2.2.7 and later.</p>
635 <p>Use the mime.types configuration file and the
636 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
637 type assignments via file extensions, or the
638 <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
639 the media type for specific resources. Otherwise, the server will
640 send the response without a Content-Type header field and the
641 recipient may attempt to guess the media type.</p>
644 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
645 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
646 <table class="directive">
647 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define the existence of a variable</td></tr>
648 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Define <var>parameter-name</var></code></td></tr>
649 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
650 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
651 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
653 <p>Equivalent to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
654 <p>This directive can be used to toggle the use of <code class="directive"><a href="#ifdefine"><IfDefine></a></code> sections without needing to alter
655 <code>-D</code> arguments in any startup scripts.</p>
658 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
659 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
660 <table class="directive">
661 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
662 named file-system directory and sub-directories</td></tr>
663 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
664 ... </Directory></code></td></tr>
665 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
666 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
667 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
669 <p><code class="directive"><Directory></code> and
670 <code></Directory></code> are used to enclose a group of
671 directives that will apply only to the named directory and
672 sub-directories of that directory. Any directive that is allowed
673 in a directory context may be used. <var>Directory-path</var> is
674 either the full path to a directory, or a wild-card string using
675 Unix shell-style matching. In a wild-card string, <code>?</code> matches
676 any single character, and <code>*</code> matches any sequences of
677 characters. You may also use <code>[]</code> character ranges. None
678 of the wildcards match a `/' character, so <code><Directory
679 /*/public_html></code> will not match
680 <code>/home/user/public_html</code>, but <code><Directory
681 /home/*/public_html></code> will match. Example:</p>
683 <div class="example"><p><code>
684 <Directory /usr/local/httpd/htdocs><br />
685 <span class="indent">
686 Options Indexes FollowSymLinks<br />
692 <p>Be careful with the <var>directory-path</var> arguments:
693 They have to literally match the filesystem path which Apache uses
694 to access the files. Directives applied to a particular
695 <code><Directory></code> will not apply to files accessed from
696 that same directory via a different path, such as via different symbolic
700 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
701 expressions</a> can also be used, with the addition of the
702 <code>~</code> character. For example:</p>
704 <div class="example"><p><code>
705 <Directory ~ "^/www/.*/[0-9]{3}">
708 <p>would match directories in <code>/www/</code> that consisted of
711 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
712 match the directory (or one of its parents) containing a document,
713 then the directives are applied in the order of shortest match
714 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
717 <div class="example"><p><code>
718 <Directory /><br />
719 <span class="indent">
720 AllowOverride None<br />
722 </Directory><br />
724 <Directory /home/><br />
725 <span class="indent">
726 AllowOverride FileInfo<br />
731 <p>for access to the document <code>/home/web/dir/doc.html</code>
735 <li>Apply directive <code>AllowOverride None</code>
736 (disabling <code>.htaccess</code> files).</li>
738 <li>Apply directive <code>AllowOverride FileInfo</code> (for
739 directory <code>/home</code>).</li>
741 <li>Apply any <code>FileInfo</code> directives in
742 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
743 <code>/home/web/dir/.htaccess</code> in that order.</li>
746 <p>Regular expressions are not considered until after all of the
747 normal sections have been applied. Then all of the regular
748 expressions are tested in the order they appeared in the
749 configuration file. For example, with</p>
751 <div class="example"><p><code>
752 <Directory ~ abc$><br />
753 <span class="indent">
754 # ... directives here ...<br />
759 <p>the regular expression section won't be considered until after
760 all normal <code class="directive"><Directory></code>s and
761 <code>.htaccess</code> files have been applied. Then the regular
762 expression will match on <code>/home/abc/public_html/abc</code> and
763 the corresponding <code class="directive"><Directory></code> will
766 <p><strong>Note that the default Apache access for
767 <code><Directory /></code> is <code>Allow from All</code>.
768 This means that Apache will serve any file mapped from an URL. It is
769 recommended that you change this with a block such
772 <div class="example"><p><code>
773 <Directory /><br />
774 <span class="indent">
775 Order Deny,Allow<br />
781 <p><strong>and then override this for directories you
782 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
783 details.</strong></p>
785 <p>The directory sections occur in the <code>httpd.conf</code> file.
786 <code class="directive"><Directory></code> directives
787 cannot nest, and cannot appear in a <code class="directive"><a href="#limit"><Limit></a></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section.</p>
791 <li><a href="../sections.html">How <Directory>,
792 <Location> and <Files> sections work</a> for an
793 explanation of how these different sections are combined when a
794 request is received</li>
797 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
798 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
799 <table class="directive">
800 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
801 file-system directories matching a regular expression and their
802 subdirectories</td></tr>
803 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
804 ... </DirectoryMatch></code></td></tr>
805 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
806 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
807 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
809 <p><code class="directive"><DirectoryMatch></code> and
810 <code></DirectoryMatch></code> are used to enclose a group
811 of directives which will apply only to the named directory and
812 sub-directories of that directory, the same as <code class="directive"><a href="#directory"><Directory></a></code>. However, it
813 takes as an argument a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
814 expression</a>. For example:</p>
816 <div class="example"><p><code>
817 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
820 <p>would match directories in <code>/www/</code> that consisted of three
825 <li><code class="directive"><a href="#directory"><Directory></a></code> for
826 a description of how regular expressions are mixed in with normal
827 <code class="directive"><Directory></code>s</li>
828 <li><a href="../sections.html">How <Directory>, <Location> and
829 <Files> sections work</a> for an explanation of how these different
830 sections are combined when a request is received</li>
833 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
834 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
835 <table class="directive">
836 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
837 from the web</td></tr>
838 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
839 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
840 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
841 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
842 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
844 <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
845 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
846 path from the requested URL to the document root to make the
847 path to the document. Example:</p>
849 <div class="example"><p><code>
850 DocumentRoot /usr/web
854 <code>http://www.my.host.com/index.html</code> refers to
855 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
856 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
858 <p>The <code class="directive">DocumentRoot</code> should be specified without
859 a trailing slash.</p>
863 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
867 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
868 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
869 <table class="directive">
870 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
871 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
872 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
873 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
874 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
875 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
876 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
878 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
879 memory-mapping if it needs to read the contents of a file during
880 delivery. By default, when the handling of a request requires
881 access to the data within a file -- for example, when delivering a
882 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache
883 memory-maps the file if the OS supports it.</p>
885 <p>This memory-mapping sometimes yields a performance improvement.
886 But in some environments, it is better to disable the memory-mapping
887 to prevent operational problems:</p>
890 <li>On some multiprocessor systems, memory-mapping can reduce the
891 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
892 <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
893 has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
894 crash with a segmentation fault.
898 <p>For server configurations that are vulnerable to these problems,
899 you should disable memory-mapping of delivered files by specifying:</p>
901 <div class="example"><p><code>
905 <p>For NFS mounted files, this feature may be disabled explicitly for
906 the offending files by specifying:</p>
908 <div class="example"><p><code>
909 <Directory "/path-to-nfs-files">
910 <span class="indent">
917 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
918 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
919 <table class="directive">
920 <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>
921 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
922 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile On</code></td></tr>
923 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
924 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
925 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
926 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
927 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later</td></tr>
929 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
930 sendfile support from the kernel to transmit file contents to the client.
931 By default, when the handling of a request requires no access
932 to the data within a file -- for example, when delivering a
933 static file -- Apache uses sendfile to deliver the file contents
934 without ever reading the file if the OS supports it.</p>
936 <p>This sendfile mechanism avoids separate read and send operations,
937 and buffer allocations. But on some platforms or within some
938 filesystems, it is better to disable this feature to avoid
939 operational problems:</p>
942 <li>Some platforms may have broken sendfile support that the build
943 system did not detect, especially if the binaries were built on
944 another box and moved to such a machine with broken sendfile
946 <li>On Linux the use of sendfile triggers TCP-checksum
947 offloading bugs on certain networking cards when using IPv6.</li>
948 <li>On Linux on Itanium, sendfile may be unable to handle files
949 over 2GB in size.</li>
950 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS or SMB),
951 the kernel may be unable to serve the network file through
955 <p>For server configurations that are vulnerable to these problems,
956 you should disable this feature by specifying:</p>
958 <div class="example"><p><code>
962 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
963 for the offending files by specifying:</p>
965 <div class="example"><p><code>
966 <Directory "/path-to-nfs-files">
967 <span class="indent">
972 <p>Please note that the per-directory and .htaccess configuration
973 of <code class="directive">EnableSendfile</code> is not supported by
974 <code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code>.
975 Only global definition of <code class="directive">EnableSendfile</code>
976 is taken into account by the module.
980 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
981 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
982 <table class="directive">
983 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
984 in case of an error</td></tr>
985 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
986 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
987 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
988 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
989 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
990 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Quoting syntax for text messages is different in Apache
993 <p>In the event of a problem or error, Apache can be configured
994 to do one of four things,</p>
997 <li>output a simple hardcoded error message</li>
999 <li>output a customized message</li>
1001 <li>redirect to a local <var>URL-path</var> to handle the
1004 <li>redirect to an external <var>URL</var> to handle the
1008 <p>The first option is the default, while options 2-4 are
1009 configured using the <code class="directive">ErrorDocument</code>
1010 directive, which is followed by the HTTP response code and a URL
1011 or a message. Apache will sometimes offer additional information
1012 regarding the problem/error.</p>
1014 <p>URLs can begin with a slash (/) for local web-paths (relative
1015 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1016 full URL which the client can resolve. Alternatively, a message
1017 can be provided to be displayed by the browser. Examples:</p>
1019 <div class="example"><p><code>
1020 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
1021 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
1022 ErrorDocument 401 /subscription_info.html<br />
1023 ErrorDocument 403 "Sorry can't allow you access today"
1026 <p>Additionally, the special value <code>default</code> can be used
1027 to specify Apache's simple hardcoded message. While not required
1028 under normal circumstances, <code>default</code> will restore
1029 Apache's simple hardcoded message for configurations that would
1030 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1032 <div class="example"><p><code>
1033 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
1034 <Directory /web/docs><br />
1035 <span class="indent">
1036 ErrorDocument 404 default<br />
1041 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1042 that points to a remote URL (ie. anything with a method such as
1043 <code>http</code> in front of it), Apache will send a redirect to the
1044 client to tell it where to find the document, even if the
1045 document ends up being on the same server. This has several
1046 implications, the most important being that the client will not
1047 receive the original error status code, but instead will
1048 receive a redirect status code. This in turn can confuse web
1049 robots and other clients which try to determine if a URL is
1050 valid using the status code. In addition, if you use a remote
1051 URL in an <code>ErrorDocument 401</code>, the client will not
1052 know to prompt the user for a password since it will not
1053 receive the 401 status code. Therefore, <strong>if you use an
1054 <code>ErrorDocument 401</code> directive then it must refer to a local
1055 document.</strong></p>
1057 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1058 server-generated error messages when they are "too small" and substitute
1059 its own "friendly" error messages. The size threshold varies depending on
1060 the type of error, but in general, if you make your error document
1061 greater than 512 bytes, then MSIE will show the server-generated
1062 error rather than masking it. More information is available in
1063 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1065 <p>Although most error messages can be overriden, there are certain
1066 circumstances where the internal messages are used regardless of the
1067 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1068 particular, if a malformed request is detected, normal request processing
1069 will be immediately halted and the internal error message returned.
1070 This is necessary to guard against security problems caused by
1073 <p>If you are using mod_proxy, you may wish to enable
1074 <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1075 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1076 Apache will not generate custom error documents for proxied content.</p>
1080 <li><a href="../custom-error.html">documentation of
1081 customizable responses</a></li>
1084 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1085 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1086 <table class="directive">
1087 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1088 <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>
1089 <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>
1090 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1091 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1092 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1094 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1095 the file to which the server will log any errors it encounters. If
1096 the <var>file-path</var> is not absolute then it is assumed to be
1097 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1099 <div class="example"><h3>Example</h3><p><code>
1100 ErrorLog /var/log/httpd/error_log
1103 <p>If the <var>file-path</var>
1104 begins with a pipe (|) then it is assumed to be a command to spawn
1105 to handle the error log.</p>
1107 <div class="example"><h3>Example</h3><p><code>
1108 ErrorLog "|/usr/local/bin/httpd_errors"
1111 <p>Using <code>syslog</code> instead of a filename enables logging
1112 via syslogd(8) if the system supports it. The default is to use
1113 syslog facility <code>local7</code>, but you can override this by
1114 using the <code>syslog:<var>facility</var></code> syntax where
1115 <var>facility</var> can be one of the names usually documented in
1118 <div class="example"><h3>Example</h3><p><code>
1119 ErrorLog syslog:user
1122 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1123 document for details on why your security could be compromised
1124 if the directory where log files are stored is writable by
1125 anyone other than the user that starts the server.</p>
1126 <div class="warning"><h3>Note</h3>
1127 <p>When entering a file path on non-Unix platforms, care should be taken
1128 to make sure that only forward slashed are used even though the platform
1129 may allow the use of back slashes. In general it is a good idea to always
1130 use forward slashes throughout the configuration files.</p>
1135 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1136 <li><a href="../logs.html">Apache Log Files</a></li>
1139 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1140 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1141 <table class="directive">
1142 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1144 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1145 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1146 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1147 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1148 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1150 <p>This option tracks additional data per worker about the
1151 currently executing request, and a utilization summary; you
1152 can see these variables during runtime by configuring
1153 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>. Note that other modules may
1154 rely on this scoreboard.</p>
1156 <p>This setting applies to the entire server, and cannot be
1157 enabled or disabled on a virtualhost-by-virtualhost basis.
1158 The collection of extended status information can slow down
1159 the server. Also note that this setting cannot be changed
1160 during a graceful restart.</p>
1163 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1164 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1165 <table class="directive">
1166 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1167 HTTP response header for static files</td></tr>
1168 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1169 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag INode MTime Size</code></td></tr>
1170 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1171 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1172 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1173 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1176 The <code class="directive">FileETag</code> directive configures the file
1177 attributes that are used to create the <code>ETag</code> (entity
1178 tag) response header field when the document is based on a static file.
1179 (The <code>ETag</code> value is used in cache management to save
1180 network bandwidth.) In Apache 1.3.22 and earlier, the
1181 <code>ETag</code> value was <em>always</em> formed
1182 from the file's inode, size, and last-modified time (mtime). The
1183 <code class="directive">FileETag</code> directive allows you to choose
1184 which of these -- if any -- should be used. The recognized keywords are:
1188 <dt><strong>INode</strong></dt>
1189 <dd>The file's i-node number will be included in the calculation</dd>
1190 <dt><strong>MTime</strong></dt>
1191 <dd>The date and time the file was last modified will be included</dd>
1192 <dt><strong>Size</strong></dt>
1193 <dd>The number of bytes in the file will be included</dd>
1194 <dt><strong>All</strong></dt>
1195 <dd>All available fields will be used. This is equivalent to:
1196 <div class="example"><p><code>FileETag INode MTime Size</code></p></div></dd>
1197 <dt><strong>None</strong></dt>
1198 <dd>If a document is file-based, no <code>ETag</code> field will be
1199 included in the response</dd>
1202 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1203 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1204 which allow changes to be made to the default setting inherited
1205 from a broader scope. Any keyword appearing without such a prefix
1206 immediately and completely cancels the inherited setting.</p>
1208 <p>If a directory's configuration includes
1209 <code>FileETag INode MTime Size</code>, and a
1210 subdirectory's includes <code>FileETag -INode</code>,
1211 the setting for that subdirectory (which will be inherited by
1212 any sub-subdirectories that don't override it) will be equivalent to
1213 <code>FileETag MTime Size</code>.</p>
1214 <div class="warning"><h3>Warning</h3>
1215 Do not change the default for directories or locations that have WebDAV
1216 enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1217 <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>INode MTime Size</code>
1218 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1219 These conditional requests will break if the <code>ETag</code> format is
1220 changed via <code class="directive">FileETag</code>.
1222 <div class="note"><h3>Server Side Includes</h3>
1223 An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>,
1224 since the response entity can change without a change of the INode, MTime, or Size
1225 of the static file with embedded SSI directives.
1230 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1231 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1232 <table class="directive">
1233 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1235 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1236 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1237 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1241 <p>The <code class="directive"><Files></code> directive
1242 limits the scope of the enclosed directives by filename. It is comparable
1243 to the <code class="directive"><a href="#directory"><Directory></a></code>
1244 and <code class="directive"><a href="#location"><Location></a></code>
1245 directives. It should be matched with a <code></Files></code>
1246 directive. The directives given within this section will be applied to
1247 any object with a basename (last component of filename) matching the
1248 specified filename. <code class="directive"><Files></code>
1249 sections are processed in the order they appear in the
1250 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1251 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1252 that <code class="directive"><Files></code> can be nested
1253 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1254 portion of the filesystem they apply to.</p>
1256 <p>The <var>filename</var> argument should include a filename, or
1257 a wild-card string, where <code>?</code> matches any single character,
1258 and <code>*</code> matches any sequences of characters.
1259 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1260 can also be used, with the addition of the
1261 <code>~</code> character. For example:</p>
1263 <div class="example"><p><code>
1264 <Files ~ "\.(gif|jpe?g|png)$">
1267 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1270 <p>Note that unlike <code class="directive"><a href="#directory"><Directory></a></code> and <code class="directive"><a href="#location"><Location></a></code> sections, <code class="directive"><Files></code> sections can be used inside
1271 <code>.htaccess</code> files. This allows users to control access to
1272 their own files, at a file-by-file level.</p>
1277 <li><a href="../sections.html">How <Directory>, <Location>
1278 and <Files> sections work</a> for an explanation of how these
1279 different sections are combined when a request is received</li>
1282 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1283 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1284 <table class="directive">
1285 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1287 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1288 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1289 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1290 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1291 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1293 <p>The <code class="directive"><FilesMatch></code> directive
1294 limits the scope of the enclosed directives by filename, just as the
1295 <code class="directive"><a href="#files"><Files></a></code> directive
1296 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1297 expression</a>. For example:</p>
1299 <div class="example"><p><code>
1300 <FilesMatch "\.(gif|jpe?g|png)$">
1303 <p>would match most common Internet graphics formats.</p>
1307 <li><a href="../sections.html">How <Directory>, <Location>
1308 and <Files> sections work</a> for an explanation of how these
1309 different sections are combined when a request is received</li>
1312 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1313 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1314 <table class="directive">
1315 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1316 media type in the HTTP Content-Type header field</td></tr>
1317 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1318 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1319 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1320 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1321 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1322 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache 2.0</td></tr>
1324 <p>When placed into an <code>.htaccess</code> file or a
1325 <code class="directive"><a href="#directory"><Directory></a></code>, or
1326 <code class="directive"><a href="#location"><Location></a></code> or
1327 <code class="directive"><a href="#files"><Files></a></code>
1328 section, this directive forces all matching files to be served
1329 with the content type identification given by
1330 <var>media-type</var>. For example, if you had a directory full of
1331 GIF files, but did not want to label them all with <code>.gif</code>,
1332 you might want to use:</p>
1334 <div class="example"><p><code>
1338 <p>Note that this directive overrides other indirect media type
1339 associations defined in mime.types or via the
1340 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1342 <p>You can also override more general
1343 <code class="directive">ForceType</code> settings
1344 by using the value of <code>None</code>:</p>
1346 <div class="example"><p><code>
1347 # force all files to be image/gif:<br />
1348 <Location /images><br />
1349 <span class="indent">
1350 ForceType image/gif<br />
1352 </Location><br />
1354 # but normal mime-type associations here:<br />
1355 <Location /images/mixed><br />
1356 <span class="indent">
1357 ForceType None<br />
1363 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1364 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1365 <table class="directive">
1366 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1367 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1368 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1369 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1370 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1371 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1373 <p>This directive enables DNS lookups so that host names can be
1374 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1375 The value <code>Double</code> refers to doing double-reverse
1376 DNS lookup. That is, after a reverse lookup is performed, a forward
1377 lookup is then performed on that result. At least one of the IP
1378 addresses in the forward lookup must match the original
1379 address. (In "tcpwrappers" terminology this is called
1380 <code>PARANOID</code>.)</p>
1382 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1383 used for controlling access by hostname, a double reverse lookup
1384 will be performed. This is necessary for security. Note that the
1385 result of this double-reverse isn't generally available unless you
1386 set <code>HostnameLookups Double</code>. For example, if only
1387 <code>HostnameLookups On</code> and a request is made to an object
1388 that is protected by hostname restrictions, regardless of whether
1389 the double-reverse fails or not, CGIs will still be passed the
1390 single-reverse result in <code>REMOTE_HOST</code>.</p>
1392 <p>The default is <code>Off</code> in order to save the network
1393 traffic for those sites that don't truly need the reverse
1394 lookups done. It is also better for the end users because they
1395 don't have to suffer the extra latency that a lookup entails.
1396 Heavily loaded sites should leave this directive
1397 <code>Off</code>, since DNS lookups can take considerable
1398 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1399 default to the <code>bin</code> subdirectory of your installation
1400 directory, can be used to look up host names from logged IP addresses
1404 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1405 <div class="directive-section"><h2><a name="If" id="If"><If></a> <a name="if" id="if">Directive</a></h2>
1406 <table class="directive">
1407 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1408 satisfied by a request at runtime</td></tr>
1409 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><If <var>expression</var>> ... </If></code></td></tr>
1410 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1411 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1412 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1413 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1415 <p>The <code class="directive"><If></code> directive
1416 evaluates an expression at runtime, and applies the enclosed
1417 directives if and only if the expression evaluates to true.
1420 <div class="example"><p><code>
1421 <If "$req{Host} = ''">
1424 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1426 <p>You may compare the value of any variable in the request headers
1427 ($req), response headers ($resp) or environment ($env) in your
1432 <li><a href="../sections.html">How <Directory>, <Location>,
1433 <Files> sections work</a> for an explanation of how these
1434 different sections are combined when a request is received.
1435 <code class="directive"><If></code> has the same precedence
1436 and usage as <code class="directive"><Files></code></li>
1439 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1440 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1441 <table class="directive">
1442 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1443 if a test is true at startup</td></tr>
1444 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
1445 </IfDefine></code></td></tr>
1446 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1447 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1448 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1449 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1451 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1452 </code> section is used to mark directives that are conditional. The
1453 directives within an <code class="directive"><IfDefine></code>
1454 section are only processed if the <var>test</var> is true. If <var>
1455 test</var> is false, everything between the start and end markers is
1458 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
1461 <li><var>parameter-name</var></li>
1463 <li><code>!</code><var>parameter-name</var></li>
1466 <p>In the former case, the directives between the start and end
1467 markers are only processed if the parameter named
1468 <var>parameter-name</var> is defined. The second format reverses
1469 the test, and only processes the directives if
1470 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1472 <p>The <var>parameter-name</var> argument is a define as given on the
1473 <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
1474 </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
1476 <p><code class="directive"><IfDefine></code> sections are
1477 nest-able, which can be used to implement simple
1478 multiple-parameter tests. Example:</p>
1480 <div class="example"><p><code>
1481 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1484 <IfDefine ReverseProxy><br />
1485 <span class="indent">
1486 LoadModule proxy_module modules/mod_proxy.so<br />
1487 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1488 <IfDefine UseCache><br />
1489 <span class="indent">
1490 LoadModule cache_module modules/mod_cache.so<br />
1491 <IfDefine MemCache><br />
1492 <span class="indent">
1493 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1495 </IfDefine><br />
1496 <IfDefine !MemCache><br />
1497 <span class="indent">
1498 LoadModule disk_cache_module modules/mod_disk_cache.so<br />
1508 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1509 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
1510 <table class="directive">
1511 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
1512 presence or absence of a specific module</td></tr>
1513 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1514 </IfModule></code></td></tr>
1515 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1516 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1517 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1518 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1519 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Module identifiers are available in version 2.1 and
1522 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1523 section is used to mark directives that are conditional on the presence of
1524 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
1525 is true. If <var>test</var> is false, everything between the start and
1526 end markers is ignored.</p>
1528 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
1531 <li><var>module</var></li>
1533 <li>!<var>module</var></li>
1536 <p>In the former case, the directives between the start and end
1537 markers are only processed if the module named <var>module</var>
1538 is included in Apache -- either compiled in or
1539 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
1540 and only processes the directives if <var>module</var> is
1541 <strong>not</strong> included.</p>
1543 <p>The <var>module</var> argument can be either the module identifier or
1544 the file name of the module, at the time it was compiled. For example,
1545 <code>rewrite_module</code> is the identifier and
1546 <code>mod_rewrite.c</code> is the file name. If a module consists of
1547 several source files, use the name of the file containing the string
1548 <code>STANDARD20_MODULE_STUFF</code>.</p>
1550 <p><code class="directive"><IfModule></code> sections are
1551 nest-able, which can be used to implement simple multiple-module
1554 <div class="note">This section should only be used if you need to have one
1555 configuration file that works whether or not a specific module
1556 is available. In normal operation, directives need not be
1557 placed in <code class="directive"><IfModule></code>
1561 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1562 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
1563 <table class="directive">
1564 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
1565 the server configuration files</td></tr>
1566 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Include <var>file-path</var>|<var>directory-path</var></code></td></tr>
1567 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1568 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1569 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1570 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later</td></tr>
1572 <p>This directive allows inclusion of other configuration files
1573 from within the server configuration files.</p>
1575 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1576 include several files at once, in alphabetical order. In
1577 addition, if <code class="directive">Include</code> points to a directory,
1578 rather than a file, Apache will read all files in that directory
1579 and any subdirectory. However, including entire directories is not
1580 recommended, because it is easy to accidentally leave temporary
1581 files in a directory that can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1582 fail. Instead, we encourage you to use the wildcard syntax shown
1583 below, to include files that match a particular pattern, such as
1584 *.conf, for example.</p>
1586 <p>The file path specified may be an absolute path, or may be relative
1587 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
1591 <div class="example"><p><code>
1592 Include /usr/local/apache2/conf/ssl.conf<br />
1593 Include /usr/local/apache2/conf/vhosts/*.conf
1596 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
1598 <div class="example"><p><code>
1599 Include conf/ssl.conf<br />
1600 Include conf/vhosts/*.conf
1605 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
1608 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1609 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
1610 <table class="directive">
1611 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
1612 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
1613 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
1614 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1615 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1616 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1618 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1619 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1620 which allow multiple requests to be sent over the same TCP
1621 connection. In some cases this has been shown to result in an
1622 almost 50% speedup in latency times for HTML documents with
1623 many images. To enable Keep-Alive connections, set
1624 <code>KeepAlive On</code>.</p>
1626 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1627 used if they are specifically requested by a client. In
1628 addition, a Keep-Alive connection with an HTTP/1.0 client can
1629 only be used when the length of the content is known in
1630 advance. This implies that dynamic content such as CGI output,
1631 SSI pages, and server-generated directory listings will
1632 generally not use Keep-Alive connections to HTTP/1.0 clients.
1633 For HTTP/1.1 clients, persistent connections are the default
1634 unless otherwise specified. If the client requests it, chunked
1635 encoding will be used in order to send content of unknown
1636 length over persistent connections.</p>
1638 <p>When a client uses a Keep-Alive connection it will be counted
1639 as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code> directive, regardless
1640 of how many requests are sent using the connection.</p>
1644 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
1647 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1648 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
1649 <table class="directive">
1650 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
1651 requests on a persistent connection</td></tr>
1652 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
1653 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
1654 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1655 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1656 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1657 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Specifying a value in milliseconds is available in
1658 Apache 2.3.2 and later</td></tr>
1660 <p>The number of seconds Apache will wait for a subsequent
1661 request before closing the connection. By adding a postfix of ms the
1662 timeout can be also set in milliseconds. Once a request has been
1663 received, the timeout value specified by the
1664 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
1666 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
1667 may cause performance problems in heavily loaded servers. The
1668 higher the timeout, the more server processes will be kept
1669 occupied waiting on connections with idle clients.</p>
1671 <p>In a name-based virtual host context, the value of the first
1672 defined virtual host (the default host) in a set of <code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code> will be used.
1673 The other values will be ignored.</p>
1676 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1677 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
1678 <table class="directive">
1679 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
1681 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
1682 </Limit></code></td></tr>
1683 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1684 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
1685 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1686 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1688 <p>Access controls are normally effective for
1689 <strong>all</strong> access methods, and this is the usual
1690 desired behavior. <strong>In the general case, access control
1691 directives should not be placed within a
1692 <code class="directive"><Limit></code> section.</strong></p>
1694 <p>The purpose of the <code class="directive"><Limit></code>
1695 directive is to restrict the effect of the access controls to the
1696 nominated HTTP methods. For all other methods, the access
1697 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
1698 effect</strong>. The following example applies the access control
1699 only to the methods <code>POST</code>, <code>PUT</code>, and
1700 <code>DELETE</code>, leaving all other methods unprotected:</p>
1702 <div class="example"><p><code>
1703 <Limit POST PUT DELETE><br />
1704 <span class="indent">
1705 Require valid-user<br />
1710 <p>The method names listed can be one or more of: <code>GET</code>,
1711 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1712 <code>CONNECT</code>, <code>OPTIONS</code>,
1713 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1714 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1715 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1716 case-sensitive.</strong> If <code>GET</code> is used it will also
1717 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1718 cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
1720 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
1721 used in preference to a <code class="directive"><Limit></code>
1722 section when restricting access, since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
1723 against arbitrary methods.</div>
1725 <p>The <code class="directive"><Limit></code> and
1726 <code class="directive"><a href="#limitexcept"><LimitExcept></a></code>
1727 directives may be nested. In this case, each successive level of
1728 <code class="directive"><Limit></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> directives must
1729 further restrict the set of methods to which access controls apply.</p>
1731 <div class="warning">When using
1732 <code class="directive"><Limit></code> or
1733 <code class="directive"><LimitExcept></code> directives with
1734 the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
1735 note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
1736 to succeed authorizes the request, regardless of the presence of other
1737 <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
1739 <p>For example, given the following configuration, all users will
1740 be authorized for <code>POST</code> requests, and the
1741 <code>Require group editors</code> directive will be ignored
1744 <div class="example"><p><code>
1745 <LimitExcept GET>
1746 <span class="indent">
1749 </LimitExcept><br />
1751 <span class="indent">
1752 Require group editors
1758 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1759 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
1760 <table class="directive">
1761 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
1762 except the named ones</td></tr>
1763 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1764 </LimitExcept></code></td></tr>
1765 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1766 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
1767 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1768 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1770 <p><code class="directive"><LimitExcept></code> and
1771 <code></LimitExcept></code> are used to enclose
1772 a group of access control directives which will then apply to any
1773 HTTP access method <strong>not</strong> listed in the arguments;
1774 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
1775 both standard and nonstandard/unrecognized methods. See the
1776 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
1780 <div class="example"><p><code>
1781 <LimitExcept POST GET><br />
1782 <span class="indent">
1783 Require valid-user<br />
1785 </LimitExcept>
1790 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1791 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
1792 <table class="directive">
1793 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
1794 subrequests</td></tr>
1795 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
1796 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
1797 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1798 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1799 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1800 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.47 and later</td></tr>
1802 <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
1803 redirects the original request to a CGI script. A subrequest is Apache's
1804 mechanism to find out what would happen for some URI if it were requested.
1805 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
1806 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
1809 <p><code class="directive">LimitInternalRecursion</code> prevents the server
1810 from crashing when entering an infinite loop of internal redirects or
1811 subrequests. Such loops are usually caused by misconfigurations.</p>
1813 <p>The directive stores two different limits, which are evaluated on
1814 per-request basis. The first <var>number</var> is the maximum number of
1815 internal redirects, that may follow each other. The second <var>number</var>
1816 determines, how deep subrequests may be nested. If you specify only one
1817 <var>number</var>, it will be assigned to both limits.</p>
1819 <div class="example"><h3>Example</h3><p><code>
1820 LimitInternalRecursion 5
1824 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1825 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
1826 <table class="directive">
1827 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
1828 from the client</td></tr>
1829 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
1830 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
1831 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1832 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1833 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1834 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1836 <p>This directive specifies the number of <var>bytes</var> from 0
1837 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1840 <p>The <code class="directive">LimitRequestBody</code> directive allows
1841 the user to set a limit on the allowed size of an HTTP request
1842 message body within the context in which the directive is given
1843 (server, per-directory, per-file or per-location). If the client
1844 request exceeds that limit, the server will return an error
1845 response instead of servicing the request. The size of a normal
1846 request message body will vary greatly depending on the nature of
1847 the resource and the methods allowed on that resource. CGI scripts
1848 typically use the message body for retrieving form information.
1849 Implementations of the <code>PUT</code> method will require
1850 a value at least as large as any representation that the server
1851 wishes to accept for that resource.</p>
1853 <p>This directive gives the server administrator greater
1854 control over abnormal client request behavior, which may be
1855 useful for avoiding some forms of denial-of-service
1858 <p>If, for example, you are permitting file upload to a particular
1859 location, and wish to limit the size of the uploaded file to 100K,
1860 you might use the following directive:</p>
1862 <div class="example"><p><code>
1863 LimitRequestBody 102400
1868 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1869 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
1870 <table class="directive">
1871 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
1872 will be accepted from the client</td></tr>
1873 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
1874 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
1875 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1876 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1877 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1879 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1880 32767. The default value is defined by the compile-time
1881 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1884 <p>The <code class="directive">LimitRequestFields</code> directive allows
1885 the server administrator to modify the limit on the number of
1886 request header fields allowed in an HTTP request. A server needs
1887 this value to be larger than the number of fields that a normal
1888 client request might include. The number of request header fields
1889 used by a client rarely exceeds 20, but this may vary among
1890 different client implementations, often depending upon the extent
1891 to which a user has configured their browser to support detailed
1892 content negotiation. Optional HTTP extensions are often expressed
1893 using request header fields.</p>
1895 <p>This directive gives the server administrator greater
1896 control over abnormal client request behavior, which may be
1897 useful for avoiding some forms of denial-of-service attacks.
1898 The value should be increased if normal clients see an error
1899 response from the server that indicates too many fields were
1900 sent in the request.</p>
1904 <div class="example"><p><code>
1905 LimitRequestFields 50
1910 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1911 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
1912 <table class="directive">
1913 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
1915 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
1916 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
1917 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1918 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1919 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1921 <p>This directive specifies the number of <var>bytes</var>
1922 that will be allowed in an HTTP request header.</p>
1924 <p>The <code class="directive">LimitRequestFieldSize</code> directive
1925 allows the server administrator to reduce or increase the limit
1926 on the allowed size of an HTTP request header field. A server
1927 needs this value to be large enough to hold any one header field
1928 from a normal client request. The size of a normal request header
1929 field will vary greatly among different client implementations,
1930 often depending upon the extent to which a user has configured
1931 their browser to support detailed content negotiation. SPNEGO
1932 authentication headers can be up to 12392 bytes.</p>
1934 <p>This directive gives the server administrator greater
1935 control over abnormal client request behavior, which may be
1936 useful for avoiding some forms of denial-of-service attacks.</p>
1940 <div class="example"><p><code>
1941 LimitRequestFieldSize 4094
1944 <div class="note">Under normal conditions, the value should not be changed from
1949 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1950 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
1951 <table class="directive">
1952 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
1953 from the client</td></tr>
1954 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
1955 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
1956 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1957 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1958 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1960 <p>This directive sets the number of <var>bytes</var> that will be
1961 allowed on the HTTP request-line.</p>
1963 <p>The <code class="directive">LimitRequestLine</code> directive allows
1964 the server administrator to reduce or increase the limit on the allowed size
1965 of a client's HTTP request-line. Since the request-line consists of the
1966 HTTP method, URI, and protocol version, the
1967 <code class="directive">LimitRequestLine</code> directive places a
1968 restriction on the length of a request-URI allowed for a request
1969 on the server. A server needs this value to be large enough to
1970 hold any of its resource names, including any information that
1971 might be passed in the query part of a <code>GET</code> request.</p>
1973 <p>This directive gives the server administrator greater
1974 control over abnormal client request behavior, which may be
1975 useful for avoiding some forms of denial-of-service attacks.</p>
1979 <div class="example"><p><code>
1980 LimitRequestLine 4094
1983 <div class="note">Under normal conditions, the value should not be changed from
1987 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1988 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
1989 <table class="directive">
1990 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
1991 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
1992 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
1993 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1994 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1995 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1996 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1998 <p>Limit (in bytes) on maximum size of an XML-based request
1999 body. A value of <code>0</code> will disable any checking.</p>
2003 <div class="example"><p><code>
2004 LimitXMLRequestBody 0
2009 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2010 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
2011 <table class="directive">
2012 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2014 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
2015 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
2016 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2017 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2018 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2020 <p>The <code class="directive"><Location></code> directive
2021 limits the scope of the enclosed directives by URL. It is similar to the
2022 <code class="directive"><a href="#directory"><Directory></a></code>
2023 directive, and starts a subsection which is terminated with a
2024 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
2025 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
2026 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
2028 <p><code class="directive"><Location></code> sections operate
2029 completely outside the filesystem. This has several consequences.
2030 Most importantly, <code class="directive"><Location></code>
2031 directives should not be used to control access to filesystem
2032 locations. Since several different URLs may map to the same
2033 filesystem location, such access controls may by circumvented.</p>
2035 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
2037 <p>Use <code class="directive"><Location></code> to apply
2038 directives to content that lives outside the filesystem. For
2039 content that lives in the filesystem, use <code class="directive"><a href="#directory"><Directory></a></code> and <code class="directive"><a href="#files"><Files></a></code>. An exception is
2040 <code><Location /></code>, which is an easy way to
2041 apply a configuration to the entire server.</p>
2044 <p>For all origin (non-proxy) requests, the URL to be matched is a
2045 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2046 port, or query string may be included.</em> For proxy requests, the
2047 URL to be matched is of the form
2048 <code>scheme://servername/path</code>, and you must include the
2051 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2052 any single character, and <code>*</code> matches any sequences of
2053 characters. Neither wildcard character matches a / in the URL-path.</p>
2055 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
2056 can also be used, with the addition of the <code>~</code>
2057 character. For example:</p>
2059 <div class="example"><p><code>
2060 <Location ~ "/(extra|special)/data">
2063 <p>would match URLs that contained the substring <code>/extra/data</code>
2064 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
2065 identical to the regex version of <code class="directive"><Location></code>, and is preferred, for the
2066 simple reason that <code>~</code> is hard to distinguish from
2067 <code>-</code> in many fonts.</p>
2069 <p>The <code class="directive"><Location></code>
2070 functionality is especially useful when combined with the
2071 <code class="directive"><a href="#sethandler">SetHandler</a></code>
2072 directive. For example, to enable status requests, but allow them
2073 only from browsers at <code>example.com</code>, you might use:</p>
2075 <div class="example"><p><code>
2076 <Location /status><br />
2077 <span class="indent">
2078 SetHandler server-status<br />
2079 Order Deny,Allow<br />
2081 Allow from .example.com<br />
2086 <div class="note"><h3>Note about / (slash)</h3>
2087 <p>The slash character has special meaning depending on where in a
2088 URL it appears. People may be used to its behavior in the filesystem
2089 where multiple adjacent slashes are frequently collapsed to a single
2090 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2091 <code>/home/foo</code>). In URL-space this is not necessarily true.
2092 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
2093 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
2094 slashes if that is your intention.</p>
2096 <p>For example, <code><LocationMatch ^/abc></code> would match
2097 the request URL <code>/abc</code> but not the request URL <code>
2098 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
2099 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
2100 implicitly match multiple slashes with a single slash. For example,
2101 if you specify <code><Location /abc/def></code> and the
2102 request is to <code>/abc//def</code> then it will match.</p>
2107 <li><a href="../sections.html">How <Directory>, <Location>
2108 and <Files> sections work</a> for an explanation of how these
2109 different sections are combined when a request is received.</li>
2110 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
2113 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2114 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2115 <table class="directive">
2116 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2117 matching URLs</td></tr>
2118 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
2119 <var>regex</var>> ... </LocationMatch></code></td></tr>
2120 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2121 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2122 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2124 <p>The <code class="directive"><LocationMatch></code> directive
2125 limits the scope of the enclosed directives by URL, in an identical manner
2126 to <code class="directive"><a href="#location"><Location></a></code>. However,
2127 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2128 as an argument instead of a simple string. For example:</p>
2130 <div class="example"><p><code>
2131 <LocationMatch "/(extra|special)/data">
2134 <p>would match URLs that contained the substring <code>/extra/data</code>
2135 or <code>/special/data</code>.</p>
2139 <li><a href="../sections.html">How <Directory>, <Location>
2140 and <Files> sections work</a> for an explanation of how these
2141 different sections are combined when a request is received</li>
2144 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2145 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2146 <table class="directive">
2147 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2148 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>level</var></code></td></tr>
2149 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2150 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2151 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2152 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2154 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2155 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2156 <var>level</var>s are available, in order of decreasing
2159 <table class="bordered">
2162 <th><strong>Level</strong> </th>
2164 <th><strong>Description</strong> </th>
2166 <th><strong>Example</strong> </th>
2170 <td><code>emerg</code> </td>
2172 <td>Emergencies - system is unusable.</td>
2174 <td>"Child cannot open lock file. Exiting"</td>
2178 <td><code>alert</code> </td>
2180 <td>Action must be taken immediately.</td>
2182 <td>"getpwuid: couldn't determine user name from uid"</td>
2186 <td><code>crit</code> </td>
2188 <td>Critical Conditions.</td>
2190 <td>"socket: Failed to get a socket, exiting child"</td>
2194 <td><code>error</code> </td>
2196 <td>Error conditions.</td>
2198 <td>"Premature end of script headers"</td>
2202 <td><code>warn</code> </td>
2204 <td>Warning conditions.</td>
2206 <td>"child process 1234 did not exit, sending another
2211 <td><code>notice</code> </td>
2213 <td>Normal but significant condition.</td>
2215 <td>"httpd: caught SIGBUS, attempting to dump core in
2220 <td><code>info</code> </td>
2222 <td>Informational.</td>
2224 <td>"Server seems busy, (you may need to increase
2225 StartServers, or Min/MaxSpareServers)..."</td>
2229 <td><code>debug</code> </td>
2231 <td>Debug-level messages</td>
2233 <td>"Opening config file ..."</td>
2237 <p>When a particular level is specified, messages from all
2238 other levels of higher significance will be reported as well.
2239 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2240 then messages with log levels of <code>notice</code> and
2241 <code>warn</code> will also be posted.</p>
2243 <p>Using a level of at least <code>crit</code> is
2248 <div class="example"><p><code>
2252 <div class="note"><h3>Note</h3>
2253 <p>When logging to a regular file messages of the level
2254 <code>notice</code> cannot be suppressed and thus are always
2255 logged. However, this doesn't apply when logging is done
2256 using <code>syslog</code>.</p>
2260 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2261 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
2262 <table class="directive">
2263 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
2264 connection</td></tr>
2265 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
2266 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
2267 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2268 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2269 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2271 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
2272 limits the number of requests allowed per connection when
2273 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
2274 set to <code>0</code>, unlimited requests will be allowed. We
2275 recommend that this setting be kept to a high value for maximum
2276 server performance.</p>
2280 <div class="example"><p><code>
2281 MaxKeepAliveRequests 500
2285 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2286 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
2287 <table class="directive">
2288 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
2289 or specified mutexes</td></tr>
2290 <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>
2291 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
2292 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2293 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2294 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2295 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.4 and later</td></tr>
2297 <p>The <code class="directive">Mutex</code> directive sets the mechanism,
2298 and optionally the lock file location, that httpd and modules use
2299 to serialize access to resources. Specify <code>default</code> as
2300 the first argument to change the settings for all mutexes; specify
2301 a mutex name (see table below) as the first argument to override
2302 defaults only for that mutex.</p>
2304 <p>The <code class="directive">Mutex</code> directive is typically used in
2305 the following exceptional situations:</p>
2308 <li>change the mutex mechanism when the default mechanism selected
2309 by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
2312 <li>change the directory used by file-based mutexes when the
2313 default directory does not support locking</li>
2316 <div class="note"><h3>Supported modules</h3>
2317 <p>This directive only configures mutexes which have been registered
2318 with the core server using the <code>ap_mutex_register()</code> API.
2319 All modules bundled with httpd support the <code class="directive">Mutex</code>
2320 directive, but third-party modules may not. Consult the documentation
2321 of the third-party module, which must indicate the mutex name(s) which
2322 can be configured if this directive is supported.</p>
2325 <p>The following mutex <em>mechanisms</em> are available:</p>
2327 <li><code>default | yes</code>
2328 <p>This selects the default locking implementation, as determined by
2329 <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>. The default locking implementation can
2330 be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
2331 <code>-V</code> option.</p></li>
2333 <li><code>none | no</code>
2334 <p>This effectively disables the mutex, and is only allowed for a
2335 mutex if the module indicates that it is a valid choice. Consult the
2336 module documentation for more information.</p></li>
2338 <li><code>posixsem</code>
2339 <p>This is a mutex variant based on a Posix semaphore.</p>
2341 <div class="warning"><h3>Warning</h3>
2342 <p>The semaphore ownership is not recovered if a thread in the process
2343 holding the mutex segfaults, resulting in a hang of the web server.</p>
2347 <li><code>sysvsem</code>
2348 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
2350 <div class="warning"><h3>Warning</h3>
2351 <p>It is possible to "leak" SysV semaphores if processes crash
2352 before the semaphore is removed.</p>
2355 <div class="warning"><h3>Security</h3>
2356 <p>The semaphore API allows for a denial of service attack by any
2357 CGIs running under the same uid as the webserver (<em>i.e.</em>,
2358 all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
2359 or <code>cgiwrapper</code>).</p>
2363 <li><code>sem</code>
2364 <p>This selects the "best" available semaphore implementation, choosing
2365 between Posix and SystemV IPC semaphores, in that order.</p></li>
2367 <li><code>pthread</code>
2368 <p>This is a mutex variant based on cross-process Posix thread
2371 <div class="warning"><h3>Warning</h3>
2372 <p>On most systems, if a child process terminates abnormally while
2373 holding a mutex that uses this implementation, the server will deadlock
2374 and stop responding to requests. When this occurs, the server will
2375 require a manual restart to recover.</p>
2376 <p>Solaris is a notable exception as it provides a mechanism which
2377 usually allows the mutex to be recovered after a child process
2378 terminates abnormally while holding a mutex.</p>
2379 <p>If your system implements the
2380 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
2381 to use the <code>pthread</code> option safely.</p>
2385 <li><code>fcntl:/path/to/mutex</code>
2386 <p>This is a mutex variant where a physical (lock-)file and the
2387 <code>fcntl()</code> function are used as the mutex.</p>
2389 <div class="warning"><h3>Warning</h3>
2390 <p>When multiple mutexes based on this mechanism are used within
2391 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
2392 can be reported for valid mutex operations if <code>fcntl()</code>
2393 is not thread-aware, such as on Solaris.</p>
2397 <li><code>flock:/path/to/mutex</code>
2398 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
2399 with the exception that the <code>flock()</code> function is used to
2400 provide file locking.</p></li>
2402 <li><code>file:/path/to/mutex</code>
2403 <p>This selects the "best" available file locking implementation,
2404 choosing between <code>fcntl</code> and <code>flock</code>, in that
2408 <p>Most mechanisms are only available on selected platforms, where the
2409 underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it. Mechanisms
2410 which aren't available on all platforms are <em>posixsem</em>,
2411 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
2412 <em>flock</em>, and <em>file</em>.</p>
2414 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
2415 the path, if provided, is a directory where the lock file will be created.
2416 The default directory is httpd's run-time file directory relative to
2417 <code class="directive"><a href="#serverroot">ServerRoot</a></code>. Always use a local disk
2418 filesystem for <code>/path/to/mutex</code> and never a directory residing
2419 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
2420 type, an optional instance string provided by the module, and unless the
2421 <code>OmitPID</code> keyword is specified, the process id of the httpd
2422 parent process will be appended to to make the file name unique, avoiding
2423 conflicts when multiple httpd instances share a lock file directory. For
2424 example, if the mutex name is <code>mpm-accept</code> and the lock file
2425 directory is <code>/var/httpd/locks</code>, the lock file name for the
2426 httpd instance with parent process id 12345 would be
2427 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
2429 <div class="warning"><h3>Security</h3>
2430 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
2431 directory such as <code>/var/tmp</code> because someone could create
2432 a denial of service attack and prevent the server from starting by
2433 creating a lockfile with the same name as the one the server will try
2437 <p>The following table documents the names of mutexes used by httpd
2438 and bundled modules.</p>
2440 <table class="bordered"><tr class="header">
2443 <th>Protected resource</th>
2446 <td><code>mpm-accept</code></td>
2447 <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>
2448 <td>incoming connections, to avoid the thundering herd problem;
2449 for more information, refer to the
2450 <a href="../misc/perf-tuning.html">performance tuning</a>
2454 <td><code>authdigest-client</code></td>
2455 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
2456 <td>client list in shared memory</td>
2459 <td><code>authdigest-opaque</code></td>
2460 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
2461 <td>counter in shared memory</td>
2464 <td><code>ldap-cache</code></td>
2465 <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
2466 <td>LDAP result cache</td>
2469 <td><code>rewrite-map</code></td>
2470 <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
2471 <td>communication with external mapping programs, to avoid
2472 intermixed I/O from multiple requests</td>
2475 <td><code>ssl-cache</code></td>
2476 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
2477 <td>SSL session cache</td>
2480 <td><code>ssl-stapling</code></td>
2481 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
2482 <td>OCSP stapling response cache</td>
2485 <td><code>watchdog-callback</code></td>
2486 <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
2487 <td>callback function of a particular client module</td>
2491 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
2492 parent process id from the lock file name.</p>
2494 <p>In the following example, the mutex mechanism for the MPM accept
2495 mutex will be changed from the compiled-in default to <code>fcntl</code>,
2496 with the associated lock file created in directory
2497 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
2498 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
2500 <div class="example"><p><code>
2501 Mutex default sysvsem<br />
2502 Mutex mpm-accept fcntl:/var/httpd/locks
2506 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2507 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
2508 <table class="directive">
2509 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Designates an IP address for name-virtual
2511 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
2512 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2513 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2514 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2517 <p>A single <code class="directive">NameVirtualHost</code> directive
2518 identifies a set of identical virtual hosts on which the server will
2519 further select from on the basis of the <em>hostname</em>
2520 requested by the client. The <code class="directive">NameVirtualHost</code>
2521 directive is a required directive if you want to configure
2522 <a href="../vhosts/">name-based virtual hosts</a>.</p>
2524 <p>This directive, and the corresponding <code class="directive">VirtualHost</code>,
2525 <em>must</em> be qualified with a port number if the server supports both HTTP
2526 and HTTPS connections.</p>
2528 <p>Although <var>addr</var> can be a hostname, it is recommended
2529 that you always use an IP address or a wildcard. A wildcard
2530 NameVirtualHost matches only virtualhosts that also have a literal wildcard
2531 as their argument.</p>
2533 <p>In cases where a firewall or other proxy receives the requests and
2534 forwards them on a different IP address to the server, you must specify the
2535 IP address of the physical interface on the machine which will be
2536 servicing the requests. </p>
2538 <p> In the example below, requests received on interface 192.0.2.1 and port 80
2539 will only select among the first two virtual hosts. Requests received on
2540 port 80 on any other interface will only select among the third and fourth
2541 virtual hosts. In the common case where the interface isn't important
2542 to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
2545 <div class="example"><p><code>
2546 NameVirtualHost 192.0.2.1:80<br />
2547 NameVirtualHost *:80<br /><br />
2549 <VirtualHost 192.0.2.1:80><br />
2550 ServerName namebased-a.example.com<br />
2551 </VirtualHost><br />
2553 <VirtualHost 192.0.2.1:80><br />
2554 Servername namebased-b.example.com<br />
2555 </VirtualHost><br />
2557 <VirtualHost *:80><br />
2558 ServerName namebased-c.example.com <br />
2559 </VirtualHost><br />
2561 <VirtualHost *:80><br />
2562 ServerName namebased-d.example.com <br />
2563 </VirtualHost><br />
2568 <p>IPv6 addresses must be enclosed in square brackets, as shown
2569 in the following example:</p>
2571 <div class="example"><p><code>
2572 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2575 <div class="note"><h3>Argument to <code class="directive"><VirtualHost></code>
2577 <p>Note that the argument to the <code class="directive"><VirtualHost></code> directive must
2578 exactly match the argument to the <code class="directive">NameVirtualHost</code> directive.</p>
2580 <div class="example"><p><code>
2581 NameVirtualHost 192.0.2.2:80<br />
2582 <VirtualHost 192.0.2.2:80><br />
2584 </VirtualHost><br />
2590 <li><a href="../vhosts/">Virtual Hosts
2591 documentation</a></li>
2594 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2595 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
2596 <table class="directive">
2597 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
2599 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
2600 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
2601 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options All</code></td></tr>
2602 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2603 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
2604 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2605 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2607 <p>The <code class="directive">Options</code> directive controls which
2608 server features are available in a particular directory.</p>
2610 <p><var>option</var> can be set to <code>None</code>, in which
2611 case none of the extra features are enabled, or one or more of
2615 <dt><code>All</code></dt>
2617 <dd>All options except for <code>MultiViews</code>. This is the default
2620 <dt><code>ExecCGI</code></dt>
2623 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
2626 <dt><code>FollowSymLinks</code></dt>
2630 The server will follow symbolic links in this directory.
2632 <p>Even though the server follows the symlink it does <em>not</em>
2633 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
2634 <p>Note also, that this option <strong>gets ignored</strong> if set
2635 inside a <code class="directive"><a href="#location"><Location></a></code>
2637 <p>Omitting this option should not be considered a security restriction,
2638 since symlink testing is subject to race conditions that make it
2642 <dt><code>Includes</code></dt>
2645 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
2648 <dt><code>IncludesNOEXEC</code></dt>
2652 Server-side includes are permitted, but the <code>#exec
2653 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2654 possible to <code>#include virtual</code> CGI scripts from
2655 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
2658 <dt><code>Indexes</code></dt>
2661 If a URL which maps to a directory is requested, and there
2662 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2663 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2664 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
2665 of the directory.</dd>
2667 <dt><code>MultiViews</code></dt>
2670 <a href="../content-negotiation.html">Content negotiated</a>
2671 "MultiViews" are allowed using
2672 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.</dd>
2674 <dt><code>SymLinksIfOwnerMatch</code></dt>
2676 <dd>The server will only follow symbolic links for which the
2677 target file or directory is owned by the same user id as the
2680 <div class="note"><h3>Note</h3> <p>This option gets ignored if
2681 set inside a <code class="directive"><a href="#location"><Location></a></code> section.</p>
2682 <p>This option should not be considered a security restriction,
2683 since symlink testing is subject to race conditions that make it
2684 circumventable.</p></div>
2688 <p>Normally, if multiple <code class="directive">Options</code> could
2689 apply to a directory, then the most specific one is used and
2690 others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
2691 However if <em>all</em> the options on the
2692 <code class="directive">Options</code> directive are preceded by a
2693 <code>+</code> or <code>-</code> symbol, the options are
2694 merged. Any options preceded by a <code>+</code> are added to the
2695 options currently in force, and any options preceded by a
2696 <code>-</code> are removed from the options currently in
2699 <div class="warning"><h3>Warning</h3>
2700 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
2701 <code>-</code> with those without is not valid syntax, and is likely
2702 to cause unexpected results.</p>
2705 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2707 <div class="example"><p><code>
2708 <Directory /web/docs><br />
2709 <span class="indent">
2710 Options Indexes FollowSymLinks<br />
2712 </Directory><br />
2714 <Directory /web/docs/spec><br />
2715 <span class="indent">
2716 Options Includes<br />
2721 <p>then only <code>Includes</code> will be set for the
2722 <code>/web/docs/spec</code> directory. However if the second
2723 <code class="directive">Options</code> directive uses the <code>+</code> and
2724 <code>-</code> symbols:</p>
2726 <div class="example"><p><code>
2727 <Directory /web/docs><br />
2728 <span class="indent">
2729 Options Indexes FollowSymLinks<br />
2731 </Directory><br />
2733 <Directory /web/docs/spec><br />
2734 <span class="indent">
2735 Options +Includes -Indexes<br />
2740 <p>then the options <code>FollowSymLinks</code> and
2741 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2744 <div class="note"><h3>Note</h3>
2745 <p>Using <code>-IncludesNOEXEC</code> or
2746 <code>-Includes</code> disables server-side includes completely
2747 regardless of the previous setting.</p>
2750 <p>The default in the absence of any other settings is
2751 <code>All</code>.</p>
2754 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2755 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
2756 <table class="directive">
2757 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
2758 by Apache children</td></tr>
2759 <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>
2760 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2761 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2762 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2763 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2764 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2766 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2767 resource limit for all processes and the second parameter sets
2768 the maximum resource limit. Either parameter can be a number,
2769 or <code>max</code> to indicate to the server that the limit should
2770 be set to the maximum allowed by the operating system
2771 configuration. Raising the maximum resource limit requires that
2772 the server is running as <code>root</code>, or in the initial startup
2775 <p>This applies to processes forked off from Apache children
2776 servicing requests, not the Apache children themselves. This
2777 includes CGI scripts and SSI exec commands, but not any
2778 processes forked off from the Apache parent such as piped
2781 <p>CPU resource limits are expressed in seconds per
2786 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2787 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2790 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2791 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
2792 <table class="directive">
2793 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
2794 by Apache children</td></tr>
2795 <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>
2796 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2797 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2798 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2799 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2800 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2802 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2803 resource limit for all processes and the second parameter sets
2804 the maximum resource limit. Either parameter can be a number,
2805 or <code>max</code> to indicate to the server that the limit should
2806 be set to the maximum allowed by the operating system
2807 configuration. Raising the maximum resource limit requires that
2808 the server is running as <code>root</code>, or in the initial startup
2811 <p>This applies to processes forked off from Apache children
2812 servicing requests, not the Apache children themselves. This
2813 includes CGI scripts and SSI exec commands, but not any
2814 processes forked off from the Apache parent such as piped
2817 <p>Memory resource limits are expressed in bytes per
2822 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2823 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2826 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2827 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
2828 <table class="directive">
2829 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
2830 processes launched by Apache children</td></tr>
2831 <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>
2832 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2833 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2834 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2835 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2836 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2838 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2839 resource limit for all processes and the second parameter sets
2840 the maximum resource limit. Either parameter can be a number,
2841 or <code>max</code> to indicate to the server that the limit
2842 should be set to the maximum allowed by the operating system
2843 configuration. Raising the maximum resource limit requires that
2844 the server is running as <code>root</code>, or in the initial startup
2847 <p>This applies to processes forked off from Apache children
2848 servicing requests, not the Apache children themselves. This
2849 includes CGI scripts and SSI exec commands, but not any
2850 processes forked off from the Apache parent such as piped
2853 <p>Process limits control the number of processes per user.</p>
2855 <div class="note"><h3>Note</h3>
2856 <p>If CGI processes are <strong>not</strong> running
2857 under user ids other than the web server user id, this directive
2858 will limit the number of processes that the server itself can
2859 create. Evidence of this situation will be indicated by
2860 <strong><code>cannot fork</code></strong> messages in the
2861 <code>error_log</code>.</p>
2866 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2867 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2870 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2871 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
2872 <table class="directive">
2873 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
2875 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
2876 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
2877 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2878 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2879 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2880 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2881 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only;
2882 option <code>Registry-Strict</code> is available in Apache 2.0 and
2885 <p>This directive is used to control how Apache finds the
2886 interpreter used to run CGI scripts. The default setting is
2887 <code>Script</code>. This causes Apache to use the interpreter pointed to
2888 by the shebang line (first line, starting with <code>#!</code>) in the
2889 script. On Win32 systems this line usually looks like:</p>
2891 <div class="example"><p><code>
2892 #!C:/Perl/bin/perl.exe
2895 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2897 <div class="example"><p><code>
2901 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2902 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2903 searched using the script file extension (e.g., <code>.pl</code>) as a
2904 search key. The command defined by the registry subkey
2905 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2906 <code>Shell\Open\Command</code> is used to open the script file. If the
2907 registry keys cannot be found, Apache falls back to the behavior of the
2908 <code>Script</code> option.</p>
2910 <div class="warning"><h3>Security</h3>
2911 <p>Be careful when using <code>ScriptInterpreterSource
2912 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
2913 Apache will try to execute <strong>every</strong> file within this
2914 directory. The <code>Registry</code> setting may cause undesired
2915 program calls on files which are typically not executed. For
2916 example, the default open command on <code>.htm</code> files on
2917 most Windows systems will execute Microsoft Internet Explorer, so
2918 any HTTP request for an <code>.htm</code> file existing within the
2919 script directory would start the browser in the background on the
2920 server. This is a good way to crash your system within a minute or
2924 <p>The option <code>Registry-Strict</code> which is new in Apache
2925 2.0 does the same thing as <code>Registry</code> but uses only the
2926 subkey <code>Shell\ExecCGI\Command</code>. The
2927 <code>ExecCGI</code> key is not a common one. It must be
2928 configured manually in the windows registry and hence prevents
2929 accidental program calls on your system.</p>
2932 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2933 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
2934 <table class="directive">
2935 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
2936 of a request or the last 63, assuming the request itself is greater than
2938 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
2939 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
2940 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2941 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2942 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2943 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2.7 and later.</td></tr>
2945 <p>mod_status with <code>ExtendedStatus On</code>
2946 displays the actual request being handled.
2947 For historical purposes, only 63 characters of the request
2948 are actually stored for display purposes. This directive
2949 controls whether the 1st 63 characters are stored (the previous
2950 behavior and the default) or if the last 63 characters are. This
2951 is only applicable, of course, if the length of the request is
2952 64 characters or greater.</p>
2954 <p>If Apache is handling <code>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code> mod_status displays as follows:
2957 <table class="bordered">
2959 <th>Off (default)</th>
2960 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
2964 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
2970 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2971 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
2972 <table class="directive">
2973 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
2974 messages sent to the client</td></tr>
2975 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
2976 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2977 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2978 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2980 <p>The <code class="directive">ServerAdmin</code> sets the contact address
2981 that the server includes in any error messages it returns to the
2982 client. If the <code>httpd</code> doesn't recognize the supplied argument
2984 assumes, that it's an <var>email-address</var> and prepends it with
2985 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2986 actually use an email address, since there are a lot of CGI scripts that
2987 make that assumption. If you want to use an URL, it should point to another
2988 server under your control. Otherwise users may not be able to contact you in
2991 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2993 <div class="example"><p><code>
2994 ServerAdmin www-admin@foo.example.com
2996 <p>as users do not always mention that they are talking about the
3000 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3001 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
3002 <table class="directive">
3003 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
3004 to name-virtual hosts</td></tr>
3005 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
3006 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3007 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3008 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3010 <p>The <code class="directive">ServerAlias</code> directive sets the
3011 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3012 <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
3014 <div class="example"><p><code>
3015 <VirtualHost *:80><br />
3016 ServerName server.domain.com<br />
3017 ServerAlias server server2.domain.com server2<br />
3018 ServerAlias *.example.com<br />
3020 </VirtualHost>
3025 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
3028 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3029 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
3030 <table class="directive">
3031 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
3033 <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>
3034 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3035 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3036 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3037 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>In version 2.0, this
3038 directive supersedes the functionality of the <code class="directive">Port</code>
3039 directive from version 1.3.</td></tr>
3041 <p>The <code class="directive">ServerName</code> directive sets the
3042 request scheme, hostname and
3043 port that the server uses to identify itself. This is used when
3044 creating redirection URLs. For example, if the name of the
3045 machine hosting the web server is <code>simple.example.com</code>,
3046 but the machine also has the DNS alias <code>www.example.com</code>
3047 and you wish the web server to be so identified, the following
3048 directive should be used:</p>
3050 <div class="example"><p><code>
3051 ServerName www.example.com:80
3054 <p>If no <code class="directive">ServerName</code> is specified, then the
3055 server attempts to deduce the hostname by performing a reverse
3056 lookup on the IP address. If no port is specified in the
3057 <code class="directive">ServerName</code>, then the server will use the
3058 port from the incoming request. For optimal reliability and
3059 predictability, you should specify an explicit hostname and port
3060 using the <code class="directive">ServerName</code> directive.</p>
3062 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
3063 the <code class="directive">ServerName</code> inside a
3064 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
3065 section specifies what hostname must appear in the request's
3066 <code>Host:</code> header to match this virtual host.</p>
3069 <p>Sometimes, the server runs behind a device that processes SSL,
3070 such as a reverse proxy, load balancer or SSL offload
3071 appliance. When this is the case, specify the
3072 <code>https://</code> scheme and the port number to which the
3073 clients connect in the <code class="directive">ServerName</code> directive
3074 to make sure that the server generates the correct
3075 self-referential URLs.
3078 <p>See the description of the
3079 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
3080 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
3081 settings which determine whether self-referential URLs (e.g., by the
3082 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
3083 specified port, or to the port number given in the client's request.
3089 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3091 <li><a href="../vhosts/">Apache virtual host
3092 documentation</a></li>
3093 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3094 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3095 <li><code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code></li>
3096 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
3099 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3100 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
3101 <table class="directive">
3102 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
3103 is accessed by an incompatible browser</td></tr>
3104 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
3105 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3106 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3107 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3109 <p>The <code class="directive">ServerPath</code> directive sets the legacy
3110 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
3114 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
3117 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3118 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
3119 <table class="directive">
3120 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
3121 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
3122 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
3123 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3124 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3125 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3127 <p>The <code class="directive">ServerRoot</code> directive sets the
3128 directory in which the server lives. Typically it will contain the
3129 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3130 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
3131 relative to this directory.</p>
3133 <div class="example"><h3>Example</h3><p><code>
3134 ServerRoot /home/httpd
3140 <li><a href="../invoking.html">the <code>-d</code>
3141 option to <code>httpd</code></a></li>
3142 <li><a href="../misc/security_tips.html#serverroot">the
3143 security tips</a> for information on how to properly set
3144 permissions on the <code class="directive">ServerRoot</code></li>
3147 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3148 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
3149 <table class="directive">
3150 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
3151 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
3152 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
3153 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3154 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3155 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3156 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3158 <p>The <code class="directive">ServerSignature</code> directive allows the
3159 configuration of a trailing footer line under server-generated
3160 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
3161 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
3162 would want to enable such a footer line is that in a chain of proxies,
3163 the user often has no possibility to tell which of the chained servers
3164 actually produced a returned error message.</p>
3166 <p>The <code>Off</code>
3167 setting, which is the default, suppresses the footer line (and is
3168 therefore compatible with the behavior of Apache-1.2 and
3169 below). The <code>On</code> setting simply adds a line with the
3170 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
3171 and the <code>EMail</code> setting additionally creates a
3172 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
3175 <p>After version 2.0.44, the details of the server version number
3176 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
3180 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
3183 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3184 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
3185 <table class="directive">
3186 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
3188 <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>
3189 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
3190 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3191 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3192 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3194 <p>This directive controls whether <code>Server</code> response
3195 header field which is sent back to clients includes a
3196 description of the generic OS-type of the server as well as
3197 information about compiled-in modules.</p>
3200 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3202 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3203 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
3205 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
3207 <dd>Server sends (<em>e.g.</em>): <code>Server:
3210 <dt><code>ServerTokens Major</code></dt>
3212 <dd>Server sends (<em>e.g.</em>): <code>Server:
3213 Apache/2</code></dd>
3215 <dt><code>ServerTokens Minor</code></dt>
3217 <dd>Server sends (<em>e.g.</em>): <code>Server:
3218 Apache/2.4</code></dd>
3220 <dt><code>ServerTokens Min[imal]</code></dt>
3222 <dd>Server sends (<em>e.g.</em>): <code>Server:
3223 Apache/2.4.1</code></dd>
3225 <dt><code>ServerTokens OS</code></dt>
3227 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.1
3232 <p>This setting applies to the entire server, and cannot be
3233 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
3235 <p>After version 2.0.44, this directive also controls the
3236 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
3238 <div class="note">Setting <code class="directive">ServerTokens</code> to less than
3239 <code>minimal</code> is not recommended because it makes it more
3240 difficult to debug interoperational problems. Also note that
3241 disabling the Server: header does nothing at all to make your
3242 server more secure; the idea of "security through obscurity"
3243 is a myth and leads to a false sense of safety.</div>
3248 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
3251 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3252 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
3253 <table class="directive">
3254 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
3256 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
3257 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3258 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3259 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3260 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3261 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache 2.0</td></tr>
3263 <p>When placed into an <code>.htaccess</code> file or a
3264 <code class="directive"><a href="#directory"><Directory></a></code> or
3265 <code class="directive"><a href="#location"><Location></a></code>
3266 section, this directive forces all matching files to be parsed
3267 through the <a href="../handler.html">handler</a> given by
3268 <var>handler-name</var>. For example, if you had a directory you
3269 wanted to be parsed entirely as imagemap rule files, regardless
3270 of extension, you might put the following into an
3271 <code>.htaccess</code> file in that directory:</p>
3273 <div class="example"><p><code>
3274 SetHandler imap-file
3277 <p>Another example: if you wanted to have the server display a
3278 status report whenever a URL of
3279 <code>http://servername/status</code> was called, you might put
3280 the following into <code>httpd.conf</code>:</p>
3282 <div class="example"><p><code>
3283 <Location /status><br />
3284 <span class="indent">
3285 SetHandler server-status<br />
3290 <p>You can override an earlier defined <code class="directive">SetHandler</code>
3291 directive by using the value <code>None</code>.</p>
3292 <p><strong>Note:</strong> because SetHandler overrides default handlers,
3293 normal behaviour such as handling of URLs ending in a slash (/) as
3294 directories or index files is suppressed.</p>
3298 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
3301 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3302 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
3303 <table class="directive">
3304 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
3306 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
3307 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3308 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3309 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3310 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3312 <p>The <code class="directive">SetInputFilter</code> directive sets the
3313 filter or filters which will process client requests and POST
3314 input when they are received by the server. This is in addition to
3315 any filters defined elsewhere, including the
3316 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
3319 <p>If more than one filter is specified, they must be separated
3320 by semicolons in the order in which they should process the
3325 <li><a href="../filter.html">Filters</a> documentation</li>
3328 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3329 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
3330 <table class="directive">
3331 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
3333 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
3334 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3335 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3336 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3337 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3339 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
3340 which will process responses from the server before they are
3341 sent to the client. This is in addition to any filters defined
3342 elsewhere, including the
3343 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
3346 <p>For example, the following configuration will process all files
3347 in the <code>/www/data/</code> directory for server-side
3350 <div class="example"><p><code>
3351 <Directory /www/data/><br />
3352 <span class="indent">
3353 SetOutputFilter INCLUDES<br />
3358 <p>If more than one filter is specified, they must be separated
3359 by semicolons in the order in which they should process the
3364 <li><a href="../filter.html">Filters</a> documentation</li>
3367 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3368 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
3369 <table class="directive">
3370 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
3371 certain events before failing a request</td></tr>
3372 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
3373 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 300</code></td></tr>
3374 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3375 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3376 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3378 <p>The <code class="directive">TimeOut</code> directive defines the length
3379 of time Apache will wait for I/O in various circumstances:</p>
3382 <li>When reading data from the client, the length of time to
3383 wait for a TCP packet to arrive if the read buffer is
3386 <li>When writing data to the client, the length of time to wait
3387 for an acknowledgement of a packet if the send buffer is
3390 <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, the length of time to wait for
3391 output from a CGI script.</li>
3393 <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
3394 wait for output from a filtering process.</li>
3396 <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
3397 <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
3403 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3404 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
3405 <table class="directive">
3406 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behaviour on <code>TRACE</code>
3408 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
3409 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
3410 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3411 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3412 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3413 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 1.3.34, 2.0.55 and later</td></tr>
3415 <p>This directive overrides the behavior of <code>TRACE</code> for both
3416 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
3417 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3418 RFC 2616, which disallows any request body to accompany the request.
3419 <code>TraceEnable off</code> causes the core server and
3420 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
3421 allowed) error to the client.</p>
3423 <p>Finally, for testing and diagnostic purposes only, request
3424 bodies may be allowed using the non-compliant <code>TraceEnable
3425 extended</code> directive. The core (as an origin server) will
3426 restrict the request body to 64k (plus 8k for chunk headers if
3427 <code>Transfer-Encoding: chunked</code> is used). The core will
3428 reflect the full headers and all chunk headers with the response
3429 body. As a proxy server, the request body is not restricted to 64k.</p>
3432 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3433 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
3434 <table class="directive">
3435 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
3436 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
3437 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3438 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3439 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3441 <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
3442 of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
3443 <p>This directive can be used to toggle the use of <code class="directive"><a href="#ifdefine"><IfDefine></a></code> sections without needing to alter
3444 <code>-D</code> arguments in any startup scripts.</p>
3447 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3448 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
3449 <table class="directive">
3450 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3452 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
3453 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
3454 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3455 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3456 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3458 <p>In many situations Apache must construct a <em>self-referential</em>
3459 URL -- that is, a URL that refers back to the same server. With
3460 <code>UseCanonicalName On</code> Apache will use the hostname and port
3461 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
3462 directive to construct the canonical name for the server. This name
3463 is used in all self-referential URLs, and for the values of
3464 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3466 <p>With <code>UseCanonicalName Off</code> Apache will form
3467 self-referential URLs using the hostname and port supplied by
3468 the client if any are supplied (otherwise it will use the
3469 canonical name, as defined above). These values are the same
3470 that are used to implement <a href="../vhosts/name-based.html">name based virtual hosts</a>,
3471 and are available with the same clients. The CGI variables
3472 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3473 constructed from the client supplied values as well.</p>
3475 <p>An example where this may be useful is on an intranet server
3476 where you have users connecting to the machine using short
3477 names such as <code>www</code>. You'll notice that if the users
3478 type a shortname, and a URL which is a directory, such as
3479 <code>http://www/splat</code>, <em>without the trailing
3480 slash</em> then Apache will redirect them to
3481 <code>http://www.domain.com/splat/</code>. If you have
3482 authentication enabled, this will cause the user to have to
3483 authenticate twice (once for <code>www</code> and once again
3484 for <code>www.domain.com</code> -- see <a href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3485 FAQ on this subject for more information</a>). But if
3486 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
3487 Apache will redirect to <code>http://www/splat/</code>.</p>
3489 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3490 which is intended for use with mass IP-based virtual hosting to
3491 support ancient clients that do not provide a
3492 <code>Host:</code> header. With this option Apache does a
3493 reverse DNS lookup on the server IP address that the client
3494 connected to in order to work out self-referential URLs.</p>
3496 <div class="warning"><h3>Warning</h3>
3497 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3498 they may be broken by this option. The client is essentially free
3499 to give whatever value they want as a hostname. But if the CGI is
3500 only using <code>SERVER_NAME</code> to construct self-referential URLs
3501 then it should be just fine.</p>
3506 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3507 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3508 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3511 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3512 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
3513 <table class="directive">
3514 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3516 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
3517 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
3518 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3519 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3520 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3522 <p>In many situations Apache must construct a <em>self-referential</em>
3523 URL -- that is, a URL that refers back to the same server. With
3524 <code>UseCanonicalPhysicalPort On</code> Apache will, when
3525 constructing the canonical port for the server to honor
3526 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
3527 provide the actual physical port number being used by this request
3528 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3529 Apache will not ever use the actual physical port number, instead
3530 relying on all configured information to construct a valid port number.</p>
3532 <div class="note"><h3>Note</h3>
3533 <p>The ordering of when the physical port is used is as follows:<br /><br />
3534 <code>UseCanonicalName On</code></p>
3536 <li>Port provided in <code>Servername</code></li>
3537 <li>Physical port</li>
3538 <li>Default port</li>
3540 <code>UseCanonicalName Off | DNS</code>
3542 <li>Parsed port from <code>Host:</code> header</li>
3543 <li>Physical port</li>
3544 <li>Port provided in <code>Servername</code></li>
3545 <li>Default port</li>
3548 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3549 physical ports are removed from the ordering.</p>
3555 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3556 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3557 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3560 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3561 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
3562 <table class="directive">
3563 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
3564 hostname or IP address</td></tr>
3565 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
3566 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3567 ...> ... </VirtualHost></code></td></tr>
3568 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3569 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3570 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3572 <p><code class="directive"><VirtualHost></code> and
3573 <code></VirtualHost></code> are used to enclose a group of
3574 directives that will apply only to a particular virtual host. Any
3575 directive that is allowed in a virtual host context may be
3576 used. When the server receives a request for a document on a
3577 particular virtual host, it uses the configuration directives
3578 enclosed in the <code class="directive"><VirtualHost></code>
3579 section. <var>Addr</var> can be:</p>
3582 <li>The IP address of the virtual host;</li>
3584 <li>A fully qualified domain name for the IP address of the
3585 virtual host (not recommended);</li>
3587 <li>The character <code>*</code>, which is used only in combination with
3588 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3590 <li>The string <code>_default_</code>, which is used only
3591 with IP virtual hosting to catch unmatched IP addresses.</li>
3594 <div class="example"><h3>Example</h3><p><code>
3595 <VirtualHost 10.1.2.3><br />
3596 <span class="indent">
3597 ServerAdmin webmaster@host.example.com<br />
3598 DocumentRoot /www/docs/host.example.com<br />
3599 ServerName host.example.com<br />
3600 ErrorLog logs/host.example.com-error_log<br />
3601 TransferLog logs/host.example.com-access_log<br />
3603 </VirtualHost>
3607 <p>IPv6 addresses must be specified in square brackets because
3608 the optional port number could not be determined otherwise. An
3609 IPv6 example is shown below:</p>
3611 <div class="example"><p><code>
3612 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3613 <span class="indent">
3614 ServerAdmin webmaster@host.example.com<br />
3615 DocumentRoot /www/docs/host.example.com<br />
3616 ServerName host.example.com<br />
3617 ErrorLog logs/host.example.com-error_log<br />
3618 TransferLog logs/host.example.com-access_log<br />
3620 </VirtualHost>
3623 <p>Each Virtual Host must correspond to a different IP address,
3624 different port number or a different host name for the server,
3625 in the former case the server machine must be configured to
3626 accept IP packets for multiple addresses. (If the machine does
3627 not have multiple network interfaces, then this can be
3628 accomplished with the <code>ifconfig alias</code> command -- if
3629 your OS supports it).</p>
3631 <div class="note"><h3>Note</h3>
3632 <p>The use of <code class="directive"><VirtualHost></code> does
3633 <strong>not</strong> affect what addresses Apache listens on. You
3634 may need to ensure that Apache is listening on the correct addresses
3635 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
3638 <p>When using IP-based virtual hosting, the special name
3639 <code>_default_</code> can be specified in
3640 which case this virtual host will match any IP address that is
3641 not explicitly listed in another virtual host. In the absence
3642 of any <code>_default_</code> virtual host the "main" server config,
3643 consisting of all those definitions outside any VirtualHost
3644 section, is used when no IP-match occurs.</p>
3646 <p>You can specify a <code>:port</code> to change the port that is
3647 matched. If unspecified then it defaults to the same port as the
3648 most recent <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
3649 statement of the main server. You may also specify <code>:*</code>
3650 to match all ports on that address. (This is recommended when used
3651 with <code>_default_</code>.)</p>
3653 <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
3654 specified inside each <code class="directive"><VirtualHost></code> block. If it is absent, the
3655 <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
3656 server configuration will be inherited.</p>
3658 <div class="warning"><h3>Security</h3>
3659 <p>See the <a href="../misc/security_tips.html">security tips</a>
3660 document for details on why your security could be compromised if the
3661 directory where log files are stored is writable by anyone other
3662 than the user that starts the server.</p>
3667 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
3668 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3670 <li><a href="../bind.html">Setting
3671 which addresses and ports Apache uses</a></li>
3672 <li><a href="../sections.html">How <Directory>, <Location>
3673 and <Files> sections work</a> for an explanation of how these
3674 different sections are combined when a request is received</li>
3678 <div class="bottomlang">
3679 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
3680 <a href="../en/mod/core.html" title="English"> en </a> |
3681 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
3682 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
3683 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
3684 </div><div id="footer">
3685 <p class="apache">Copyright 2010 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>
3686 <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>