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" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
12 <script src="../style/scripts/prettify.js" type="text/javascript">
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
17 <div id="page-header">
18 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
23 <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.5</a> > <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Core Features</h1>
27 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
28 <a href="../en/mod/core.html" title="English"> en </a> |
29 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
30 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
31 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
32 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
34 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
36 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
38 <div id="quickview"><h3 class="directives">Directives</h3>
40 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverridelist">AllowOverrideList</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#defaultruntimedir">DefaultRuntimeDir</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#directory"><Directory></a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#else"><Else></a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#elseif"><ElseIf></a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#error">Error</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#errorlogformat">ErrorLogFormat</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#gprofdir">GprofDir</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#if"><If></a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#includeoptional">IncludeOptional</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangeoverlaps">MaxRangeOverlaps</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangereversals">MaxRangeReversals</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#maxranges">MaxRanges</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
107 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
108 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
109 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
110 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
111 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
112 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
113 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
114 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
115 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
116 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
118 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
120 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
121 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
122 <table class="directive">
123 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
124 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
125 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
126 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
127 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
128 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.1.5 and later.
129 On Windows from Apache httpd 2.3.3 and later.</td></tr>
131 <p>This directive enables operating system specific optimizations for a
132 listening socket by the <code class="directive">Protocol</code>type.
133 The basic premise is for the kernel to not send a socket to the server
134 process until either data is received or an entire HTTP Request is buffered.
135 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
136 FreeBSD's Accept Filters</a>, Linux's more primitive
137 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
138 are currently supported.</p>
140 <p>Using <code>none</code> for an argument will disable any accept filters
141 for that protocol. This is useful for protocols that require a server
142 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
143 <pre class="prettyprint lang-config">
144 AcceptFilter nntp none
148 <p>The default protocol names are <code>https</code> for port 443
149 and <code>http</code> for all other ports. To specify another protocol
150 is being used with a listening port, add the <var>protocol</var>
151 argument to the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
154 <p>The default values on FreeBSD are:</p>
155 <pre class="prettyprint lang-config">
156 AcceptFilter http httpready
157 AcceptFilter https dataready
161 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
162 the kernel level. Once an entire request is received, the kernel then
163 sends it to the server. See the
164 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
165 accf_http(9)</a> man page for more details. Since HTTPS requests are
166 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
167 accf_data(9)</a> filter is used.</p>
169 <p>The default values on Linux are:</p>
170 <pre class="prettyprint lang-config">
171 AcceptFilter http data
172 AcceptFilter https data
176 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
177 requests. Any value besides <code>none</code> will enable
178 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
180 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
181 tcp(7)</a> man page.</p>
183 <p>The default values on Windows are:</p>
184 <pre class="prettyprint lang-config">
185 AcceptFilter http data
186 AcceptFilter https data
190 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
191 API, and does not support http protocol buffering. There are two values
192 which utilize the Windows AcceptEx() API and will recycle network
193 sockets between connections. <code>data</code> waits until data has
194 been transmitted as documented above, and the initial data buffer and
195 network endpoint addresses are all retrieved from the single AcceptEx()
196 invocation. <code>connect</code> will use the AcceptEx() API, also
197 retrieve the network endpoint addresses, but like <code>none</code>
198 the <code>connect</code> option does not wait for the initial data
201 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
202 and will not recycle sockets between connections. This is useful for
203 network adapters with broken driver support, as well as some virtual
204 network providers such as vpn drivers, or spam, virus or spyware
210 <li><code class="directive"><a href="#protocol">Protocol</a></code></li>
213 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
214 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
215 <table class="directive">
216 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
217 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
218 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
219 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
220 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
221 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
222 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
223 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.30 and later</td></tr>
226 <p>This directive controls whether requests that contain trailing
227 pathname information that follows an actual filename (or
228 non-existent file in an existing directory) will be accepted or
229 rejected. The trailing pathname information can be made
230 available to scripts in the <code>PATH_INFO</code> environment
233 <p>For example, assume the location <code>/test/</code> points to
234 a directory that contains only the single file
235 <code>here.html</code>. Then requests for
236 <code>/test/here.html/more</code> and
237 <code>/test/nothere.html/more</code> both collect
238 <code>/more</code> as <code>PATH_INFO</code>.</p>
240 <p>The three possible arguments for the
241 <code class="directive">AcceptPathInfo</code> directive are:</p>
243 <dt><code>Off</code></dt><dd>A request will only be accepted if it
244 maps to a literal path that exists. Therefore a request with
245 trailing pathname information after the true filename such as
246 <code>/test/here.html/more</code> in the above example will return
247 a 404 NOT FOUND error.</dd>
249 <dt><code>On</code></dt><dd>A request will be accepted if a
250 leading path component maps to a file that exists. The above
251 example <code>/test/here.html/more</code> will be accepted if
252 <code>/test/here.html</code> maps to a valid file.</dd>
254 <dt><code>Default</code></dt><dd>The treatment of requests with
255 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
256 The core handler for normal files defaults to rejecting
257 <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
258 <code>PATH_INFO</code> by default.</dd>
261 <p>The primary purpose of the <code>AcceptPathInfo</code>
262 directive is to allow you to override the handler's choice of
263 accepting or rejecting <code>PATH_INFO</code>. This override is required,
264 for example, when you use a <a href="../filter.html">filter</a>, such
265 as <a href="mod_include.html">INCLUDES</a>, to generate content
266 based on <code>PATH_INFO</code>. The core handler would usually reject
267 the request, so you can use the following configuration to enable
270 <pre class="prettyprint lang-config">
271 <Files "mypaths.shtml">
273 SetOutputFilter INCLUDES
281 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
282 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
283 <table class="directive">
284 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
285 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
286 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
287 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
288 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
289 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
291 <p>While processing a request the server looks for
292 the first existing configuration file from this list of names in
293 every directory of the path to the document, if distributed
294 configuration files are <a href="#allowoverride">enabled for that
295 directory</a>. For example:</p>
297 <pre class="prettyprint lang-config">AccessFileName .acl</pre>
300 <p>before returning the document
301 <code>/usr/local/web/index.html</code>, the server will read
302 <code>/.acl</code>, <code>/usr/.acl</code>,
303 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
304 for directives, unless they have been disabled with</p>
306 <pre class="prettyprint lang-config">
315 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
316 <li><a href="../configuring.html">Configuration Files</a></li>
317 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
320 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
321 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
322 <table class="directive">
323 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
324 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
325 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
326 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
327 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
328 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
329 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
330 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
332 <p>This directive specifies a default value for the media type
333 charset parameter (the name of a character encoding) to be added
334 to a response if and only if the response's content-type is either
335 <code>text/plain</code> or <code>text/html</code>. This should override
336 any charset specified in the body of the response via a <code>META</code>
337 element, though the exact behavior is often dependent on the user's client
338 configuration. A setting of <code>AddDefaultCharset Off</code>
339 disables this functionality. <code>AddDefaultCharset On</code> enables
340 a default charset of <code>iso-8859-1</code>. Any other value is assumed
341 to be the <var>charset</var> to be used, which should be one of the
342 <a href="http://www.iana.org/assignments/character-sets">IANA registered
343 charset values</a> for use in Internet media types (MIME types).
346 <pre class="prettyprint lang-config">AddDefaultCharset utf-8</pre>
349 <p><code class="directive">AddDefaultCharset</code> should only be used when all
350 of the text resources to which it applies are known to be in that
351 character encoding and it is too inconvenient to label their charset
352 individually. One such example is to add the charset parameter
353 to resources containing generated content, such as legacy CGI
354 scripts, that might be vulnerable to cross-site scripting attacks
355 due to user-provided data being included in the output. Note, however,
356 that a better solution is to just fix (or delete) those scripts, since
357 setting a default charset does not protect users that have enabled
358 the "auto-detect character encoding" feature on their browser.</p>
362 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
365 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
366 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
367 <table class="directive">
368 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
369 be passed through</td></tr>
370 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off|NoDecode</code></td></tr>
371 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
372 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
373 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
374 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
375 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.46 and later.
376 NoDecode option available in 2.3.12 and later.</td></tr>
378 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
379 which contain encoded path separators (<code>%2F</code> for <code>/</code>
380 and additionally <code>%5C</code> for <code>\</code> on according systems)
381 to be used in the path info.</p>
383 <p>With the default value, <code>Off</code>, such URLs are refused
384 with a 404 (Not found) error.</p>
386 <p>With the value <code>On</code>, such URLs are accepted, and encoded
387 slashes are decoded like all other encoded characters.</p>
389 <p>With the value <code>NoDecode</code>, such URLs are accepted, but
390 encoded slashes are not decoded but left in their encoded state.</p>
392 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
393 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
395 <div class="note"><h3>Note</h3>
396 <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
397 strongly recommended as a security measure. Allowing slashes
398 to be decoded could potentially allow unsafe paths.</p>
403 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
406 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
407 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
408 <table class="directive">
409 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
410 <code>.htaccess</code> files</td></tr>
411 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
412 [<var>directive-type</var>] ...</code></td></tr>
413 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)</code></td></tr>
414 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
415 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
416 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
418 <p>When the server finds an <code>.htaccess</code> file (as
419 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
420 it needs to know which directives declared in that file can override
421 earlier configuration directives.</p>
423 <div class="note"><h3>Only available in <Directory> sections</h3>
424 <code class="directive">AllowOverride</code> is valid only in
425 <code class="directive"><a href="#directory"><Directory></a></code>
426 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
427 <code class="directive"><a href="#files"><Files></a></code> sections.
430 <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code> is set to
431 <code>None</code> <a href="#accessfilename">.htaccess</a> files are
432 completely ignored. In this case, the server will not even attempt
433 to read <code>.htaccess</code> files in the filesystem.</p>
435 <p>When this directive is set to <code>All</code>, then any
436 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
437 <code>.htaccess</code> files.</p>
439 <p>The <var>directive-type</var> can be one of the following
440 groupings of directives.</p>
447 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authz_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
448 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
449 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
450 <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
451 <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>
456 Allow use of the directives controlling document types
457 (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
458 <code class="directive"><a href="#forcetype">ForceType</a></code>,
459 <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
460 <code class="directive"><a href="#sethandler">SetHandler</a></code>,
461 <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
462 <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
463 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
464 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>),
465 <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
466 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
467 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
473 Allow use of the directives controlling directory indexing
474 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
475 <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>,
476 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
477 <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>, <a href="mod_autoindex.html#indexoptions.fancyindexing"><code>FancyIndexing</code></a>, <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>,
483 Allow use of the directives controlling host access (<code class="directive"><a href="../mod/mod_access_compat.html#allow">Allow</a></code>, <code class="directive"><a href="../mod/mod_access_compat.html#deny">Deny</a></code> and <code class="directive"><a href="../mod/mod_access_compat.html#order">Order</a></code>).</dd>
485 <dt>Nonfatal=[Override|Unknown|All]</dt>
488 Allow use of AllowOverride option to treat syntax errors in
489 .htaccess as non-fatal: instead of causing an Internal Server
490 Error, disallowed or unrecognised directives will be ignored
491 and a warning logged:
493 <li><strong>Nonfatal=Override</strong> treats directives
494 forbidden by AllowOverride as non-fatal.</li>
495 <li><strong>Nonfatal=Unknown</strong> treats unknown directives
496 as non-fatal. This covers typos and directives implemented
497 by a module that's not present.</li>
498 <li><strong>Nonfatal=All</strong> treats both the above as non-fatal.</li>
500 <p>Note that a syntax error in a valid directive will still cause
501 an internal server error.</p>
502 <div class="warning"><h3>Security</h3>
503 Nonfatal errors may have security implications for .htaccess users.
504 For example, if AllowOverride disallows AuthConfig, users'
505 configuration designed to restrict access to a site will be disabled.
509 <dt>Options[=<var>Option</var>,...]</dt>
512 Allow use of the directives controlling specific directory
513 features (<code class="directive"><a href="#options">Options</a></code> and
514 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
515 An equal sign may be given followed by a comma (but no spaces)
516 separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.
518 <div class="note"><h3>Implicit disabling of Options</h3>
519 <p>Even though the list of options that may be used in .htaccess files
520 can be limited with this directive, as long as any <code class="directive"><a href="#options">Options</a></code> directive is allowed any
521 other inherited option can be disabled by using the non-relative
522 syntax. In other words, this mechanism cannot force a specific option
523 to remain <em>set</em> while allowing any others to be set.
530 <pre class="prettyprint lang-config">AllowOverride AuthConfig Indexes</pre>
533 <p>In the example above all directives that are neither in the group
534 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
537 <div class="note"><p>For security and performance reasons, do not set
538 <code>AllowOverride</code> to anything other than <code>None</code>
539 in your <code><Directory /></code> block. Instead, find (or
540 create) the <code><Directory></code> block that refers to the
541 directory where you're actually planning to place a
542 <code>.htaccess</code> file.</p>
547 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
548 <li><code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code></li>
549 <li><a href="../configuring.html">Configuration Files</a></li>
550 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
553 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
554 <div class="directive-section"><h2><a name="AllowOverrideList" id="AllowOverrideList">AllowOverrideList</a> <a name="allowoverridelist" id="allowoverridelist">Directive</a></h2>
555 <table class="directive">
556 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Individual directives that are allowed in
557 <code>.htaccess</code> files</td></tr>
558 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverrideList None|<var>directive</var>
559 [<var>directive-type</var>] ...</code></td></tr>
560 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverrideList None</code></td></tr>
561 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
562 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
563 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
565 <p>When the server finds an <code>.htaccess</code> file (as
566 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
567 it needs to know which directives declared in that file can override
568 earlier configuration directives.</p>
570 <div class="note"><h3>Only available in <Directory> sections</h3>
571 <code class="directive">AllowOverrideList</code> is valid only in
572 <code class="directive"><a href="#directory"><Directory></a></code>
573 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
574 <code class="directive"><a href="#files"><Files></a></code> sections.
577 <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverride">AllowOverride</a></code> is set to <code>None</code>,
578 then <a href="#accessfilename">.htaccess</a> files are completely
579 ignored. In this case, the server will not even attempt to read
580 <code>.htaccess</code> files in the filesystem.</p>
584 <pre class="prettyprint lang-config">
586 AllowOverrideList Redirect RedirectMatch
590 <p>In the example above only the <code>Redirect</code> and
591 <code>RedirectMatch</code> directives are allowed. All others will
592 cause an internal server error.</p>
596 <pre class="prettyprint lang-config">
597 AllowOverride AuthConfig
598 AllowOverrideList CookieTracking CookieName
602 <p>In the example above <code class="directive"><a href="#allowoverride ">AllowOverride
603 </a></code> grants permission to the <code>AuthConfig</code>
604 directive grouping and <code class="directive">AllowOverrideList</code> grants
605 permission to only two directves from the <code>FileInfo</code> directive
606 grouping. All others will cause an internal server error.</p>
610 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
611 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
612 <li><a href="../configuring.html">Configuration Files</a></li>
613 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
616 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
617 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
618 <table class="directive">
619 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
621 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
622 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
623 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
624 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
625 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
626 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
628 <p>This directive is used to control how Apache httpd finds the
629 interpreter used to run CGI scripts. For example, setting
630 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
631 cause all CGI script files with a <code>.foo</code> extension to
632 be passed to the FOO interpreter.</p>
635 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
636 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
637 <table class="directive">
638 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
640 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
641 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
642 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
643 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
644 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
645 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
647 <p>This directive enables the generation of
648 <code>Content-MD5</code> headers as defined in RFC1864
649 respectively RFC2616.</p>
651 <p>MD5 is an algorithm for computing a "message digest"
652 (sometimes called "fingerprint") of arbitrary-length data, with
653 a high degree of confidence that any alterations in the data
654 will be reflected in alterations in the message digest.</p>
656 <p>The <code>Content-MD5</code> header provides an end-to-end
657 message integrity check (MIC) of the entity-body. A proxy or
658 client may check this header for detecting accidental
659 modification of the entity-body in transit. Example header:</p>
661 <div class="example"><p><code>
662 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
665 <p>Note that this can cause performance problems on your server
666 since the message digest is computed on every request (the
667 values are not cached).</p>
669 <p><code>Content-MD5</code> is only sent for documents served
670 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
671 SSI documents, output from CGI scripts, and byte range responses
672 do not have this header.</p>
675 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
676 <div class="directive-section"><h2><a name="DefaultRuntimeDir" id="DefaultRuntimeDir">DefaultRuntimeDir</a> <a name="defaultruntimedir" id="defaultruntimedir">Directive</a></h2>
677 <table class="directive">
678 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server run-time files</td></tr>
679 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultRuntimeDir <var>directory-path</var></code></td></tr>
680 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</code></td></tr>
681 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
682 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
683 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
685 <p>The <code class="directive">DefaultRuntimeDir</code> directive sets the
686 directory in which the server will create various run-time files
687 (shared memory, locks, etc.). If set as a relative path, the full path
688 will be relative to <code class="directive">ServerRoot</code></p>
690 <p><strong>Example</strong></p>
691 <pre class="prettyprint lang-config">
692 DefaultRuntimeDir scratch/
696 <p>The default location of <code class="directive">DefaultRuntimeDir</code> may be
697 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
700 <p>Note: <code class="directive">ServerRoot</code> should be specified before this
701 directive is used, otherwise the default value of <code class="directive">ServerRoot</code>
702 would be used to set the base directory.</p>
707 <li><a href="../misc/security_tips.html#serverroot">the
708 security tips</a> for information on how to properly set
709 permissions on the <code class="directive">ServerRoot</code></li>
712 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
713 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
714 <table class="directive">
715 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
716 if the value is not <code>none</code>. In prior versions, DefaultType
717 would specify a default media type to assign to response content for
718 which no other media type configuration could be found.
720 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
721 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
722 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
723 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
724 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
725 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
726 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The argument <code>none</code> is available in Apache httpd 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.</td></tr>
728 <p>This directive has been disabled. For backwards compatibility
729 of configuration files, it may be specified with the value
730 <code>none</code>, meaning no default media type. For example:</p>
732 <pre class="prettyprint lang-config">DefaultType None</pre>
735 <p><code>DefaultType None</code> is only available in
736 httpd-2.2.7 and later.</p>
738 <p>Use the mime.types configuration file and the
739 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
740 type assignments via file extensions, or the
741 <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
742 the media type for specific resources. Otherwise, the server will
743 send the response without a Content-Type header field and the
744 recipient may attempt to guess the media type.</p>
747 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
748 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
749 <table class="directive">
750 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a variable</td></tr>
751 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Define <var>parameter-name</var> [<var>parameter-value</var>]</code></td></tr>
752 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
753 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
754 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
756 <p>In its one parameter form, <code class="directive">Define</code> is equivalent
757 to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>. It
758 can be used to toggle the use of
759 <code class="directive"><a href="#ifdefine"><IfDefine></a></code> sections
760 without needing to alter <code>-D</code> arguments in any startup
763 <p>In addition to that, if the second parameter is given, a config variable
764 is set to this value. The variable can be used in the configuration using
765 the <code>${VAR}</code> syntax. The variable is always globally defined
766 and not limited to the scope of the surrounding config section.</p>
768 <pre class="prettyprint lang-config">
769 <IfDefine TEST>
770 Define servername test.example.com
772 <IfDefine !TEST>
773 Define servername www.example.com
779 <p>Variable names may not contain colon ":" characters, to avoid clashes
780 with <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>'s syntax.</p>
783 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
784 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
785 <table class="directive">
786 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
787 named file-system directory, sub-directories, and their contents.</td></tr>
788 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
789 ... </Directory></code></td></tr>
790 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
791 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
792 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
794 <p><code class="directive"><Directory></code> and
795 <code></Directory></code> are used to enclose a group of
796 directives that will apply only to the named directory,
797 sub-directories of that directory, and the files within the respective
798 directories. Any directive that is allowed
799 in a directory context may be used. <var>Directory-path</var> is
800 either the full path to a directory, or a wild-card string using
801 Unix shell-style matching. In a wild-card string, <code>?</code> matches
802 any single character, and <code>*</code> matches any sequences of
803 characters. You may also use <code>[]</code> character ranges. None
804 of the wildcards match a `/' character, so <code><Directory
805 /*/public_html></code> will not match
806 <code>/home/user/public_html</code>, but <code><Directory
807 /home/*/public_html></code> will match. Example:</p>
809 <pre class="prettyprint lang-config">
810 <Directory "/usr/local/httpd/htdocs">
811 Options Indexes FollowSymLinks
817 <p>Be careful with the <var>directory-path</var> arguments:
818 They have to literally match the filesystem path which Apache httpd uses
819 to access the files. Directives applied to a particular
820 <code><Directory></code> will not apply to files accessed from
821 that same directory via a different path, such as via different symbolic
825 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
826 expressions</a> can also be used, with the addition of the
827 <code>~</code> character. For example:</p>
829 <pre class="prettyprint lang-config">
830 <Directory ~ "^/www/.*/[0-9]{3}">
836 <p>would match directories in <code>/www/</code> that consisted of
839 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
840 match the directory (or one of its parents) containing a document,
841 then the directives are applied in the order of shortest match
842 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
845 <pre class="prettyprint lang-config">
850 <Directory "/home">
851 AllowOverride FileInfo
856 <p>for access to the document <code>/home/web/dir/doc.html</code>
860 <li>Apply directive <code>AllowOverride None</code>
861 (disabling <code>.htaccess</code> files).</li>
863 <li>Apply directive <code>AllowOverride FileInfo</code> (for
864 directory <code>/home</code>).</li>
866 <li>Apply any <code>FileInfo</code> directives in
867 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
868 <code>/home/web/dir/.htaccess</code> in that order.</li>
871 <p>Regular expressions are not considered until after all of the
872 normal sections have been applied. Then all of the regular
873 expressions are tested in the order they appeared in the
874 configuration file. For example, with</p>
876 <pre class="prettyprint lang-config">
877 <Directory ~ "abc$">
878 # ... directives here ...
883 <p>the regular expression section won't be considered until after
884 all normal <code class="directive"><Directory></code>s and
885 <code>.htaccess</code> files have been applied. Then the regular
886 expression will match on <code>/home/abc/public_html/abc</code> and
887 the corresponding <code class="directive"><Directory></code> will
890 <p><strong>Note that the default access for
891 <code><Directory /></code> is to permit all access.
892 This means that Apache httpd will serve any file mapped from an URL. It is
893 recommended that you change this with a block such
896 <pre class="prettyprint lang-config">
903 <p><strong>and then override this for directories you
904 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
905 details.</strong></p>
907 <p>The directory sections occur in the <code>httpd.conf</code> file.
908 <code class="directive"><Directory></code> directives
909 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>
913 <li><a href="../sections.html">How <Directory>,
914 <Location> and <Files> sections work</a> for an
915 explanation of how these different sections are combined when a
916 request is received</li>
919 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
920 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
921 <table class="directive">
922 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
923 the contents of file-system directories matching a regular expression.</td></tr>
924 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
925 ... </DirectoryMatch></code></td></tr>
926 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
927 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
928 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
930 <p><code class="directive"><DirectoryMatch></code> and
931 <code></DirectoryMatch></code> are used to enclose a group
932 of directives which will apply only to the named directory (and the files within),
933 the same as <code class="directive"><a href="#directory"><Directory></a></code>.
934 However, it takes as an argument a
935 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>. For example:</p>
937 <pre class="prettyprint lang-config">
938 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
940 </DirectoryMatch>
944 <p>would match directories in <code>/www/</code> that consisted of three
947 <div class="note"><h3>Compatability</h3>
948 Prior to 2.3.9, this directive implicitly applied to sub-directories
949 (like <code class="directive"><a href="#directory"><Directory></a></code>) and
950 could not match the end of line symbol ($). In 2.3.9 and later,
951 only directories that match the expression are affected by the enclosed
955 <div class="note"><h3>Trailing Slash</h3>
956 This directive applies to requests for directories that may or may
957 not end in a trailing slash, so expressions that are anchored to the
958 end of line ($) must be written with care.
963 <li><code class="directive"><a href="#directory"><Directory></a></code> for
964 a description of how regular expressions are mixed in with normal
965 <code class="directive"><Directory></code>s</li>
966 <li><a href="../sections.html">How <Directory>, <Location> and
967 <Files> sections work</a> for an explanation of how these different
968 sections are combined when a request is received</li>
971 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
972 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
973 <table class="directive">
974 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
975 from the web</td></tr>
976 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
977 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
978 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
979 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
980 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
982 <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
983 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
984 path from the requested URL to the document root to make the
985 path to the document. Example:</p>
987 <pre class="prettyprint lang-config">DocumentRoot "/usr/web"</pre>
991 <code>http://my.example.com/index.html</code> refers to
992 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
993 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
995 <p>The <code class="directive">DocumentRoot</code> should be specified without
996 a trailing slash.</p>
1000 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1004 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1005 <div class="directive-section"><h2><a name="Else" id="Else"><Else></a> <a name="else" id="else">Directive</a></h2>
1006 <table class="directive">
1007 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if the condition of a
1008 previous <code class="directive"><a href="#if"><If></a></code> or
1009 <code class="directive"><a href="#elseif"><ElseIf></a></code> section is not
1010 satisfied by a request at runtime</td></tr>
1011 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Else> ... </Else></code></td></tr>
1012 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1013 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1014 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1015 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1017 <p>The <code class="directive"><Else></code> applies the enclosed
1018 directives if and only if the most recent
1019 <code class="directive"><If></code> or
1020 <code class="directive"><ElseIf></code> section
1021 in the same scope has not been applied.
1022 For example: In </p>
1024 <pre class="prettyprint lang-config">
1025 <If "-z req('Host')">
1034 <p> The <code class="directive"><If></code> would match HTTP/1.0
1035 requests without a <var>Host:</var> header and the
1036 <code class="directive"><Else></code> would match requests
1037 with a <var>Host:</var> header.</p>
1042 <li><code class="directive"><a href="#if"><If></a></code></li>
1043 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
1044 <li><a href="../sections.html">How <Directory>, <Location>,
1045 <Files> sections work</a> for an explanation of how these
1046 different sections are combined when a request is received.
1047 <code class="directive"><If></code>,
1048 <code class="directive"><ElseIf></code>, and
1049 <code class="directive"><Else></code> are applied last.</li>
1052 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1053 <div class="directive-section"><h2><a name="ElseIf" id="ElseIf"><ElseIf></a> <a name="elseif" id="elseif">Directive</a></h2>
1054 <table class="directive">
1055 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is satisfied
1056 by a request at runtime while the condition of a previous
1057 <code class="directive"><a href="#if"><If></a></code> or
1058 <code class="directive"><ElseIf></code> section is not
1060 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><ElseIf <var>expression</var>> ... </ElseIf></code></td></tr>
1061 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1062 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1063 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1064 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1066 <p>The <code class="directive"><ElseIf></code> applies the enclosed
1067 directives if and only if both the given condition evaluates to true and
1068 the most recent <code class="directive"><If></code> or
1069 <code class="directive"><ElseIf></code> section in the same scope has
1070 not been applied. For example: In </p>
1072 <pre class="prettyprint lang-config">
1073 <If "-R '10.1.0.0/16'">
1076 <ElseIf "-R '10.0.0.0/8'">
1085 <p>The <code class="directive"><ElseIf></code> would match if
1086 the remote address of a request belongs to the subnet 10.0.0.0/8 but
1087 not to the subnet 10.1.0.0/16.</p>
1092 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1093 for a complete reference and more examples.</li>
1094 <li><code class="directive"><a href="#if"><If></a></code></li>
1095 <li><code class="directive"><a href="#else"><Else></a></code></li>
1096 <li><a href="../sections.html">How <Directory>, <Location>,
1097 <Files> sections work</a> for an explanation of how these
1098 different sections are combined when a request is received.
1099 <code class="directive"><If></code>,
1100 <code class="directive"><ElseIf></code>, and
1101 <code class="directive"><Else></code> are applied last.</li>
1104 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1105 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
1106 <table class="directive">
1107 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
1108 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
1109 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
1110 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1111 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1112 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1113 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1115 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
1116 memory-mapping if it needs to read the contents of a file during
1117 delivery. By default, when the handling of a request requires
1118 access to the data within a file -- for example, when delivering a
1119 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache httpd
1120 memory-maps the file if the OS supports it.</p>
1122 <p>This memory-mapping sometimes yields a performance improvement.
1123 But in some environments, it is better to disable the memory-mapping
1124 to prevent operational problems:</p>
1127 <li>On some multiprocessor systems, memory-mapping can reduce the
1128 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
1129 <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1130 has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1131 crash with a segmentation fault.
1135 <p>For server configurations that are vulnerable to these problems,
1136 you should disable memory-mapping of delivered files by specifying:</p>
1138 <pre class="prettyprint lang-config">EnableMMAP Off</pre>
1141 <p>For NFS mounted files, this feature may be disabled explicitly for
1142 the offending files by specifying:</p>
1144 <pre class="prettyprint lang-config">
1145 <Directory "/path-to-nfs-files">
1152 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1153 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
1154 <table class="directive">
1155 <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>
1156 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
1157 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile Off</code></td></tr>
1158 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1159 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1160 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1161 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1162 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later. Default changed to Off in
1163 version 2.3.9.</td></tr>
1165 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
1166 sendfile support from the kernel to transmit file contents to the client.
1167 By default, when the handling of a request requires no access
1168 to the data within a file -- for example, when delivering a
1169 static file -- Apache httpd uses sendfile to deliver the file contents
1170 without ever reading the file if the OS supports it.</p>
1172 <p>This sendfile mechanism avoids separate read and send operations,
1173 and buffer allocations. But on some platforms or within some
1174 filesystems, it is better to disable this feature to avoid
1175 operational problems:</p>
1178 <li>Some platforms may have broken sendfile support that the build
1179 system did not detect, especially if the binaries were built on
1180 another box and moved to such a machine with broken sendfile
1182 <li>On Linux the use of sendfile triggers TCP-checksum
1183 offloading bugs on certain networking cards when using IPv6.</li>
1184 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1185 files over 2GB in size.</li>
1186 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS, SMB, CIFS, FUSE),
1187 the kernel may be unable to serve the network file through
1191 <p>For server configurations that are not vulnerable to these problems,
1192 you may enable this feature by specifying:</p>
1194 <pre class="prettyprint lang-config">EnableSendfile On</pre>
1197 <p>For network mounted files, this feature may be disabled explicitly
1198 for the offending files by specifying:</p>
1200 <pre class="prettyprint lang-config">
1201 <Directory "/path-to-nfs-files">
1206 <p>Please note that the per-directory and .htaccess configuration
1207 of <code class="directive">EnableSendfile</code> is not supported by
1208 <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>.
1209 Only global definition of <code class="directive">EnableSendfile</code>
1210 is taken into account by the module.
1214 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1215 <div class="directive-section"><h2><a name="Error" id="Error">Error</a> <a name="error" id="error">Directive</a></h2>
1216 <table class="directive">
1217 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Abort configuration parsing with a custom error message</td></tr>
1218 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Error <var>message</var></code></td></tr>
1219 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1220 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1221 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1222 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.3.9 and later</td></tr>
1224 <p>If an error can be detected within the configuration, this
1225 directive can be used to generate a custom error message, and halt
1226 configuration parsing. The typical use is for reporting required
1227 modules which are missing from the configuration.</p>
1229 <pre class="prettyprint lang-config">
1231 # ensure that mod_include is loaded
1232 <IfModule !include_module>
1233 Error "mod_include is required by mod_foo. Load it with LoadModule."
1236 # ensure that exactly one of SSL,NOSSL is defined
1237 <IfDefine SSL>
1238 <IfDefine NOSSL>
1239 Error "Both SSL and NOSSL are defined. Define only one of them."
1242 <IfDefine !SSL>
1243 <IfDefine !NOSSL>
1244 Error "Either SSL or NOSSL must be defined."
1252 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1253 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
1254 <table class="directive">
1255 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
1256 in case of an error</td></tr>
1257 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
1258 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1259 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1260 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1261 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1263 <p>In the event of a problem or error, Apache httpd can be configured
1264 to do one of four things,</p>
1267 <li>output a simple hardcoded error message</li>
1269 <li>output a customized message</li>
1271 <li>redirect to a local <var>URL-path</var> to handle the
1274 <li>redirect to an external <var>URL</var> to handle the
1278 <p>The first option is the default, while options 2-4 are
1279 configured using the <code class="directive">ErrorDocument</code>
1280 directive, which is followed by the HTTP response code and a URL
1281 or a message. Apache httpd will sometimes offer additional information
1282 regarding the problem/error.</p>
1284 <p>URLs can begin with a slash (/) for local web-paths (relative
1285 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1286 full URL which the client can resolve. Alternatively, a message
1287 can be provided to be displayed by the browser. Examples:</p>
1289 <pre class="prettyprint lang-config">
1290 ErrorDocument 500 http://foo.example.com/cgi-bin/tester
1291 ErrorDocument 404 /cgi-bin/bad_urls.pl
1292 ErrorDocument 401 /subscription_info.html
1293 ErrorDocument 403 "Sorry can't allow you access today"
1294 ErrorDocument 403 Forbidden!
1298 <p>Additionally, the special value <code>default</code> can be used
1299 to specify Apache httpd's simple hardcoded message. While not required
1300 under normal circumstances, <code>default</code> will restore
1301 Apache httpd's simple hardcoded message for configurations that would
1302 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1304 <pre class="prettyprint lang-config">
1305 ErrorDocument 404 /cgi-bin/bad_urls.pl
1307 <Directory /web/docs>
1308 ErrorDocument 404 default
1313 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1314 that points to a remote URL (ie. anything with a method such as
1315 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1316 client to tell it where to find the document, even if the
1317 document ends up being on the same server. This has several
1318 implications, the most important being that the client will not
1319 receive the original error status code, but instead will
1320 receive a redirect status code. This in turn can confuse web
1321 robots and other clients which try to determine if a URL is
1322 valid using the status code. In addition, if you use a remote
1323 URL in an <code>ErrorDocument 401</code>, the client will not
1324 know to prompt the user for a password since it will not
1325 receive the 401 status code. Therefore, <strong>if you use an
1326 <code>ErrorDocument 401</code> directive then it must refer to a local
1327 document.</strong></p>
1329 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1330 server-generated error messages when they are "too small" and substitute
1331 its own "friendly" error messages. The size threshold varies depending on
1332 the type of error, but in general, if you make your error document
1333 greater than 512 bytes, then MSIE will show the server-generated
1334 error rather than masking it. More information is available in
1335 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1337 <p>Although most error messages can be overridden, there are certain
1338 circumstances where the internal messages are used regardless of the
1339 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1340 particular, if a malformed request is detected, normal request processing
1341 will be immediately halted and the internal error message returned.
1342 This is necessary to guard against security problems caused by
1345 <p>If you are using mod_proxy, you may wish to enable
1346 <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1347 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1348 Apache httpd will not generate custom error documents for proxied content.</p>
1352 <li><a href="../custom-error.html">documentation of
1353 customizable responses</a></li>
1356 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1357 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1358 <table class="directive">
1359 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1360 <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>
1361 <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>
1362 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1363 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1364 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1366 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1367 the file to which the server will log any errors it encounters. If
1368 the <var>file-path</var> is not absolute then it is assumed to be
1369 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1371 <pre class="prettyprint lang-config">ErrorLog "/var/log/httpd/error_log"</pre>
1374 <p>If the <var>file-path</var>
1375 begins with a pipe character "<code>|</code>" then it is assumed to be a
1376 command to spawn to handle the error log.</p>
1378 <pre class="prettyprint lang-config">ErrorLog "|/usr/local/bin/httpd_errors"</pre>
1381 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1382 more information.</p>
1384 <p>Using <code>syslog</code> instead of a filename enables logging
1385 via syslogd(8) if the system supports it. The default is to use
1386 syslog facility <code>local7</code>, but you can override this by
1387 using the <code>syslog:<var>facility</var></code> syntax where
1388 <var>facility</var> can be one of the names usually documented in
1389 syslog(1). The facility is effectively global, and if it is changed
1390 in individual virtual hosts, the final facility specified affects the
1393 <pre class="prettyprint lang-config">ErrorLog syslog:user</pre>
1396 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1397 document for details on why your security could be compromised
1398 if the directory where log files are stored is writable by
1399 anyone other than the user that starts the server.</p>
1400 <div class="warning"><h3>Note</h3>
1401 <p>When entering a file path on non-Unix platforms, care should be taken
1402 to make sure that only forward slashes are used even though the platform
1403 may allow the use of back slashes. In general it is a good idea to always
1404 use forward slashes throughout the configuration files.</p>
1409 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1410 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1413 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1414 <div class="directive-section"><h2><a name="ErrorLogFormat" id="ErrorLogFormat">ErrorLogFormat</a> <a name="errorlogformat" id="errorlogformat">Directive</a></h2>
1415 <table class="directive">
1416 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Format specification for error log entries</td></tr>
1417 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLogFormat [connection|request] <var>format</var></code></td></tr>
1418 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1419 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1420 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1421 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.3.9 and later</td></tr>
1423 <p><code class="directive">ErrorLogFormat</code> allows to specify what
1424 supplementary information is logged in the error log in addition to the
1425 actual log message.</p>
1427 <pre class="prettyprint lang-config">
1429 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
1433 <p>Specifying <code>connection</code> or <code>request</code> as first
1434 parameter allows to specify additional formats, causing additional
1435 information to be logged when the first message is logged for a specific
1436 connection or request, respectively. This additional information is only
1437 logged once per connection/request. If a connection or request is processed
1438 without causing any log message, the additional information is not logged
1441 <p>It can happen that some format string items do not produce output. For
1442 example, the Referer header is only present if the log message is
1443 associated to a request and the log message happens at a time when the
1444 Referer header has already been read from the client. If no output is
1445 produced, the default behavior is to delete everything from the preceding
1446 space character to the next space character. This means the log line is
1447 implicitly divided into fields on non-whitespace to whitespace transitions.
1448 If a format string item does not produce output, the whole field is
1449 omitted. For example, if the remote address <code>%a</code> in the log
1450 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1451 brackets are not logged either. Space characters can be escaped with a
1452 backslash to prevent them from delimiting a field. The combination '% '
1453 (percent space) is a zero-witdh field delimiter that does not produce any
1456 <p>The above behavior can be changed by adding modifiers to the format
1457 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1458 respective item does not produce any output. In once-per-connection/request
1459 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1460 item with the plus modifier does not produce any output, the whole line is
1463 <p>A number as modifier can be used to assign a log severity level to a
1464 format item. The item will only be logged if the severity of the log
1465 message is not higher than the specified log severity level. The number can
1466 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1468 <p>For example, here's what would happen if you added modifiers to
1469 the <code>%{Referer}i</code> token, which logs the
1470 <code>Referer</code> request header.</p>
1472 <table class="bordered"><tr class="header"><th>Modified Token</th><th>Meaning</th></tr>
1474 <td><code>%-{Referer}i</code></td>
1475 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1478 <td><code>%+{Referer}i</code></td>
1479 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1482 <td><code>%4{Referer}i</code></td>
1483 <td>Logs the <code>Referer</code> only if the log message severity
1484 is higher than 4.</td>
1488 <p>Some format string items accept additional parameters in braces.</p>
1490 <table class="bordered"><tr class="header"><th>Format String</th> <th>Description</th></tr>
1491 <tr><td><code>%%</code></td>
1492 <td>The percent sign</td></tr>
1493 <tr class="odd"><td><code>%a</code></td>
1494 <td>Client IP address and port of the request</td></tr>
1495 <tr><td><code>%{c}a</code></td>
1496 <td>Underlying peer IP address and port of the connection (see the
1497 <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module)</td></tr>
1498 <tr class="odd"><td><code>%A</code></td>
1499 <td>Local IP-address and port</td></tr>
1500 <tr><td><code>%{<em>name</em>}e</code></td>
1501 <td>Request environment variable <em>name</em></td></tr>
1502 <tr class="odd"><td><code>%E</code></td>
1503 <td>APR/OS error status code and string</td></tr>
1504 <tr><td><code>%F</code></td>
1505 <td>Source file name and line number of the log call</td></tr>
1506 <tr class="odd"><td><code>%{<em>name</em>}i</code></td>
1507 <td>Request header <em>name</em></td></tr>
1508 <tr><td><code>%k</code></td>
1509 <td>Number of keep-alive requests on this connection</td></tr>
1510 <tr class="odd"><td><code>%l</code></td>
1511 <td>Loglevel of the message</td></tr>
1512 <tr><td><code>%L</code></td>
1513 <td>Log ID of the request</td></tr>
1514 <tr class="odd"><td><code>%{c}L</code></td>
1515 <td>Log ID of the connection</td></tr>
1516 <tr><td><code>%{C}L</code></td>
1517 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1518 <tr class="odd"><td><code>%m</code></td>
1519 <td>Name of the module logging the message</td></tr>
1520 <tr><td><code>%M</code></td>
1521 <td>The actual log message</td></tr>
1522 <tr class="odd"><td><code>%{<em>name</em>}n</code></td>
1523 <td>Request note <em>name</em></td></tr>
1524 <tr><td><code>%P</code></td>
1525 <td>Process ID of current process</td></tr>
1526 <tr class="odd"><td><code>%T</code></td>
1527 <td>Thread ID of current thread</td></tr>
1528 <tr><td><code>%{g}T</code></td>
1529 <td>System unique thread ID of current thread (the same ID as
1530 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1531 <tr class="odd"><td><code>%t</code></td>
1532 <td>The current time</td></tr>
1533 <tr><td><code>%{u}t</code></td>
1534 <td>The current time including micro-seconds</td></tr>
1535 <tr class="odd"><td><code>%{cu}t</code></td>
1536 <td>The current time in compact ISO 8601 format, including
1537 micro-seconds</td></tr>
1538 <tr><td><code>%v</code></td>
1539 <td>The canonical <code class="directive"><a href="#servername">ServerName</a></code>
1540 of the current server.</td></tr>
1541 <tr class="odd"><td><code>%V</code></td>
1542 <td>The server name of the server serving the request according to the
1543 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
1545 <tr><td><code>\ </code> (backslash space)</td>
1546 <td>Non-field delimiting space</td></tr>
1547 <tr class="odd"><td><code>% </code> (percent space)</td>
1548 <td>Field delimiter (no output)</td></tr>
1551 <p>The log ID format <code>%L</code> produces a unique id for a connection
1552 or request. This can be used to correlate which log lines belong to the
1553 same connection or request, which request happens on which connection.
1554 A <code>%L</code> format string is also available in
1555 <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>, to allow to correlate access log entries
1556 with error log lines. If <code class="module"><a href="../mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its
1557 unique id will be used as log ID for requests.</p>
1559 <pre class="prettyprint lang-config">
1560 #Example (default format)
1561 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1565 <p>This would result in error messages such as:</p>
1567 <div class="example"><p><code>
1568 [Thu May 12 08:28:57.652118 2011] [core:error] [pid 8777:tid 4326490112] [client ::1:58619] File does not exist: /usr/local/apache2/htdocs/favicon.ico
1571 <p>Notice that, as discussed above, some fields are omitted
1572 entirely because they are not defined.</p>
1574 <pre class="prettyprint lang-config">
1575 #Example (similar to the 2.2.x format)
1576 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
1580 <pre class="prettyprint lang-config">
1581 #Advanced example with request/connection log IDs
1582 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1583 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1584 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1585 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1586 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"
1593 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
1594 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1595 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1598 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1599 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1600 <table class="directive">
1601 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1603 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1604 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1605 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1606 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1607 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1609 <p>This option tracks additional data per worker about the
1610 currently executing request, and a utilization summary; you
1611 can see these variables during runtime by configuring
1612 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>. Note that other modules may
1613 rely on this scoreboard.</p>
1615 <p>This setting applies to the entire server, and cannot be
1616 enabled or disabled on a virtualhost-by-virtualhost basis.
1617 The collection of extended status information can slow down
1618 the server. Also note that this setting cannot be changed
1619 during a graceful restart.</p>
1622 <p>Note that loading <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> will change
1623 the default behavior to ExtendedStatus On, while other
1624 third party modules may do the same. Such modules rely on
1625 collecting detailed information about the state of all workers.
1626 The default is changed by <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> beginning
1627 with version 2.3.6; the previous default was always Off.</p>
1632 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1633 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1634 <table class="directive">
1635 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1636 HTTP response header for static files</td></tr>
1637 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1638 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag MTime Size</code></td></tr>
1639 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1640 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1641 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1642 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1643 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default used to be "INode MTime Size" in 2.3.14 and
1647 The <code class="directive">FileETag</code> directive configures the file
1648 attributes that are used to create the <code>ETag</code> (entity
1649 tag) response header field when the document is based on a static file.
1650 (The <code>ETag</code> value is used in cache management to save
1651 network bandwidth.) The
1652 <code class="directive">FileETag</code> directive allows you to choose
1653 which of these -- if any -- should be used. The recognized keywords are:
1657 <dt><strong>INode</strong></dt>
1658 <dd>The file's i-node number will be included in the calculation</dd>
1659 <dt><strong>MTime</strong></dt>
1660 <dd>The date and time the file was last modified will be included</dd>
1661 <dt><strong>Size</strong></dt>
1662 <dd>The number of bytes in the file will be included</dd>
1663 <dt><strong>All</strong></dt>
1664 <dd>All available fields will be used. This is equivalent to:
1665 <pre class="prettyprint lang-config">FileETag INode MTime Size</pre>
1667 <dt><strong>None</strong></dt>
1668 <dd>If a document is file-based, no <code>ETag</code> field will be
1669 included in the response</dd>
1672 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1673 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1674 which allow changes to be made to the default setting inherited
1675 from a broader scope. Any keyword appearing without such a prefix
1676 immediately and completely cancels the inherited setting.</p>
1678 <p>If a directory's configuration includes
1679 <code>FileETag INode MTime Size</code>, and a
1680 subdirectory's includes <code>FileETag -INode</code>,
1681 the setting for that subdirectory (which will be inherited by
1682 any sub-subdirectories that don't override it) will be equivalent to
1683 <code>FileETag MTime Size</code>.</p>
1684 <div class="warning"><h3>Warning</h3>
1685 Do not change the default for directories or locations that have WebDAV
1686 enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1687 <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>MTime Size</code>
1688 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1689 These conditional requests will break if the <code>ETag</code> format is
1690 changed via <code class="directive">FileETag</code>.
1692 <div class="note"><h3>Server Side Includes</h3>
1693 An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>,
1694 since the response entity can change without a change of the INode, MTime, or Size
1695 of the static file with embedded SSI directives.
1700 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1701 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1702 <table class="directive">
1703 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1705 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1706 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1707 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1708 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1709 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1711 <p>The <code class="directive"><Files></code> directive
1712 limits the scope of the enclosed directives by filename. It is comparable
1713 to the <code class="directive"><a href="#directory"><Directory></a></code>
1714 and <code class="directive"><a href="#location"><Location></a></code>
1715 directives. It should be matched with a <code></Files></code>
1716 directive. The directives given within this section will be applied to
1717 any object with a basename (last component of filename) matching the
1718 specified filename. <code class="directive"><Files></code>
1719 sections are processed in the order they appear in the
1720 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1721 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1722 that <code class="directive"><Files></code> can be nested
1723 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1724 portion of the filesystem they apply to.</p>
1726 <p>The <var>filename</var> argument should include a filename, or
1727 a wild-card string, where <code>?</code> matches any single character,
1728 and <code>*</code> matches any sequences of characters.
1729 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1730 can also be used, with the addition of the
1731 <code>~</code> character. For example:</p>
1733 <pre class="prettyprint lang-config">
1734 <Files ~ "\.(gif|jpe?g|png)$">
1740 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1743 <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
1744 <code>.htaccess</code> files. This allows users to control access to
1745 their own files, at a file-by-file level.</p>
1750 <li><a href="../sections.html">How <Directory>, <Location>
1751 and <Files> sections work</a> for an explanation of how these
1752 different sections are combined when a request is received</li>
1755 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1756 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1757 <table class="directive">
1758 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1760 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1761 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1762 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1763 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1764 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1766 <p>The <code class="directive"><FilesMatch></code> directive
1767 limits the scope of the enclosed directives by filename, just as the
1768 <code class="directive"><a href="#files"><Files></a></code> directive
1769 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1770 expression</a>. For example:</p>
1772 <pre class="prettyprint lang-config">
1773 <FilesMatch "\.(gif|jpe?g|png)$">
1779 <p>would match most common Internet graphics formats.</p>
1783 <li><a href="../sections.html">How <Directory>, <Location>
1784 and <Files> sections work</a> for an explanation of how these
1785 different sections are combined when a request is received</li>
1788 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1789 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1790 <table class="directive">
1791 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1792 media type in the HTTP Content-Type header field</td></tr>
1793 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1794 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1795 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1796 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1797 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1798 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache httpd 2.0</td></tr>
1800 <p>When placed into an <code>.htaccess</code> file or a
1801 <code class="directive"><a href="#directory"><Directory></a></code>, or
1802 <code class="directive"><a href="#location"><Location></a></code> or
1803 <code class="directive"><a href="#files"><Files></a></code>
1804 section, this directive forces all matching files to be served
1805 with the content type identification given by
1806 <var>media-type</var>. For example, if you had a directory full of
1807 GIF files, but did not want to label them all with <code>.gif</code>,
1808 you might want to use:</p>
1810 <pre class="prettyprint lang-config">ForceType image/gif</pre>
1813 <p>Note that this directive overrides other indirect media type
1814 associations defined in mime.types or via the
1815 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1817 <p>You can also override more general
1818 <code class="directive">ForceType</code> settings
1819 by using the value of <code>None</code>:</p>
1821 <pre class="prettyprint lang-config">
1822 # force all files to be image/gif:
1823 <Location /images>
1827 # but normal mime-type associations here:
1828 <Location /images/mixed>
1834 <p>This directive primarily overrides the content types generated for
1835 static files served out of the filesystem. For resources other than
1836 static files, where the generator of the response typically specifies
1837 a Content-Type, this directive has no effect.</p>
1841 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1842 <div class="directive-section"><h2><a name="GprofDir" id="GprofDir">GprofDir</a> <a name="gprofdir" id="gprofdir">Directive</a></h2>
1843 <table class="directive">
1844 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory to write gmon.out profiling data to. </td></tr>
1845 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GprofDir <var>/tmp/gprof/</var>|<var>/tmp/gprof/</var>%</code></td></tr>
1846 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1847 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1848 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1850 <p>When the server has been compiled with gprof profiling support,
1851 <code class="directive">GprofDir</code> causes <code>gmon.out</code> files to
1852 be written to the specified directory when the process exits. If the
1853 argument ends with a percent symbol ('%'), subdirectories are created
1854 for each process id.</p>
1856 <p>This directive currently only works with the <code class="module"><a href="../mod/prefork.html">prefork</a></code>
1860 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1861 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1862 <table class="directive">
1863 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1864 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1865 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1866 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1867 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1868 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1870 <p>This directive enables DNS lookups so that host names can be
1871 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1872 The value <code>Double</code> refers to doing double-reverse
1873 DNS lookup. That is, after a reverse lookup is performed, a forward
1874 lookup is then performed on that result. At least one of the IP
1875 addresses in the forward lookup must match the original
1876 address. (In "tcpwrappers" terminology this is called
1877 <code>PARANOID</code>.)</p>
1879 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1880 used for controlling access by hostname, a double reverse lookup
1881 will be performed. This is necessary for security. Note that the
1882 result of this double-reverse isn't generally available unless you
1883 set <code>HostnameLookups Double</code>. For example, if only
1884 <code>HostnameLookups On</code> and a request is made to an object
1885 that is protected by hostname restrictions, regardless of whether
1886 the double-reverse fails or not, CGIs will still be passed the
1887 single-reverse result in <code>REMOTE_HOST</code>.</p>
1889 <p>The default is <code>Off</code> in order to save the network
1890 traffic for those sites that don't truly need the reverse
1891 lookups done. It is also better for the end users because they
1892 don't have to suffer the extra latency that a lookup entails.
1893 Heavily loaded sites should leave this directive
1894 <code>Off</code>, since DNS lookups can take considerable
1895 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1896 default to the <code>bin</code> subdirectory of your installation
1897 directory, can be used to look up host names from logged IP addresses
1900 <p>Finally, if you have <a href="mod_authz_host.html#reqhost">hostname-based Require
1901 directives</a>, a hostname lookup will be performed regardless of
1902 the setting of <code>HostnameLookups</code>.</p>
1905 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1906 <div class="directive-section"><h2><a name="If" id="If"><If></a> <a name="if" id="if">Directive</a></h2>
1907 <table class="directive">
1908 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1909 satisfied by a request at runtime</td></tr>
1910 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><If <var>expression</var>> ... </If></code></td></tr>
1911 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1912 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1913 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1914 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1916 <p>The <code class="directive"><If></code> directive
1917 evaluates an expression at runtime, and applies the enclosed
1918 directives if and only if the expression evaluates to true.
1921 <pre class="prettyprint lang-config"><If "-z req('Host')"></pre>
1924 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
1925 Expressions may contain various shell-like operators for string
1926 comparison (<code>=</code>, <code>!=</code>, <code><</code>, ...),
1927 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
1928 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
1929 It is also possible to use regular expressions, </p>
1931 <pre class="prettyprint lang-config"><If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"></pre>
1934 <p>shell-like pattern matches and many other operations. These operations
1935 can be done on request headers (<code>req</code>), environment variables
1936 (<code>env</code>), and a large number of other properties. The full
1937 documentation is available in <a href="../expr.html">Expressions in
1938 Apache HTTP Server</a>.</p>
1943 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1944 for a complete reference and more examples.</li>
1945 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
1946 <li><code class="directive"><a href="#else"><Else></a></code></li>
1947 <li><a href="../sections.html">How <Directory>, <Location>,
1948 <Files> sections work</a> for an explanation of how these
1949 different sections are combined when a request is received.
1950 <code class="directive"><If></code>,
1951 <code class="directive"><ElseIf></code>, and
1952 <code class="directive"><Else></code> are applied last.</li>
1955 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1956 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1957 <table class="directive">
1958 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1959 if a test is true at startup</td></tr>
1960 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
1961 </IfDefine></code></td></tr>
1962 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1963 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1964 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1965 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1967 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1968 </code> section is used to mark directives that are conditional. The
1969 directives within an <code class="directive"><IfDefine></code>
1970 section are only processed if the <var>test</var> is true. If <var>
1971 test</var> is false, everything between the start and end markers is
1974 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
1977 <li><var>parameter-name</var></li>
1979 <li><code>!</code><var>parameter-name</var></li>
1982 <p>In the former case, the directives between the start and end
1983 markers are only processed if the parameter named
1984 <var>parameter-name</var> is defined. The second format reverses
1985 the test, and only processes the directives if
1986 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1988 <p>The <var>parameter-name</var> argument is a define as given on the
1989 <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
1990 </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
1992 <p><code class="directive"><IfDefine></code> sections are
1993 nest-able, which can be used to implement simple
1994 multiple-parameter tests. Example:</p>
1996 <div class="example"><p><code>httpd -DReverseProxy -DUseCache -DMemCache ...</code></p></div>
1997 <pre class="prettyprint lang-config">
1998 <IfDefine ReverseProxy>
1999 LoadModule proxy_module modules/mod_proxy.so
2000 LoadModule proxy_http_module modules/mod_proxy_http.so
2001 <IfDefine UseCache>
2002 LoadModule cache_module modules/mod_cache.so
2003 <IfDefine MemCache>
2004 LoadModule mem_cache_module modules/mod_mem_cache.so
2006 <IfDefine !MemCache>
2007 LoadModule cache_disk_module modules/mod_cache_disk.so
2015 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2016 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
2017 <table class="directive">
2018 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2019 presence or absence of a specific module</td></tr>
2020 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2021 </IfModule></code></td></tr>
2022 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2023 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2024 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2025 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2026 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Module identifiers are available in version 2.1 and
2029 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
2030 section is used to mark directives that are conditional on the presence of
2031 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
2032 is true. If <var>test</var> is false, everything between the start and
2033 end markers is ignored.</p>
2035 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
2038 <li><var>module</var></li>
2040 <li>!<var>module</var></li>
2043 <p>In the former case, the directives between the start and end
2044 markers are only processed if the module named <var>module</var>
2045 is included in Apache httpd -- either compiled in or
2046 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
2047 and only processes the directives if <var>module</var> is
2048 <strong>not</strong> included.</p>
2050 <p>The <var>module</var> argument can be either the module identifier or
2051 the file name of the module, at the time it was compiled. For example,
2052 <code>rewrite_module</code> is the identifier and
2053 <code>mod_rewrite.c</code> is the file name. If a module consists of
2054 several source files, use the name of the file containing the string
2055 <code>STANDARD20_MODULE_STUFF</code>.</p>
2057 <p><code class="directive"><IfModule></code> sections are
2058 nest-able, which can be used to implement simple multiple-module
2061 <div class="note">This section should only be used if you need to have one
2062 configuration file that works whether or not a specific module
2063 is available. In normal operation, directives need not be
2064 placed in <code class="directive"><IfModule></code>
2068 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2069 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
2070 <table class="directive">
2071 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2072 the server configuration files</td></tr>
2073 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Include <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></code></td></tr>
2074 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2075 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2076 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2077 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later, directory
2078 wildcard matching available in 2.3.6 and later</td></tr>
2080 <p>This directive allows inclusion of other configuration files
2081 from within the server configuration files.</p>
2083 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2084 in the filename or directory parts of the path to include several files
2085 at once, in alphabetical order. In addition, if
2086 <code class="directive">Include</code> points to a directory, rather than a file,
2087 Apache httpd will read all files in that directory and any subdirectory.
2088 However, including entire directories is not recommended, because it is
2089 easy to accidentally leave temporary files in a directory that can cause
2090 <code class="program"><a href="../programs/httpd.html">httpd</a></code> to fail. Instead, we encourage you to use the
2091 wildcard syntax shown below, to include files that match a particular
2092 pattern, such as *.conf, for example.</p>
2094 <p>The <code class="directive"><a href="#include">Include</a></code> directive will
2095 <strong>fail with an error</strong> if a wildcard expression does not
2096 match any file. The <code class="directive"><a href="#includeoptional">IncludeOptional</a></code>
2097 directive can be used if non-matching wildcards should be ignored.</p>
2099 <p>The file path specified may be an absolute path, or may be relative
2100 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
2104 <pre class="prettyprint lang-config">
2105 Include /usr/local/apache2/conf/ssl.conf
2106 Include /usr/local/apache2/conf/vhosts/*.conf
2110 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
2112 <pre class="prettyprint lang-config">
2113 Include conf/ssl.conf
2114 Include conf/vhosts/*.conf
2118 <p>Wildcards may be included in the directory or file portion of the
2119 path. This example will fail if there is no subdirectory in conf/vhosts
2120 that contains at least one *.conf file:</p>
2122 <pre class="prettyprint lang-config">Include conf/vhosts/*/*.conf</pre>
2125 <p>Alternatively, the following command will just be ignored in case of
2126 missing files or directories:</p>
2128 <pre class="prettyprint lang-config">IncludeOptional conf/vhosts/*/*.conf</pre>
2134 <li><code class="directive"><a href="#includeoptional">IncludeOptional</a></code></li>
2135 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2138 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2139 <div class="directive-section"><h2><a name="IncludeOptional" id="IncludeOptional">IncludeOptional</a> <a name="includeoptional" id="includeoptional">Directive</a></h2>
2140 <table class="directive">
2141 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2142 the server configuration files</td></tr>
2143 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>IncludeOptional <var>file-path</var>|<var>directory-path</var>|<var>wildcard</var></code></td></tr>
2144 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2145 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2146 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2147 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in 2.3.6 and later</td></tr>
2149 <p>This directive allows inclusion of other configuration files
2150 from within the server configuration files. It works identically to the
2151 <code class="directive"><a href="#include">Include</a></code> directive, with the
2152 exception that if wildcards do not match any file or directory, the
2153 <code class="directive"><a href="#includeoptional">IncludeOptional</a></code> directive will be
2154 silently ignored instead of causing an error.</p>
2158 <li><code class="directive"><a href="#include">Include</a></code></li>
2159 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2162 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2163 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
2164 <table class="directive">
2165 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
2166 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
2167 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
2168 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2169 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2170 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2172 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2173 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2174 which allow multiple requests to be sent over the same TCP
2175 connection. In some cases this has been shown to result in an
2176 almost 50% speedup in latency times for HTML documents with
2177 many images. To enable Keep-Alive connections, set
2178 <code>KeepAlive On</code>.</p>
2180 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2181 used if they are specifically requested by a client. In
2182 addition, a Keep-Alive connection with an HTTP/1.0 client can
2183 only be used when the length of the content is known in
2184 advance. This implies that dynamic content such as CGI output,
2185 SSI pages, and server-generated directory listings will
2186 generally not use Keep-Alive connections to HTTP/1.0 clients.
2187 For HTTP/1.1 clients, persistent connections are the default
2188 unless otherwise specified. If the client requests it, chunked
2189 encoding will be used in order to send content of unknown
2190 length over persistent connections.</p>
2192 <p>When a client uses a Keep-Alive connection it will be counted
2193 as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> directive, regardless
2194 of how many requests are sent using the connection.</p>
2198 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
2201 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2202 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
2203 <table class="directive">
2204 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
2205 requests on a persistent connection</td></tr>
2206 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
2207 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
2208 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2209 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2210 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2211 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Specifying a value in milliseconds is available in
2212 Apache httpd 2.3.2 and later</td></tr>
2214 <p>The number of seconds Apache httpd will wait for a subsequent
2215 request before closing the connection. By adding a postfix of ms the
2216 timeout can be also set in milliseconds. Once a request has been
2217 received, the timeout value specified by the
2218 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
2220 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
2221 may cause performance problems in heavily loaded servers. The
2222 higher the timeout, the more server processes will be kept
2223 occupied waiting on connections with idle clients.</p>
2225 <p>In a name-based virtual host context, the value of the first
2226 defined virtual host best matching the local IP and port will be used.</p>
2229 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2230 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
2231 <table class="directive">
2232 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
2234 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
2235 </Limit></code></td></tr>
2236 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2237 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2241 <p>Access controls are normally effective for
2242 <strong>all</strong> access methods, and this is the usual
2243 desired behavior. <strong>In the general case, access control
2244 directives should not be placed within a
2245 <code class="directive"><Limit></code> section.</strong></p>
2247 <p>The purpose of the <code class="directive"><Limit></code>
2248 directive is to restrict the effect of the access controls to the
2249 nominated HTTP methods. For all other methods, the access
2250 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
2251 effect</strong>. The following example applies the access control
2252 only to the methods <code>POST</code>, <code>PUT</code>, and
2253 <code>DELETE</code>, leaving all other methods unprotected:</p>
2255 <pre class="prettyprint lang-config">
2256 <Limit POST PUT DELETE>
2262 <p>The method names listed can be one or more of: <code>GET</code>,
2263 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2264 <code>CONNECT</code>, <code>OPTIONS</code>,
2265 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2266 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2267 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2268 case-sensitive.</strong> If <code>GET</code> is used it will also
2269 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2270 cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
2272 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
2273 used in preference to a <code class="directive"><Limit></code>
2274 section when restricting access, since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
2275 against arbitrary methods.</div>
2277 <p>The <code class="directive"><Limit></code> and
2278 <code class="directive"><a href="#limitexcept"><LimitExcept></a></code>
2279 directives may be nested. In this case, each successive level of
2280 <code class="directive"><Limit></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> directives must
2281 further restrict the set of methods to which access controls apply.</p>
2283 <div class="warning">When using
2284 <code class="directive"><Limit></code> or
2285 <code class="directive"><LimitExcept></code> directives with
2286 the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
2287 note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
2288 to succeed authorizes the request, regardless of the presence of other
2289 <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
2291 <p>For example, given the following configuration, all users will
2292 be authorized for <code>POST</code> requests, and the
2293 <code>Require group editors</code> directive will be ignored
2296 <pre class="prettyprint lang-config">
2297 <LimitExcept GET>
2299 </LimitExcept>
2301 Require group editors
2307 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2308 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
2309 <table class="directive">
2310 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
2311 except the named ones</td></tr>
2312 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2313 </LimitExcept></code></td></tr>
2314 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2315 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2316 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2317 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2319 <p><code class="directive"><LimitExcept></code> and
2320 <code></LimitExcept></code> are used to enclose
2321 a group of access control directives which will then apply to any
2322 HTTP access method <strong>not</strong> listed in the arguments;
2323 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
2324 both standard and nonstandard/unrecognized methods. See the
2325 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
2329 <pre class="prettyprint lang-config">
2330 <LimitExcept POST GET>
2332 </LimitExcept>
2338 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2339 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
2340 <table class="directive">
2341 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
2342 subrequests</td></tr>
2343 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
2344 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
2345 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2346 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2347 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2348 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.0.47 and later</td></tr>
2350 <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
2351 redirects the original request to a CGI script. A subrequest is Apache httpd's
2352 mechanism to find out what would happen for some URI if it were requested.
2353 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
2354 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2357 <p><code class="directive">LimitInternalRecursion</code> prevents the server
2358 from crashing when entering an infinite loop of internal redirects or
2359 subrequests. Such loops are usually caused by misconfigurations.</p>
2361 <p>The directive stores two different limits, which are evaluated on
2362 per-request basis. The first <var>number</var> is the maximum number of
2363 internal redirects, that may follow each other. The second <var>number</var>
2364 determines, how deep subrequests may be nested. If you specify only one
2365 <var>number</var>, it will be assigned to both limits.</p>
2367 <pre class="prettyprint lang-config">LimitInternalRecursion 5</pre>
2371 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2372 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
2373 <table class="directive">
2374 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
2375 from the client</td></tr>
2376 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
2377 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
2378 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2379 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2380 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2381 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2383 <p>This directive specifies the number of <var>bytes</var> from 0
2384 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2385 request body. See the note below for the limited applicability
2386 to proxy requests.</p>
2388 <p>The <code class="directive">LimitRequestBody</code> directive allows
2389 the user to set a limit on the allowed size of an HTTP request
2390 message body within the context in which the directive is given
2391 (server, per-directory, per-file or per-location). If the client
2392 request exceeds that limit, the server will return an error
2393 response instead of servicing the request. The size of a normal
2394 request message body will vary greatly depending on the nature of
2395 the resource and the methods allowed on that resource. CGI scripts
2396 typically use the message body for retrieving form information.
2397 Implementations of the <code>PUT</code> method will require
2398 a value at least as large as any representation that the server
2399 wishes to accept for that resource.</p>
2401 <p>This directive gives the server administrator greater
2402 control over abnormal client request behavior, which may be
2403 useful for avoiding some forms of denial-of-service
2406 <p>If, for example, you are permitting file upload to a particular
2407 location, and wish to limit the size of the uploaded file to 100K,
2408 you might use the following directive:</p>
2410 <pre class="prettyprint lang-config">LimitRequestBody 102400</pre>
2413 <div class="note"><p>For a full description of how this directive is interpreted by
2414 proxy requests, see the <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> documentation.</p>
2419 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2420 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
2421 <table class="directive">
2422 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
2423 will be accepted from the client</td></tr>
2424 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
2425 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
2426 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2427 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2428 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2430 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2431 32767. The default value is defined by the compile-time
2432 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2435 <p>The <code class="directive">LimitRequestFields</code> directive allows
2436 the server administrator to modify the limit on the number of
2437 request header fields allowed in an HTTP request. A server needs
2438 this value to be larger than the number of fields that a normal
2439 client request might include. The number of request header fields
2440 used by a client rarely exceeds 20, but this may vary among
2441 different client implementations, often depending upon the extent
2442 to which a user has configured their browser to support detailed
2443 content negotiation. Optional HTTP extensions are often expressed
2444 using request header fields.</p>
2446 <p>This directive gives the server administrator greater
2447 control over abnormal client request behavior, which may be
2448 useful for avoiding some forms of denial-of-service attacks.
2449 The value should be increased if normal clients see an error
2450 response from the server that indicates too many fields were
2451 sent in the request.</p>
2455 <pre class="prettyprint lang-config">LimitRequestFields 50</pre>
2458 <div class="warning"><h3>Warning</h3>
2459 <p> When name-based virtual hosting is used, the value for this
2460 directive is taken from the default (first-listed) virtual host for the
2461 local IP and port combination</p>.
2466 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2467 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
2468 <table class="directive">
2469 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
2471 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
2472 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
2473 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2474 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2475 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2477 <p>This directive specifies the number of <var>bytes</var>
2478 that will be allowed in an HTTP request header.</p>
2480 <p>The <code class="directive">LimitRequestFieldSize</code> directive
2481 allows the server administrator to set the limit
2482 on the allowed size of an HTTP request header field. A server
2483 needs this value to be large enough to hold any one header field
2484 from a normal client request. The size of a normal request header
2485 field will vary greatly among different client implementations,
2486 often depending upon the extent to which a user has configured
2487 their browser to support detailed content negotiation. SPNEGO
2488 authentication headers can be up to 12392 bytes.</p>
2490 <p>This directive gives the server administrator greater
2491 control over abnormal client request behavior, which may be
2492 useful for avoiding some forms of denial-of-service attacks.</p>
2496 <pre class="prettyprint lang-config">LimitRequestFieldSize 4094</pre>
2499 <div class="note">Under normal conditions, the value should not be changed from
2500 the default. Also, you can't set this higher than 8190 without
2501 modifying the source code and rebuilding.</div>
2503 <div class="warning"><h3>Warning</h3>
2504 <p> When name-based virtual hosting is used, the value for this
2505 directive is taken from the default (first-listed) virtual host best
2506 matching the current IP address and port combination.</p>
2510 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2511 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
2512 <table class="directive">
2513 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
2514 from the client</td></tr>
2515 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
2516 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
2517 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2518 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2519 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2521 <p>This directive sets the number of <var>bytes</var> that will be
2522 allowed on the HTTP request-line.</p>
2524 <p>The <code class="directive">LimitRequestLine</code> directive allows
2525 the server administrator to set the limit on the allowed size
2526 of a client's HTTP request-line. Since the request-line consists of the
2527 HTTP method, URI, and protocol version, the
2528 <code class="directive">LimitRequestLine</code> directive places a
2529 restriction on the length of a request-URI allowed for a request
2530 on the server. A server needs this value to be large enough to
2531 hold any of its resource names, including any information that
2532 might be passed in the query part of a <code>GET</code> request.</p>
2534 <p>This directive gives the server administrator greater
2535 control over abnormal client request behavior, which may be
2536 useful for avoiding some forms of denial-of-service attacks.</p>
2540 <pre class="prettyprint lang-config">LimitRequestLine 4094</pre>
2543 <div class="note">Under normal conditions, the value should not be changed from
2544 the default. Also, you can't set this higher than 8190 without
2545 modifying the source and rebuilding.</div>
2547 <div class="warning"><h3>Warning</h3>
2548 <p> When name-based virtual hosting is used, the value for this
2549 directive is taken from the default (first-listed) virtual host best
2550 matching the current IP address and port combination.</p>
2555 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2556 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
2557 <table class="directive">
2558 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
2559 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
2560 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
2561 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2562 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2563 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2564 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2566 <p>Limit (in bytes) on maximum size of an XML-based request
2567 body. A value of <code>0</code> will disable any checking.</p>
2571 <pre class="prettyprint lang-config">LimitXMLRequestBody 0</pre>
2576 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2577 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
2578 <table class="directive">
2579 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2581 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
2582 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
2583 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2584 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2585 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2587 <p>The <code class="directive"><Location></code> directive
2588 limits the scope of the enclosed directives by URL. It is similar to the
2589 <code class="directive"><a href="#directory"><Directory></a></code>
2590 directive, and starts a subsection which is terminated with a
2591 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
2592 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
2593 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
2595 <p><code class="directive"><Location></code> sections operate
2596 completely outside the filesystem. This has several consequences.
2597 Most importantly, <code class="directive"><Location></code>
2598 directives should not be used to control access to filesystem
2599 locations. Since several different URLs may map to the same
2600 filesystem location, such access controls may by circumvented.</p>
2602 <p>The enclosed directives will be applied to the request if the path component
2603 of the URL meets <em>any</em> of the following criteria:
2606 <li>The specified location matches exactly the path component of the URL.
2608 <li>The specified location, which ends in a forward slash, is a prefix
2609 of the path component of the URL (treated as a context root).
2611 <li>The specified location, with the addition of a trailing slash, is a
2612 prefix of the path component of the URL (also treated as a context root).
2616 In the example below, where no trailing slash is used, requests to
2617 /private1, /private1/ and /private1/file.txt will have the enclosed
2618 directives applied, but /private1other would not.
2620 <pre class="prettyprint lang-config">
2621 <Location /private1>
2627 In the example below, where a trailing slash is used, requests to
2628 /private2/ and /private2/file.txt will have the enclosed
2629 directives applied, but /private2 and /private2other would not.
2631 <pre class="prettyprint lang-config">
2632 <Location /private2<em>/</em>>
2638 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
2640 <p>Use <code class="directive"><Location></code> to apply
2641 directives to content that lives outside the filesystem. For
2642 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
2643 <code><Location /></code>, which is an easy way to
2644 apply a configuration to the entire server.</p>
2647 <p>For all origin (non-proxy) requests, the URL to be matched is a
2648 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
2649 port, or query string may be included.</em> For proxy requests, the
2650 URL to be matched is of the form
2651 <code>scheme://servername/path</code>, and you must include the
2654 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
2655 any single character, and <code>*</code> matches any sequences of
2656 characters. Neither wildcard character matches a / in the URL-path.</p>
2658 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
2659 can also be used, with the addition of the <code>~</code>
2660 character. For example:</p>
2662 <pre class="prettyprint lang-config">
2663 <Location ~ "/(extra|special)/data">
2669 <p>would match URLs that contained the substring <code>/extra/data</code>
2670 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
2671 identical to the regex version of <code class="directive"><Location></code>, and is preferred, for the
2672 simple reason that <code>~</code> is hard to distinguish from
2673 <code>-</code> in many fonts.</p>
2675 <p>The <code class="directive"><Location></code>
2676 functionality is especially useful when combined with the
2677 <code class="directive"><a href="#sethandler">SetHandler</a></code>
2678 directive. For example, to enable status requests, but allow them
2679 only from browsers at <code>example.com</code>, you might use:</p>
2681 <pre class="prettyprint lang-config">
2682 <Location /status>
2683 SetHandler server-status
2684 Require host example.com
2689 <div class="note"><h3>Note about / (slash)</h3>
2690 <p>The slash character has special meaning depending on where in a
2691 URL it appears. People may be used to its behavior in the filesystem
2692 where multiple adjacent slashes are frequently collapsed to a single
2693 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2694 <code>/home/foo</code>). In URL-space this is not necessarily true.
2695 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
2696 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
2697 slashes if that is your intention.</p>
2699 <p>For example, <code><LocationMatch ^/abc></code> would match
2700 the request URL <code>/abc</code> but not the request URL <code>
2701 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
2702 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
2703 implicitly match multiple slashes with a single slash. For example,
2704 if you specify <code><Location /abc/def></code> and the
2705 request is to <code>/abc//def</code> then it will match.</p>
2710 <li><a href="../sections.html">How <Directory>, <Location>
2711 and <Files> sections work</a> for an explanation of how these
2712 different sections are combined when a request is received.</li>
2713 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
2716 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2717 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2718 <table class="directive">
2719 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2720 matching URLs</td></tr>
2721 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
2722 <var>regex</var>> ... </LocationMatch></code></td></tr>
2723 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2724 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2725 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2727 <p>The <code class="directive"><LocationMatch></code> directive
2728 limits the scope of the enclosed directives by URL, in an identical manner
2729 to <code class="directive"><a href="#location"><Location></a></code>. However,
2730 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2731 as an argument instead of a simple string. For example:</p>
2733 <pre class="prettyprint lang-config">
2734 <LocationMatch "/(extra|special)/data">
2736 </LocationMatch>
2740 <p>would match URLs that contained the substring <code>/extra/data</code>
2741 or <code>/special/data</code>.</p>
2745 <li><a href="../sections.html">How <Directory>, <Location>
2746 and <Files> sections work</a> for an explanation of how these
2747 different sections are combined when a request is received</li>
2750 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2751 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2752 <table class="directive">
2753 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2754 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel [<var>module</var>:]<var>level</var>
2755 [<var>module</var>:<var>level</var>] ...
2757 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2758 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2759 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2760 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2761 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Per-module and per-directory configuration is available in
2762 Apache HTTP Server 2.3.6 and later</td></tr>
2764 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2765 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2766 <var>level</var>s are available, in order of decreasing
2769 <table class="bordered">
2772 <th><strong>Level</strong> </th>
2774 <th><strong>Description</strong> </th>
2776 <th><strong>Example</strong> </th>
2780 <td><code>emerg</code> </td>
2782 <td>Emergencies - system is unusable.</td>
2784 <td>"Child cannot open lock file. Exiting"</td>
2788 <td><code>alert</code> </td>
2790 <td>Action must be taken immediately.</td>
2792 <td>"getpwuid: couldn't determine user name from uid"</td>
2796 <td><code>crit</code> </td>
2798 <td>Critical Conditions.</td>
2800 <td>"socket: Failed to get a socket, exiting child"</td>
2804 <td><code>error</code> </td>
2806 <td>Error conditions.</td>
2808 <td>"Premature end of script headers"</td>
2812 <td><code>warn</code> </td>
2814 <td>Warning conditions.</td>
2816 <td>"child process 1234 did not exit, sending another
2821 <td><code>notice</code> </td>
2823 <td>Normal but significant condition.</td>
2825 <td>"httpd: caught SIGBUS, attempting to dump core in
2830 <td><code>info</code> </td>
2832 <td>Informational.</td>
2834 <td>"Server seems busy, (you may need to increase
2835 StartServers, or Min/MaxSpareServers)..."</td>
2839 <td><code>debug</code> </td>
2841 <td>Debug-level messages</td>
2843 <td>"Opening config file ..."</td>
2846 <td><code>trace1</code> </td>
2848 <td>Trace messages</td>
2850 <td>"proxy: FTP: control connection complete"</td>
2853 <td><code>trace2</code> </td>
2855 <td>Trace messages</td>
2857 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
2860 <td><code>trace3</code> </td>
2862 <td>Trace messages</td>
2864 <td>"openssl: Handshake: start"</td>
2867 <td><code>trace4</code> </td>
2869 <td>Trace messages</td>
2871 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
2874 <td><code>trace5</code> </td>
2876 <td>Trace messages</td>
2878 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
2881 <td><code>trace6</code> </td>
2883 <td>Trace messages</td>
2885 <td>"cache lookup FAILED, forcing new map lookup"</td>
2888 <td><code>trace7</code> </td>
2890 <td>Trace messages, dumping large amounts of data</td>
2892 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2895 <td><code>trace8</code> </td>
2897 <td>Trace messages, dumping large amounts of data</td>
2899 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
2903 <p>When a particular level is specified, messages from all
2904 other levels of higher significance will be reported as well.
2905 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2906 then messages with log levels of <code>notice</code> and
2907 <code>warn</code> will also be posted.</p>
2909 <p>Using a level of at least <code>crit</code> is
2914 <pre class="prettyprint lang-config">LogLevel notice</pre>
2917 <div class="note"><h3>Note</h3>
2918 <p>When logging to a regular file messages of the level
2919 <code>notice</code> cannot be suppressed and thus are always
2920 logged. However, this doesn't apply when logging is done
2921 using <code>syslog</code>.</p>
2924 <p>Specifying a level without a module name will reset the level
2925 for all modules to that level. Specifying a level with a module
2926 name will set the level for that module only. It is possible to
2927 use the module source file name, the module identifier, or the
2928 module identifier with the trailing <code>_module</code> omitted
2929 as module specification. This means the following three specifications
2932 <pre class="prettyprint lang-config">
2933 LogLevel info ssl:warn
2934 LogLevel info mod_ssl.c:warn
2935 LogLevel info ssl_module:warn
2939 <p>It is also possible to change the level per directory:</p>
2941 <pre class="prettyprint lang-config">
2943 <Directory "/usr/local/apache/htdocs/app">
2950 Per directory loglevel configuration only affects messages that are
2951 logged after the request has been parsed and that are associated with
2952 the request. Log messages which are associated with the connection or
2953 the server are not affected.
2957 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2958 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
2959 <table class="directive">
2960 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
2961 connection</td></tr>
2962 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
2963 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
2964 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2965 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2966 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2968 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
2969 limits the number of requests allowed per connection when
2970 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
2971 set to <code>0</code>, unlimited requests will be allowed. We
2972 recommend that this setting be kept to a high value for maximum
2973 server performance.</p>
2977 <pre class="prettyprint lang-config">MaxKeepAliveRequests 500</pre>
2981 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2982 <div class="directive-section"><h2><a name="MaxRangeOverlaps" id="MaxRangeOverlaps">MaxRangeOverlaps</a> <a name="maxrangeoverlaps" id="maxrangeoverlaps">Directive</a></h2>
2983 <table class="directive">
2984 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of overlapping ranges (eg: <code>100-200,150-300</code>) allowed before returning the complete
2986 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRangeOverlaps default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
2987 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeOverlaps 20</code></td></tr>
2988 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2989 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2990 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2991 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
2993 <p>The <code class="directive">MaxRangeOverlaps</code> directive
2994 limits the number of overlapping HTTP ranges the server is willing to
2995 return to the client. If more overlapping ranges then permitted are requested,
2996 the complete resource is returned instead.</p>
2999 <dt><strong>default</strong></dt>
3000 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3002 <dt><strong>none</strong></dt>
3003 <dd>No overlapping Range headers are allowed.</dd>
3005 <dt><strong>unlimited</strong></dt>
3006 <dd>The server does not limit the number of overlapping ranges it is
3007 willing to satisfy.</dd>
3009 <dt><var>number-of-ranges</var></dt>
3010 <dd>A positive number representing the maximum number of overlapping ranges the
3011 server is willing to satisfy.</dd>
3015 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3016 <div class="directive-section"><h2><a name="MaxRangeReversals" id="MaxRangeReversals">MaxRangeReversals</a> <a name="maxrangereversals" id="maxrangereversals">Directive</a></h2>
3017 <table class="directive">
3018 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of range reversals (eg: <code>100-200,50-70</code>) allowed before returning the complete
3020 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRangeReversals default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
3021 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeReversals 20</code></td></tr>
3022 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3023 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3024 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3025 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3027 <p>The <code class="directive">MaxRangeReversals</code> directive
3028 limits the number of HTTP Range reversals the server is willing to
3029 return to the client. If more ranges reversals then permitted are requested,
3030 the complete resource is returned instead.</p>
3033 <dt><strong>default</strong></dt>
3034 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3036 <dt><strong>none</strong></dt>
3037 <dd>No Range reversals headers are allowed.</dd>
3039 <dt><strong>unlimited</strong></dt>
3040 <dd>The server does not limit the number of range reversals it is
3041 willing to satisfy.</dd>
3043 <dt><var>number-of-ranges</var></dt>
3044 <dd>A positive number representing the maximum number of range reversals the
3045 server is willing to satisfy.</dd>
3049 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3050 <div class="directive-section"><h2><a name="MaxRanges" id="MaxRanges">MaxRanges</a> <a name="maxranges" id="maxranges">Directive</a></h2>
3051 <table class="directive">
3052 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of ranges allowed before returning the complete
3054 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRanges default | unlimited | none | <var>number-of-ranges</var></code></td></tr>
3055 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRanges 200</code></td></tr>
3056 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3057 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3058 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3059 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3061 <p>The <code class="directive">MaxRanges</code> directive
3062 limits the number of HTTP ranges the server is willing to
3063 return to the client. If more ranges then permitted are requested,
3064 the complete resource is returned instead.</p>
3067 <dt><strong>default</strong></dt>
3068 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3070 <dt><strong>none</strong></dt>
3071 <dd>Range headers are ignored.</dd>
3073 <dt><strong>unlimited</strong></dt>
3074 <dd>The server does not limit the number of ranges it is
3075 willing to satisfy.</dd>
3077 <dt><var>number-of-ranges</var></dt>
3078 <dd>A positive number representing the maximum number of ranges the
3079 server is willing to satisfy.</dd>
3083 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3084 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
3085 <table class="directive">
3086 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
3087 or specified mutexes</td></tr>
3088 <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>
3089 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
3090 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3091 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3092 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3093 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.4 and later</td></tr>
3095 <p>The <code class="directive">Mutex</code> directive sets the mechanism,
3096 and optionally the lock file location, that httpd and modules use
3097 to serialize access to resources. Specify <code>default</code> as
3098 the first argument to change the settings for all mutexes; specify
3099 a mutex name (see table below) as the first argument to override
3100 defaults only for that mutex.</p>
3102 <p>The <code class="directive">Mutex</code> directive is typically used in
3103 the following exceptional situations:</p>
3106 <li>change the mutex mechanism when the default mechanism selected
3107 by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
3110 <li>change the directory used by file-based mutexes when the
3111 default directory does not support locking</li>
3114 <div class="note"><h3>Supported modules</h3>
3115 <p>This directive only configures mutexes which have been registered
3116 with the core server using the <code>ap_mutex_register()</code> API.
3117 All modules bundled with httpd support the <code class="directive">Mutex</code>
3118 directive, but third-party modules may not. Consult the documentation
3119 of the third-party module, which must indicate the mutex name(s) which
3120 can be configured if this directive is supported.</p>
3123 <p>The following mutex <em>mechanisms</em> are available:</p>
3125 <li><code>default | yes</code>
3126 <p>This selects the default locking implementation, as determined by
3127 <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>. The default locking implementation can
3128 be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
3129 <code>-V</code> option.</p></li>
3131 <li><code>none | no</code>
3132 <p>This effectively disables the mutex, and is only allowed for a
3133 mutex if the module indicates that it is a valid choice. Consult the
3134 module documentation for more information.</p></li>
3136 <li><code>posixsem</code>
3137 <p>This is a mutex variant based on a Posix semaphore.</p>
3139 <div class="warning"><h3>Warning</h3>
3140 <p>The semaphore ownership is not recovered if a thread in the process
3141 holding the mutex segfaults, resulting in a hang of the web server.</p>
3145 <li><code>sysvsem</code>
3146 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3148 <div class="warning"><h3>Warning</h3>
3149 <p>It is possible to "leak" SysV semaphores if processes crash
3150 before the semaphore is removed.</p>
3153 <div class="warning"><h3>Security</h3>
3154 <p>The semaphore API allows for a denial of service attack by any
3155 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3156 all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
3157 or <code>cgiwrapper</code>).</p>
3161 <li><code>sem</code>
3162 <p>This selects the "best" available semaphore implementation, choosing
3163 between Posix and SystemV IPC semaphores, in that order.</p></li>
3165 <li><code>pthread</code>
3166 <p>This is a mutex variant based on cross-process Posix thread
3169 <div class="warning"><h3>Warning</h3>
3170 <p>On most systems, if a child process terminates abnormally while
3171 holding a mutex that uses this implementation, the server will deadlock
3172 and stop responding to requests. When this occurs, the server will
3173 require a manual restart to recover.</p>
3174 <p>Solaris is a notable exception as it provides a mechanism which
3175 usually allows the mutex to be recovered after a child process
3176 terminates abnormally while holding a mutex.</p>
3177 <p>If your system implements the
3178 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3179 to use the <code>pthread</code> option safely.</p>
3183 <li><code>fcntl:/path/to/mutex</code>
3184 <p>This is a mutex variant where a physical (lock-)file and the
3185 <code>fcntl()</code> function are used as the mutex.</p>
3187 <div class="warning"><h3>Warning</h3>
3188 <p>When multiple mutexes based on this mechanism are used within
3189 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3190 can be reported for valid mutex operations if <code>fcntl()</code>
3191 is not thread-aware, such as on Solaris.</p>
3195 <li><code>flock:/path/to/mutex</code>
3196 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3197 with the exception that the <code>flock()</code> function is used to
3198 provide file locking.</p></li>
3200 <li><code>file:/path/to/mutex</code>
3201 <p>This selects the "best" available file locking implementation,
3202 choosing between <code>fcntl</code> and <code>flock</code>, in that
3206 <p>Most mechanisms are only available on selected platforms, where the
3207 underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it. Mechanisms
3208 which aren't available on all platforms are <em>posixsem</em>,
3209 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3210 <em>flock</em>, and <em>file</em>.</p>
3212 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3213 the path, if provided, is a directory where the lock file will be created.
3214 The default directory is httpd's run-time file directory relative to
3215 <code class="directive"><a href="#serverroot">ServerRoot</a></code>. Always use a local disk
3216 filesystem for <code>/path/to/mutex</code> and never a directory residing
3217 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3218 type, an optional instance string provided by the module, and unless the
3219 <code>OmitPID</code> keyword is specified, the process id of the httpd
3220 parent process will be appended to to make the file name unique, avoiding
3221 conflicts when multiple httpd instances share a lock file directory. For
3222 example, if the mutex name is <code>mpm-accept</code> and the lock file
3223 directory is <code>/var/httpd/locks</code>, the lock file name for the
3224 httpd instance with parent process id 12345 would be
3225 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3227 <div class="warning"><h3>Security</h3>
3228 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3229 directory such as <code>/var/tmp</code> because someone could create
3230 a denial of service attack and prevent the server from starting by
3231 creating a lockfile with the same name as the one the server will try
3235 <p>The following table documents the names of mutexes used by httpd
3236 and bundled modules.</p>
3238 <table class="bordered"><tr class="header">
3241 <th>Protected resource</th>
3244 <td><code>mpm-accept</code></td>
3245 <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>
3246 <td>incoming connections, to avoid the thundering herd problem;
3247 for more information, refer to the
3248 <a href="../misc/perf-tuning.html">performance tuning</a>
3252 <td><code>authdigest-client</code></td>
3253 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3254 <td>client list in shared memory</td>
3257 <td><code>authdigest-opaque</code></td>
3258 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3259 <td>counter in shared memory</td>
3262 <td><code>ldap-cache</code></td>
3263 <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
3264 <td>LDAP result cache</td>
3267 <td><code>rewrite-map</code></td>
3268 <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
3269 <td>communication with external mapping programs, to avoid
3270 intermixed I/O from multiple requests</td>
3273 <td><code>ssl-cache</code></td>
3274 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3275 <td>SSL session cache</td>
3278 <td><code>ssl-stapling</code></td>
3279 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3280 <td>OCSP stapling response cache</td>
3283 <td><code>watchdog-callback</code></td>
3284 <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
3285 <td>callback function of a particular client module</td>
3289 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3290 parent process id from the lock file name.</p>
3292 <p>In the following example, the mutex mechanism for the MPM accept
3293 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3294 with the associated lock file created in directory
3295 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3296 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3298 <pre class="prettyprint lang-config">
3299 Mutex sysvsem default
3300 Mutex fcntl:/var/httpd/locks mpm-accept
3305 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3306 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
3307 <table class="directive">
3308 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>DEPRECATED: Designates an IP address for name-virtual
3310 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
3311 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3312 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3313 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3316 <p>Prior to 2.3.11, <code class="directive">NameVirtualHost</code> was required
3317 to instruct the server that a particular IP address and port combination
3318 was usable as a name-based virtual host. In 2.3.11 and later,
3319 any time an IP address and port combination is used in multiple virtual
3320 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3322 <p>This directive currently has no effect.</p>
3326 <li><a href="../vhosts/">Virtual Hosts
3327 documentation</a></li>
3330 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3331 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
3332 <table class="directive">
3333 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
3335 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
3336 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
3337 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options FollowSymlinks</code></td></tr>
3338 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3339 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
3340 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3341 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3342 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The default was changed from All to FollowSymlinks in 2.3.11</td></tr>
3344 <p>The <code class="directive">Options</code> directive controls which
3345 server features are available in a particular directory.</p>
3347 <p><var>option</var> can be set to <code>None</code>, in which
3348 case none of the extra features are enabled, or one or more of
3352 <dt><code>All</code></dt>
3354 <dd>All options except for <code>MultiViews</code>.</dd>
3356 <dt><code>ExecCGI</code></dt>
3359 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
3362 <dt><code>FollowSymLinks</code></dt>
3365 The server will follow symbolic links in this directory. This is
3366 the default setting.
3368 <p>Even though the server follows the symlink it does <em>not</em>
3369 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
3370 <p>Note also, that this option <strong>gets ignored</strong> if set
3371 inside a <code class="directive"><a href="#location"><Location></a></code>
3373 <p>Omitting this option should not be considered a security restriction,
3374 since symlink testing is subject to race conditions that make it
3378 <dt><code>Includes</code></dt>
3381 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
3384 <dt><code>IncludesNOEXEC</code></dt>
3388 Server-side includes are permitted, but the <code>#exec
3389 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3390 possible to <code>#include virtual</code> CGI scripts from
3391 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
3394 <dt><code>Indexes</code></dt>
3397 If a URL which maps to a directory is requested, and there
3398 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
3399 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3400 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
3401 of the directory.</dd>
3403 <dt><code>MultiViews</code></dt>
3406 <a href="../content-negotiation.html">Content negotiated</a>
3407 "MultiViews" are allowed using
3408 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.
3409 <div class="note"><h3>Note</h3> <p>This option gets ignored if set
3410 anywhere other than <code class="directive"><a href="#directory"><Directory></a></code>, as <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>
3411 needs real resources to compare against and evaluate from.</p></div>
3414 <dt><code>SymLinksIfOwnerMatch</code></dt>
3416 <dd>The server will only follow symbolic links for which the
3417 target file or directory is owned by the same user id as the
3420 <div class="note"><h3>Note</h3> <p>This option gets ignored if
3421 set inside a <code class="directive"><a href="#location"><Location></a></code> section.</p>
3422 <p>This option should not be considered a security restriction,
3423 since symlink testing is subject to race conditions that make it
3424 circumventable.</p></div>
3428 <p>Normally, if multiple <code class="directive">Options</code> could
3429 apply to a directory, then the most specific one is used and
3430 others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
3431 However if <em>all</em> the options on the
3432 <code class="directive">Options</code> directive are preceded by a
3433 <code>+</code> or <code>-</code> symbol, the options are
3434 merged. Any options preceded by a <code>+</code> are added to the
3435 options currently in force, and any options preceded by a
3436 <code>-</code> are removed from the options currently in
3439 <div class="note"><h3>Note</h3>
3440 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
3441 <code>-</code> with those without is not valid syntax, and will be
3442 rejected during server startup by the syntax check with an abort.</p>
3445 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3447 <pre class="prettyprint lang-config">
3448 <Directory "/web/docs">
3449 Options Indexes FollowSymLinks
3452 <Directory "/web/docs/spec">
3458 <p>then only <code>Includes</code> will be set for the
3459 <code>/web/docs/spec</code> directory. However if the second
3460 <code class="directive">Options</code> directive uses the <code>+</code> and
3461 <code>-</code> symbols:</p>
3463 <pre class="prettyprint lang-config">
3464 <Directory "/web/docs">
3465 Options Indexes FollowSymLinks
3468 <Directory "/web/docs/spec">
3469 Options +Includes -Indexes
3474 <p>then the options <code>FollowSymLinks</code> and
3475 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3478 <div class="note"><h3>Note</h3>
3479 <p>Using <code>-IncludesNOEXEC</code> or
3480 <code>-Includes</code> disables server-side includes completely
3481 regardless of the previous setting.</p>
3484 <p>The default in the absence of any other settings is
3485 <code>FollowSymlinks</code>.</p>
3488 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3489 <div class="directive-section"><h2><a name="Protocol" id="Protocol">Protocol</a> <a name="protocol" id="protocol">Directive</a></h2>
3490 <table class="directive">
3491 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocol for a listening socket</td></tr>
3492 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocol <var>protocol</var></code></td></tr>
3493 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3494 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3495 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3496 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1.5 and later.
3497 On Windows from Apache 2.3.3 and later.</td></tr>
3499 <p>This directive specifies the protocol used for a specific listening socket.
3500 The protocol is used to determine which module should handle a request, and
3501 to apply protocol specific optimizations with the <code class="directive">AcceptFilter</code>
3504 <p>You only need to set the protocol if you are running on non-standard ports, otherwise <code>http</code> is assumed for port 80 and <code>https</code> for port 443.</p>
3506 <p>For example, if you are running <code>https</code> on a non-standard port, specify the protocol explicitly:</p>
3508 <pre class="prettyprint lang-config">Protocol https</pre>
3511 <p>You can also specify the protocol using the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive.</p>
3515 <li><code class="directive"><a href="#acceptfilter">AcceptFilter</a></code></li>
3516 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3519 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3520 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
3521 <table class="directive">
3522 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
3523 by Apache httpd children</td></tr>
3524 <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>
3525 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3526 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3527 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3528 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3529 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3531 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3532 resource limit for all processes and the second parameter sets
3533 the maximum resource limit. Either parameter can be a number,
3534 or <code>max</code> to indicate to the server that the limit should
3535 be set to the maximum allowed by the operating system
3536 configuration. Raising the maximum resource limit requires that
3537 the server is running as <code>root</code>, or in the initial startup
3540 <p>This applies to processes forked off from Apache httpd children
3541 servicing requests, not the Apache httpd children themselves. This
3542 includes CGI scripts and SSI exec commands, but not any
3543 processes forked off from the Apache httpd parent such as piped
3546 <p>CPU resource limits are expressed in seconds per
3551 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3552 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3555 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3556 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
3557 <table class="directive">
3558 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
3559 by Apache httpd children</td></tr>
3560 <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>
3561 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3562 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3563 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3564 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3565 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3567 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3568 resource limit for all processes and the second parameter sets
3569 the maximum resource limit. Either parameter can be a number,
3570 or <code>max</code> to indicate to the server that the limit should
3571 be set to the maximum allowed by the operating system
3572 configuration. Raising the maximum resource limit requires that
3573 the server is running as <code>root</code>, or in the initial startup
3576 <p>This applies to processes forked off from Apache httpd children
3577 servicing requests, not the Apache httpd children themselves. This
3578 includes CGI scripts and SSI exec commands, but not any
3579 processes forked off from the Apache httpd parent such as piped
3582 <p>Memory resource limits are expressed in bytes per
3587 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3588 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
3591 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3592 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
3593 <table class="directive">
3594 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
3595 processes launched by Apache httpd children</td></tr>
3596 <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>
3597 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
3598 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3599 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3600 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3601 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3603 <p>Takes 1 or 2 parameters. The first parameter sets the soft
3604 resource limit for all processes and the second parameter sets
3605 the maximum resource limit. Either parameter can be a number,
3606 or <code>max</code> to indicate to the server that the limit
3607 should be set to the maximum allowed by the operating system
3608 configuration. Raising the maximum resource limit requires that
3609 the server is running as <code>root</code>, or in the initial startup
3612 <p>This applies to processes forked off from Apache httpd children
3613 servicing requests, not the Apache httpd children themselves. This
3614 includes CGI scripts and SSI exec commands, but not any
3615 processes forked off from the Apache httpd parent such as piped
3618 <p>Process limits control the number of processes per user.</p>
3620 <div class="note"><h3>Note</h3>
3621 <p>If CGI processes are <strong>not</strong> running
3622 under user ids other than the web server user id, this directive
3623 will limit the number of processes that the server itself can
3624 create. Evidence of this situation will be indicated by
3625 <strong><code>cannot fork</code></strong> messages in the
3626 <code>error_log</code>.</p>
3631 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
3632 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
3635 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3636 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
3637 <table class="directive">
3638 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
3640 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
3641 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
3642 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3643 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3644 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3645 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3646 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only;
3647 option <code>Registry-Strict</code> is available in Apache HTTP Server 2.0 and
3650 <p>This directive is used to control how Apache httpd finds the
3651 interpreter used to run CGI scripts. The default setting is
3652 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
3653 by the shebang line (first line, starting with <code>#!</code>) in the
3654 script. On Win32 systems this line usually looks like:</p>
3656 <pre class="prettyprint lang-perl">#!C:/Perl/bin/perl.exe</pre>
3659 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
3661 <pre class="prettyprint lang-perl">#!perl</pre>
3664 <p>Setting <code>ScriptInterpreterSource Registry</code> will
3665 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
3666 searched using the script file extension (e.g., <code>.pl</code>) as a
3667 search key. The command defined by the registry subkey
3668 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
3669 <code>Shell\Open\Command</code> is used to open the script file. If the
3670 registry keys cannot be found, Apache httpd falls back to the behavior of the
3671 <code>Script</code> option.</p>
3673 <div class="warning"><h3>Security</h3>
3674 <p>Be careful when using <code>ScriptInterpreterSource
3675 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
3676 Apache httpd will try to execute <strong>every</strong> file within this
3677 directory. The <code>Registry</code> setting may cause undesired
3678 program calls on files which are typically not executed. For
3679 example, the default open command on <code>.htm</code> files on
3680 most Windows systems will execute Microsoft Internet Explorer, so
3681 any HTTP request for an <code>.htm</code> file existing within the
3682 script directory would start the browser in the background on the
3683 server. This is a good way to crash your system within a minute or
3687 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
3688 2.0 does the same thing as <code>Registry</code> but uses only the
3689 subkey <code>Shell\ExecCGI\Command</code>. The
3690 <code>ExecCGI</code> key is not a common one. It must be
3691 configured manually in the windows registry and hence prevents
3692 accidental program calls on your system.</p>
3695 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3696 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
3697 <table class="directive">
3698 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
3699 of a request or the last 63, assuming the request itself is greater than
3701 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
3702 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
3703 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3704 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3705 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3706 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache httpd 2.2.7 and later.</td></tr>
3708 <p>mod_status with <code>ExtendedStatus On</code>
3709 displays the actual request being handled.
3710 For historical purposes, only 63 characters of the request
3711 are actually stored for display purposes. This directive
3712 controls whether the 1st 63 characters are stored (the previous
3713 behavior and the default) or if the last 63 characters are. This
3714 is only applicable, of course, if the length of the request is
3715 64 characters or greater.</p>
3717 <p>If Apache httpd is handling <code>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</code> mod_status displays as follows:
3720 <table class="bordered">
3722 <th>Off (default)</th>
3723 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
3727 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
3733 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3734 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
3735 <table class="directive">
3736 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
3737 messages sent to the client</td></tr>
3738 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
3739 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3740 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3741 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3743 <p>The <code class="directive">ServerAdmin</code> sets the contact address
3744 that the server includes in any error messages it returns to the
3745 client. If the <code>httpd</code> doesn't recognize the supplied argument
3747 assumes, that it's an <var>email-address</var> and prepends it with
3748 <code>mailto:</code> in hyperlink targets. However, it's recommended to
3749 actually use an email address, since there are a lot of CGI scripts that
3750 make that assumption. If you want to use an URL, it should point to another
3751 server under your control. Otherwise users may not be able to contact you in
3754 <p>It may be worth setting up a dedicated address for this, e.g.</p>
3756 <pre class="prettyprint lang-config">ServerAdmin www-admin@foo.example.com</pre>
3758 <p>as users do not always mention that they are talking about the
3762 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3763 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
3764 <table class="directive">
3765 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
3766 to name-virtual hosts</td></tr>
3767 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
3768 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3769 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3770 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3772 <p>The <code class="directive">ServerAlias</code> directive sets the
3773 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
3774 <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
3776 <pre class="prettyprint lang-config">
3777 <VirtualHost *:80>
3778 ServerName server.example.com
3779 ServerAlias server server2.example.com server2
3780 ServerAlias *.example.com
3781 UseCanonicalName Off
3783 </VirtualHost>
3787 <p>Name-based virtual hosts for the best-matching set of <code class="directive"><a href="#virtualhost"><virtualhost></a></code>s are processed
3788 in the order they appear in the configuration. The first matching <code class="directive"><a href="#servername">ServerName</a></code> or <code class="directive"><a href="#serveralias">ServerAlias</a></code> is used, with no different precedence for wildcards
3789 (nor for ServerName vs. ServerAlias). </p>
3791 <p>The complete list of names in the <code class="directive">VirtualHost</code>
3792 directive are treated just like a (non wildcard)
3793 <code class="directive">ServerAlias</code>.</p>
3798 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3799 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
3802 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3803 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
3804 <table class="directive">
3805 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
3807 <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>
3808 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3809 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3810 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3812 <p>The <code class="directive">ServerName</code> directive sets the
3813 request scheme, hostname and
3814 port that the server uses to identify itself. This is used when
3815 creating redirection URLs.</p>
3817 <p>Additionally, <code class="directive">ServerName</code> is used (possibly
3818 in conjunction with <code class="directive">ServerAlias</code>) to uniquely
3819 identify a virtual host, when using <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
3821 <p>For example, if the name of the
3822 machine hosting the web server is <code>simple.example.com</code>,
3823 but the machine also has the DNS alias <code>www.example.com</code>
3824 and you wish the web server to be so identified, the following
3825 directive should be used:</p>
3827 <pre class="prettyprint lang-config">ServerName www.example.com</pre>
3830 <p>The <code class="directive">ServerName</code> directive
3831 may appear anywhere within the definition of a server. However,
3832 each appearance overrides the previous appearance (within that
3835 <p>If no <code class="directive">ServerName</code> is specified, then the
3836 server attempts to deduce the hostname by performing a reverse
3837 lookup on the IP address. If no port is specified in the
3838 <code class="directive">ServerName</code>, then the server will use the
3839 port from the incoming request. For optimal reliability and
3840 predictability, you should specify an explicit hostname and port
3841 using the <code class="directive">ServerName</code> directive.</p>
3843 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
3844 the <code class="directive">ServerName</code> inside a
3845 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
3846 section specifies what hostname must appear in the request's
3847 <code>Host:</code> header to match this virtual host.</p>
3849 <p>Sometimes, the server runs behind a device that processes SSL,
3850 such as a reverse proxy, load balancer or SSL offload
3851 appliance. When this is the case, specify the
3852 <code>https://</code> scheme and the port number to which the
3853 clients connect in the <code class="directive">ServerName</code> directive
3854 to make sure that the server generates the correct
3855 self-referential URLs.
3858 <p>See the description of the
3859 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
3860 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
3861 settings which determine whether self-referential URLs (e.g., by the
3862 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
3863 specified port, or to the port number given in the client's request.
3866 <div class="warning">
3867 <p>Failure to set <code class="directive">ServerName</code> to a name that
3868 your server can resolve to an IP address will result in a startup
3869 warning. <code>httpd</code> will then use whatever hostname it can
3870 determine, using the system's <code>hostname</code> command. This
3871 will almost never be the hostname you actually want.</p>
3872 <div class="example"><p><code>
3873 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
3880 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3881 Apache HTTP Server</a></li>
3882 <li><a href="../vhosts/">Apache HTTP Server virtual host
3883 documentation</a></li>
3884 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3885 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3886 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
3889 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3890 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
3891 <table class="directive">
3892 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
3893 is accessed by an incompatible browser</td></tr>
3894 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
3895 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
3896 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3897 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3899 <p>The <code class="directive">ServerPath</code> directive sets the legacy
3900 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
3904 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
3907 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3908 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
3909 <table class="directive">
3910 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
3911 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
3912 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
3913 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3914 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3915 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3917 <p>The <code class="directive">ServerRoot</code> directive sets the
3918 directory in which the server lives. Typically it will contain the
3919 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
3920 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
3921 relative to this directory.</p>
3923 <pre class="prettyprint lang-config">ServerRoot "/home/httpd"</pre>
3926 <p>The default location of <code class="directive">ServerRoot</code> may be
3927 modified by using the <code>--prefix</code> argument to
3928 <a href="../programs/configure.html"><code>configure</code></a>, and
3929 most third-party distributions of the server have a different
3930 default location from the one listed above.</p>
3935 <li><a href="../invoking.html">the <code>-d</code>
3936 option to <code>httpd</code></a></li>
3937 <li><a href="../misc/security_tips.html#serverroot">the
3938 security tips</a> for information on how to properly set
3939 permissions on the <code class="directive">ServerRoot</code></li>
3942 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3943 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
3944 <table class="directive">
3945 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
3946 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
3947 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
3948 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3949 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
3950 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3951 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3953 <p>The <code class="directive">ServerSignature</code> directive allows the
3954 configuration of a trailing footer line under server-generated
3955 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
3956 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
3957 would want to enable such a footer line is that in a chain of proxies,
3958 the user often has no possibility to tell which of the chained servers
3959 actually produced a returned error message.</p>
3961 <p>The <code>Off</code>
3962 setting, which is the default, suppresses the footer line (and is
3963 therefore compatible with the behavior of Apache-1.2 and
3964 below). The <code>On</code> setting simply adds a line with the
3965 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
3966 and the <code>EMail</code> setting additionally creates a
3967 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
3970 <p>After version 2.0.44, the details of the server version number
3971 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
3975 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
3978 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3979 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
3980 <table class="directive">
3981 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
3983 <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>
3984 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
3985 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3986 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3987 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3989 <p>This directive controls whether <code>Server</code> response
3990 header field which is sent back to clients includes a
3991 description of the generic OS-type of the server as well as
3992 information about compiled-in modules.</p>
3995 <dt><code>ServerTokens Full</code> (or not specified)</dt>
3997 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
3998 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4000 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4002 <dd>Server sends (<em>e.g.</em>): <code>Server:
4005 <dt><code>ServerTokens Major</code></dt>
4007 <dd>Server sends (<em>e.g.</em>): <code>Server:
4008 Apache/2</code></dd>
4010 <dt><code>ServerTokens Minor</code></dt>
4012 <dd>Server sends (<em>e.g.</em>): <code>Server:
4013 Apache/2.4</code></dd>
4015 <dt><code>ServerTokens Min[imal]</code></dt>
4017 <dd>Server sends (<em>e.g.</em>): <code>Server:
4018 Apache/2.4.2</code></dd>
4020 <dt><code>ServerTokens OS</code></dt>
4022 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4027 <p>This setting applies to the entire server, and cannot be
4028 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4030 <p>After version 2.0.44, this directive also controls the
4031 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
4033 <div class="note">Setting <code class="directive">ServerTokens</code> to less than
4034 <code>minimal</code> is not recommended because it makes it more
4035 difficult to debug interoperational problems. Also note that
4036 disabling the Server: header does nothing at all to make your
4037 server more secure; the idea of "security through obscurity"
4038 is a myth and leads to a false sense of safety.</div>
4043 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
4046 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4047 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
4048 <table class="directive">
4049 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
4051 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
4052 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4053 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4054 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4055 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4056 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache httpd 2.0</td></tr>
4058 <p>When placed into an <code>.htaccess</code> file or a
4059 <code class="directive"><a href="#directory"><Directory></a></code> or
4060 <code class="directive"><a href="#location"><Location></a></code>
4061 section, this directive forces all matching files to be parsed
4062 through the <a href="../handler.html">handler</a> given by
4063 <var>handler-name</var>. For example, if you had a directory you
4064 wanted to be parsed entirely as imagemap rule files, regardless
4065 of extension, you might put the following into an
4066 <code>.htaccess</code> file in that directory:</p>
4068 <pre class="prettyprint lang-config">SetHandler imap-file</pre>
4071 <p>Another example: if you wanted to have the server display a
4072 status report whenever a URL of
4073 <code>http://servername/status</code> was called, you might put
4074 the following into <code>httpd.conf</code>:</p>
4076 <pre class="prettyprint lang-config">
4077 <Location "/status">
4078 SetHandler server-status
4083 <p>You could also use this directive to configure a particular
4084 handler for files with a particular file extension. For example:</p>
4086 <pre class="prettyprint lang-config">
4087 <FilesMatch \.php$>
4088 SetHandler application/x-httpd-php
4093 <p>You can override an earlier defined <code class="directive">SetHandler</code>
4094 directive by using the value <code>None</code>.</p>
4096 <div class="note"><h3>Note</h3>
4097 <p>Because <code class="directive">SetHandler</code> overrides default handlers,
4098 normal behavior such as handling of URLs ending in a slash (/) as
4099 directories or index files is suppressed.</p></div>
4103 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
4106 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4107 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
4108 <table class="directive">
4109 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
4111 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4112 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4113 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4114 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4115 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4117 <p>The <code class="directive">SetInputFilter</code> directive sets the
4118 filter or filters which will process client requests and POST
4119 input when they are received by the server. This is in addition to
4120 any filters defined elsewhere, including the
4121 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
4124 <p>If more than one filter is specified, they must be separated
4125 by semicolons in the order in which they should process the
4130 <li><a href="../filter.html">Filters</a> documentation</li>
4133 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4134 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
4135 <table class="directive">
4136 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
4138 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4139 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4140 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4141 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4142 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4144 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
4145 which will process responses from the server before they are
4146 sent to the client. This is in addition to any filters defined
4147 elsewhere, including the
4148 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
4151 <p>For example, the following configuration will process all files
4152 in the <code>/www/data/</code> directory for server-side
4155 <pre class="prettyprint lang-config">
4156 <Directory "/www/data/">
4157 SetOutputFilter INCLUDES
4162 <p>If more than one filter is specified, they must be separated
4163 by semicolons in the order in which they should process the
4168 <li><a href="../filter.html">Filters</a> documentation</li>
4171 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4172 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
4173 <table class="directive">
4174 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
4175 certain events before failing a request</td></tr>
4176 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
4177 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 60</code></td></tr>
4178 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4179 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4180 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4182 <p>The <code class="directive">TimeOut</code> directive defines the length
4183 of time Apache httpd will wait for I/O in various circumstances:</p>
4186 <li>When reading data from the client, the length of time to
4187 wait for a TCP packet to arrive if the read buffer is
4190 <li>When writing data to the client, the length of time to wait
4191 for an acknowledgement of a packet if the send buffer is
4194 <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, the length of time to wait for
4195 output from a CGI script.</li>
4197 <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
4198 wait for output from a filtering process.</li>
4200 <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
4201 <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
4207 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4208 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
4209 <table class="directive">
4210 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behavior on <code>TRACE</code> requests</td></tr>
4211 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
4212 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
4213 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4214 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4215 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4216 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 1.3.34, 2.0.55 and later</td></tr>
4218 <p>This directive overrides the behavior of <code>TRACE</code> for both
4219 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
4220 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4221 RFC 2616, which disallows any request body to accompany the request.
4222 <code>TraceEnable off</code> causes the core server and
4223 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
4224 allowed) error to the client.</p>
4226 <p>Finally, for testing and diagnostic purposes only, request
4227 bodies may be allowed using the non-compliant <code>TraceEnable
4228 extended</code> directive. The core (as an origin server) will
4229 restrict the request body to 64k (plus 8k for chunk headers if
4230 <code>Transfer-Encoding: chunked</code> is used). The core will
4231 reflect the full headers and all chunk headers with the response
4232 body. As a proxy server, the request body is not restricted to 64k.</p>
4234 <div class="note"><h3>Note</h3>
4235 <p>Despite claims to the contrary, <code>TRACE</code> is not
4236 a security vulnerability and there is no viable reason for
4237 it to be disabled. Doing so necessarily makes your server
4242 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4243 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
4244 <table class="directive">
4245 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
4246 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
4247 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4248 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4249 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4251 <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
4252 of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
4253 <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
4254 <code>-D</code> arguments in any startup scripts.</p>
4257 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4258 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
4259 <table class="directive">
4260 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
4262 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
4263 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
4264 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4265 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4266 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4268 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4269 URL -- that is, a URL that refers back to the same server. With
4270 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4271 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
4272 directive to construct the canonical name for the server. This name
4273 is used in all self-referential URLs, and for the values of
4274 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4276 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4277 self-referential URLs using the hostname and port supplied by
4278 the client if any are supplied (otherwise it will use the
4279 canonical name, as defined above). These values are the same
4280 that are used to implement <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
4281 and are available with the same clients. The CGI variables
4282 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4283 constructed from the client supplied values as well.</p>
4285 <p>An example where this may be useful is on an intranet server
4286 where you have users connecting to the machine using short
4287 names such as <code>www</code>. You'll notice that if the users
4288 type a shortname, and a URL which is a directory, such as
4289 <code>http://www/splat</code>, <em>without the trailing
4290 slash</em> then Apache httpd will redirect them to
4291 <code>http://www.example.com/splat/</code>. If you have
4292 authentication enabled, this will cause the user to have to
4293 authenticate twice (once for <code>www</code> and once again
4294 for <code>www.example.com</code> -- see <a href="http://wiki.apache.org/httpd/FAQ#Why_does_Apache_ask_for_my_password_twice_before_serving_a_file.3F">
4295 the FAQ on this subject for more information</a>). But if
4296 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
4297 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4299 <p>There is a third option, <code>UseCanonicalName DNS</code>,
4300 which is intended for use with mass IP-based virtual hosting to
4301 support ancient clients that do not provide a
4302 <code>Host:</code> header. With this option Apache httpd does a
4303 reverse DNS lookup on the server IP address that the client
4304 connected to in order to work out self-referential URLs.</p>
4306 <div class="warning"><h3>Warning</h3>
4307 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
4308 they may be broken by this option. The client is essentially free
4309 to give whatever value they want as a hostname. But if the CGI is
4310 only using <code>SERVER_NAME</code> to construct self-referential URLs
4311 then it should be just fine.</p>
4316 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4317 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4318 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4321 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4322 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
4323 <table class="directive">
4324 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own port</td></tr>
4325 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
4326 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
4327 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4328 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4329 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4331 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4332 URL -- that is, a URL that refers back to the same server. With
4333 <code>UseCanonicalPhysicalPort On</code> Apache httpd will, when
4334 constructing the canonical port for the server to honor
4335 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
4336 provide the actual physical port number being used by this request
4337 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
4338 Apache httpd will not ever use the actual physical port number, instead
4339 relying on all configured information to construct a valid port number.</p>
4341 <div class="note"><h3>Note</h3>
4342 <p>The ordering of the lookup when the physical port is used is as
4345 <dt><code>UseCanonicalName On</code></dt>
4348 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4349 <li>Physical port</li>
4350 <li>Default port</li>
4353 <dt><code>UseCanonicalName Off | DNS</code></dt>
4356 <li>Parsed port from <code>Host:</code> header</li>
4357 <li>Physical port</li>
4358 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4359 <li>Default port</li>
4364 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4365 physical ports are removed from the ordering.</p>
4371 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4372 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4373 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4376 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4377 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
4378 <table class="directive">
4379 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
4380 hostname or IP address</td></tr>
4381 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
4382 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4383 ...> ... </VirtualHost></code></td></tr>
4384 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4385 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4386 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4388 <p><code class="directive"><VirtualHost></code> and
4389 <code></VirtualHost></code> are used to enclose a group of
4390 directives that will apply only to a particular virtual host. Any
4391 directive that is allowed in a virtual host context may be
4392 used. When the server receives a request for a document on a
4393 particular virtual host, it uses the configuration directives
4394 enclosed in the <code class="directive"><VirtualHost></code>
4395 section. <var>Addr</var> can be any of the following, optionally followed by
4396 a colon and a port number (or *):</p>
4399 <li>The IP address of the virtual host;</li>
4401 <li>A fully qualified domain name for the IP address of the
4402 virtual host (not recommended);</li>
4404 <li>The character <code>*</code>, which acts as a wildcard and matches
4405 any IP address.</li>
4407 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
4411 <pre class="prettyprint lang-config">
4412 <VirtualHost 10.1.2.3:80>
4413 ServerAdmin webmaster@host.example.com
4414 DocumentRoot /www/docs/host.example.com
4415 ServerName host.example.com
4416 ErrorLog logs/host.example.com-error_log
4417 TransferLog logs/host.example.com-access_log
4418 </VirtualHost>
4423 <p>IPv6 addresses must be specified in square brackets because
4424 the optional port number could not be determined otherwise. An
4425 IPv6 example is shown below:</p>
4427 <pre class="prettyprint lang-config">
4428 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
4429 ServerAdmin webmaster@host.example.com
4430 DocumentRoot /www/docs/host.example.com
4431 ServerName host.example.com
4432 ErrorLog logs/host.example.com-error_log
4433 TransferLog logs/host.example.com-access_log
4434 </VirtualHost>
4438 <p>Each Virtual Host must correspond to a different IP address,
4439 different port number or a different host name for the server,
4440 in the former case the server machine must be configured to
4441 accept IP packets for multiple addresses. (If the machine does
4442 not have multiple network interfaces, then this can be
4443 accomplished with the <code>ifconfig alias</code> command -- if
4444 your OS supports it).</p>
4446 <div class="note"><h3>Note</h3>
4447 <p>The use of <code class="directive"><VirtualHost></code> does
4448 <strong>not</strong> affect what addresses Apache httpd listens on. You
4449 may need to ensure that Apache httpd is listening on the correct addresses
4450 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
4453 <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
4454 specified inside each <code class="directive"><VirtualHost></code> block. If it is absent, the
4455 <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
4456 server configuration will be inherited.</p>
4458 <p>When a request is received, the server first maps it to the best matching
4459 <code class="directive"><VirtualHost></code> based on the local
4460 IP address and port combination only. Non-wildcards have a higher
4461 precedence. If no match based on IP and port occurs at all, the
4462 "main" server configuration is used.</p>
4464 <p>If multiple virtual hosts contain the best matching IP address and port,
4465 the server selects from these virtual hosts the best match based on the
4466 requested hostname. If no matching name-based virtual host is found,
4467 then the first listed virtual host that matched the IP address will be
4468 used. As a consequence, the first listed virtual host for a given IP address
4469 and port combination is default virtual host for that IP and port
4472 <div class="warning"><h3>Security</h3>
4473 <p>See the <a href="../misc/security_tips.html">security tips</a>
4474 document for details on why your security could be compromised if the
4475 directory where log files are stored is writable by anyone other
4476 than the user that starts the server.</p>
4481 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4482 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4483 Apache HTTP Server</a></li>
4484 <li><a href="../bind.html">Setting
4485 which addresses and ports Apache HTTP Server uses</a></li>
4486 <li><a href="../sections.html">How <Directory>, <Location>
4487 and <Files> sections work</a> for an explanation of how these
4488 different sections are combined when a request is received</li>
4492 <div class="bottomlang">
4493 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
4494 <a href="../en/mod/core.html" title="English"> en </a> |
4495 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
4496 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
4497 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
4498 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
4499 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
4500 <script type="text/javascript"><!--//--><![CDATA[//><!--
4501 var comments_shortname = 'httpd';
4502 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/core.html';
4504 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
4505 d.write('<div id="comments_thread"><\/div>');
4506 var s = d.createElement('script');
4507 s.type = 'text/javascript';
4509 s.src = 'http://c.apaste.info/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
4510 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
4513 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
4515 })(window, document);
4516 //--><!]]></script></div><div id="footer">
4517 <p class="apache">Copyright 2012 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>
4518 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
4519 if (typeof(prettyPrint) !== 'undefined') {