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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>core - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <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" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.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>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
25 <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>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Core Features</h1>
29 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
30 <a href="../en/mod/core.html" title="English"> en </a> |
31 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
32 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
33 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
34 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
36 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
38 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
40 <div id="quickview"><h3 class="directives">Directives</h3>
42 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverridelist">AllowOverrideList</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#asyncfilter">AsyncFilter</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#cgipassauth">CGIPassAuth</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#cgivar">CGIVar</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#defaultruntimedir">DefaultRuntimeDir</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#directory"><Directory></a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#else"><Else></a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#elseif"><ElseIf></a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#error">Error</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#errorlogformat">ErrorLogFormat</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#extendedstatus">ExtendedStatus</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#gprofdir">GprofDir</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#httpprotocoloptions">HttpProtocolOptions</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#if"><If></a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#ifdirective"><IfDirective></a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#iffile"><IfFile></a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#ifsection"><IfSection></a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#includeoptional">IncludeOptional</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#logleveloverride">LogLevelOverride</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangeoverlaps">MaxRangeOverlaps</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#maxrangereversals">MaxRangeReversals</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#maxranges">MaxRanges</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#mergetrailers">MergeTrailers</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#mutex">Mutex</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol</a></li>
107 <li><img alt="" src="../images/down.gif" /> <a href="#protocols">Protocols</a></li>
108 <li><img alt="" src="../images/down.gif" /> <a href="#protocolshonororder">ProtocolsHonorOrder</a></li>
109 <li><img alt="" src="../images/down.gif" /> <a href="#qualifyredirecturl">QualifyRedirectURL</a></li>
110 <li><img alt="" src="../images/down.gif" /> <a href="#registerhttpmethod">RegisterHttpMethod</a></li>
111 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
112 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
113 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
114 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
115 <li><img alt="" src="../images/down.gif" /> <a href="#seerequesttail">SeeRequestTail</a></li>
116 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
117 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
118 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
119 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
120 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
121 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
122 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
123 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
124 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
125 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
126 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
127 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
128 <li><img alt="" src="../images/down.gif" /> <a href="#undefine">UnDefine</a></li>
129 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
130 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
131 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
132 <li><img alt="" src="../images/down.gif" /> <a href="#warning">Warning</a></li>
134 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=core">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=core">Report a bug</a></li></ul><h3>See also</h3>
136 <li><a href="#comments_section">Comments</a></li></ul></div>
138 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
139 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
140 <table class="directive">
141 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
142 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
143 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
144 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
145 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
147 <p>This directive enables operating system specific optimizations for a
148 listening socket by the <code class="directive">Protocol</code> type.
149 The basic premise is for the kernel to not send a socket to the server
150 process until either data is received or an entire HTTP Request is buffered.
151 Only <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
152 FreeBSD's Accept Filters</a>, Linux's more primitive
153 <code>TCP_DEFER_ACCEPT</code>, and Windows' optimized AcceptEx()
154 are currently supported.</p>
156 <p>Using <code>none</code> for an argument will disable any accept filters
157 for that protocol. This is useful for protocols that require a server
158 send data first, such as <code>ftp:</code> or <code>nntp</code>:</p>
159 <pre class="prettyprint lang-config">AcceptFilter nntp none</pre>
162 <p>The default protocol names are <code>https</code> for port 443
163 and <code>http</code> for all other ports. To specify that another
164 protocol is being used with a listening port, add the <var>protocol</var>
165 argument to the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
168 <p>The default values on FreeBSD are:</p>
169 <pre class="prettyprint lang-config">AcceptFilter http httpready
170 AcceptFilter https dataready</pre>
173 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
174 the kernel level. Once an entire request is received, the kernel then
175 sends it to the server. See the
176 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
177 accf_http(9)</a> man page for more details. Since HTTPS requests are
178 encrypted, only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
179 accf_data(9)</a> filter is used.</p>
181 <p>The default values on Linux are:</p>
182 <pre class="prettyprint lang-config">AcceptFilter http data
183 AcceptFilter https data</pre>
186 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
187 requests. Any value besides <code>none</code> will enable
188 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
190 <a href="http://man7.org/linux/man-pages/man7/tcp.7.html">
191 tcp(7)</a> man page.</p>
193 <p>The default values on Windows are:</p>
194 <pre class="prettyprint lang-config">AcceptFilter http connect
195 AcceptFilter https connect</pre>
198 <p>Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx()
199 API, and does not support http protocol buffering. <code>connect</code>
200 will use the AcceptEx() API, also retrieve the network endpoint
201 addresses, but like <code>none</code> the <code>connect</code> option
202 does not wait for the initial data transmission.</p>
204 <p>On Windows, <code>none</code> uses accept() rather than AcceptEx()
205 and will not recycle sockets between connections. This is useful for
206 network adapters with broken driver support, as well as some virtual
207 network providers such as vpn drivers, or spam, virus or spyware
210 <div class="warning">
211 <h3>The <code>data</code> AcceptFilter (Windows)</h3>
213 <p>For versions 2.4.23 and prior, the Windows <code>data</code> accept
214 filter waited until data had been transmitted and the initial data
215 buffer and network endpoint addresses had been retrieved from the
216 single AcceptEx() invocation. This implementation was subject to a
217 denial of service attack and has been disabled.</p>
219 <p>Current releases of httpd default to the <code>connect</code> filter
220 on Windows, and will fall back to <code>connect</code> if
221 <code>data</code> is specified. Users of prior releases are encouraged
222 to add an explicit setting of <code>connect</code> for their
223 AcceptFilter, as shown above.</p>
229 <li><code class="directive"><a href="#protocol">Protocol</a></code></li>
232 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
233 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
234 <table class="directive">
235 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
236 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
237 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
238 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
239 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
240 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
241 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
244 <p>This directive controls whether requests that contain trailing
245 pathname information that follows an actual filename (or
246 non-existent file in an existing directory) will be accepted or
247 rejected. The trailing pathname information can be made
248 available to scripts in the <code>PATH_INFO</code> environment
251 <p>For example, assume the location <code>/test/</code> points to
252 a directory that contains only the single file
253 <code>here.html</code>. Then requests for
254 <code>/test/here.html/more</code> and
255 <code>/test/nothere.html/more</code> both collect
256 <code>/more</code> as <code>PATH_INFO</code>.</p>
258 <p>The three possible arguments for the
259 <code class="directive">AcceptPathInfo</code> directive are:</p>
261 <dt><code>Off</code></dt><dd>A request will only be accepted if it
262 maps to a literal path that exists. Therefore a request with
263 trailing pathname information after the true filename such as
264 <code>/test/here.html/more</code> in the above example will return
265 a 404 NOT FOUND error.</dd>
267 <dt><code>On</code></dt><dd>A request will be accepted if a
268 leading path component maps to a file that exists. The above
269 example <code>/test/here.html/more</code> will be accepted if
270 <code>/test/here.html</code> maps to a valid file.</dd>
272 <dt><code>Default</code></dt><dd>The treatment of requests with
273 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
274 The core handler for normal files defaults to rejecting
275 <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
276 <code>PATH_INFO</code> by default.</dd>
279 <p>The primary purpose of the <code>AcceptPathInfo</code>
280 directive is to allow you to override the handler's choice of
281 accepting or rejecting <code>PATH_INFO</code>. This override is required,
282 for example, when you use a <a href="../filter.html">filter</a>, such
283 as <a href="mod_include.html">INCLUDES</a>, to generate content
284 based on <code>PATH_INFO</code>. The core handler would usually reject
285 the request, so you can use the following configuration to enable
288 <pre class="prettyprint lang-config"><Files "mypaths.shtml">
290 SetOutputFilter INCLUDES
297 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
298 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
299 <table class="directive">
300 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
301 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
302 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
303 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
304 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
305 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
307 <p>While processing a request, the server looks for
308 the first existing configuration file from this list of names in
309 every directory of the path to the document, if distributed
310 configuration files are <a href="#allowoverride">enabled for that
311 directory</a>. For example:</p>
313 <pre class="prettyprint lang-config">AccessFileName .acl</pre>
316 <p>Before returning the document
317 <code>/usr/local/web/index.html</code>, the server will read
318 <code>/.acl</code>, <code>/usr/.acl</code>,
319 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
320 for directives unless they have been disabled with:</p>
322 <pre class="prettyprint lang-config"><Directory "/">
324 </Directory></pre>
329 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
330 <li><a href="../configuring.html">Configuration Files</a></li>
331 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
334 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
335 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
336 <table class="directive">
337 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
338 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
339 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
340 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
341 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
342 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
343 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
344 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
346 <p>This directive specifies a default value for the media type
347 charset parameter (the name of a character encoding) to be added
348 to a response if and only if the response's content-type is either
349 <code>text/plain</code> or <code>text/html</code>. This should override
350 any charset specified in the body of the response via a <code>META</code>
351 element, though the exact behavior is often dependent on the user's client
352 configuration. A setting of <code>AddDefaultCharset Off</code>
353 disables this functionality. <code>AddDefaultCharset On</code> enables
354 a default charset of <code>iso-8859-1</code>. Any other value is assumed
355 to be the <var>charset</var> to be used, which should be one of the
356 <a href="http://www.iana.org/assignments/character-sets">IANA registered
357 charset values</a> for use in Internet media types (MIME types).
360 <pre class="prettyprint lang-config">AddDefaultCharset utf-8</pre>
363 <p><code class="directive">AddDefaultCharset</code> should only be used when all
364 of the text resources to which it applies are known to be in that
365 character encoding and it is too inconvenient to label their charset
366 individually. One such example is to add the charset parameter
367 to resources containing generated content, such as legacy CGI
368 scripts, that might be vulnerable to cross-site scripting attacks
369 due to user-provided data being included in the output. Note, however,
370 that a better solution is to just fix (or delete) those scripts, since
371 setting a default charset does not protect users that have enabled
372 the "auto-detect character encoding" feature on their browser.</p>
376 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
379 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
380 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
381 <table class="directive">
382 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
383 be passed through</td></tr>
384 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off|NoDecode</code></td></tr>
385 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
386 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
387 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
388 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
389 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>
390 NoDecode option available in 2.3.12 and later.</td></tr>
392 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
393 which contain encoded path separators (<code>%2F</code> for <code>/</code>
394 and additionally <code>%5C</code> for <code>\</code> on accordant systems)
395 to be used in the path info.</p>
397 <p>With the default value, <code>Off</code>, such URLs are refused
398 with a 404 (Not found) error.</p>
400 <p>With the value <code>On</code>, such URLs are accepted, and encoded
401 slashes are decoded like all other encoded characters.</p>
403 <p>With the value <code>NoDecode</code>, such URLs are accepted, but
404 encoded slashes are not decoded but left in their encoded state.</p>
406 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
407 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
409 <div class="note"><h3>Note</h3>
410 <p>If encoded slashes are needed in path info, use of <code>NoDecode</code> is
411 strongly recommended as a security measure. Allowing slashes
412 to be decoded could potentially allow unsafe paths.</p>
417 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
420 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
421 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
422 <table class="directive">
423 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
424 <code>.htaccess</code> files</td></tr>
425 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
426 [<var>directive-type</var>] ...</code></td></tr>
427 <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>
428 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
429 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
430 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
432 <p>When the server finds an <code>.htaccess</code> file (as
433 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>),
434 it needs to know which directives declared in that file can override
435 earlier configuration directives.</p>
437 <div class="note"><h3>Only available in <Directory> sections</h3>
438 <code class="directive">AllowOverride</code> is valid only in
439 <code class="directive"><a href="#directory"><Directory></a></code>
440 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
441 <code class="directive"><a href="#files"><Files></a></code> sections.
444 <p>When this directive is set to <code>None</code> and <code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code> is set to
445 <code>None</code>, <a href="#accessfilename">.htaccess</a> files are
446 completely ignored. In this case, the server will not even attempt
447 to read <code>.htaccess</code> files in the filesystem.</p>
449 <p>When this directive is set to <code>All</code>, then any
450 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
451 <code>.htaccess</code> files.</p>
453 <p>The <var>directive-type</var> can be one of the following
454 groupings of directives.</p>
461 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authz_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
462 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
463 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
464 <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
465 <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>
470 Allow use of the directives controlling document types
471 (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
472 <code class="directive"><a href="#forcetype">ForceType</a></code>,
473 <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
474 <code class="directive"><a href="#sethandler">SetHandler</a></code>,
475 <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
476 <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
477 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
478 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>),
479 <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>),
480 <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> directives (<code class="directive"><a href="../mod/mod_alias.html#redirect">Redirect</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirecttemp">RedirectTemp</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirectpermanent">RedirectPermanent</a></code>, <code class="directive"><a href="../mod/mod_alias.html#redirectmatch">RedirectMatch</a></code>), and
481 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
482 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
488 Allow use of the directives controlling directory indexing
489 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
490 <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>,
491 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
492 <code class="directive"><a href="../mod/mod_autoindex.html#defaulticon">DefaultIcon</a></code>, <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>, <code class="directive"><a href="../mod/mod_dir.html#fallbackresource">FallbackResource</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>,
498 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>
503 <dt>Nonfatal=[Override|Unknown|All]</dt>
506 Allow use of AllowOverride option to treat invalid (unrecognized
507 or disallowed) directives in
508 .htaccess as nonfatal. Instead of causing an Internal Server
509 Error, disallowed or unrecognised directives will be ignored
510 and a warning logged:
512 <li><strong>Nonfatal=Override</strong> treats directives
513 forbidden by AllowOverride as nonfatal.</li>
514 <li><strong>Nonfatal=Unknown</strong> treats unknown directives
515 as nonfatal. This covers typos and directives implemented
516 by a module that's not present.</li>
517 <li><strong>Nonfatal=All</strong> treats both the above as nonfatal.</li>
519 <p>Note that a syntax error in a valid directive will still cause
520 an Internal Server Error.</p>
521 <div class="warning"><h3>Security</h3>
522 Nonfatal errors may have security implications for .htaccess users.
523 For example, if AllowOverride disallows AuthConfig, users'
524 configuration designed to restrict access to a site will be disabled.
528 <dt>Options[=<var>Option</var>,...]</dt>
531 Allow use of the directives controlling specific directory
532 features (<code class="directive"><a href="#options">Options</a></code> and
533 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
534 An equal sign may be given followed by a comma-separated list, without
535 spaces, of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.
537 <div class="note"><h3>Implicit disabling of Options</h3>
538 <p>Even though the list of options that may be used in .htaccess files
539 can be limited with this directive, as long as any <code class="directive"><a href="#options">Options</a></code> directive is allowed any
540 other inherited option can be disabled by using the non-relative
541 syntax. In other words, this mechanism cannot force a specific option
542 to remain <em>set</em> while allowing any others to be set.
545 <div class="example"><p><code>
546 AllowOverride Options=Indexes,MultiViews
553 <pre class="prettyprint lang-config">AllowOverride AuthConfig Indexes</pre>
556 <p>In the example above, all directives that are neither in the group
557 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
560 <div class="note"><p>For security and performance reasons, do not set
561 <code>AllowOverride</code> to anything other than <code>None</code>
562 in your <code><Directory "/"></code> block. Instead, find (or
563 create) the <code><Directory></code> block that refers to the
564 directory where you're actually planning to place a
565 <code>.htaccess</code> file.</p>
570 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
571 <li><code class="directive"><a href="#allowoverridelist">AllowOverrideList</a></code></li>
572 <li><a href="../configuring.html">Configuration Files</a></li>
573 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
576 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
577 <div class="directive-section"><h2><a name="AllowOverrideList" id="AllowOverrideList">AllowOverrideList</a> <a name="allowoverridelist" id="allowoverridelist">Directive</a></h2>
578 <table class="directive">
579 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Individual directives that are allowed in
580 <code>.htaccess</code> files</td></tr>
581 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverrideList None|<var>directive</var>
582 [<var>directive-type</var>] ...</code></td></tr>
583 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverrideList None</code></td></tr>
584 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
585 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
586 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
588 <p>When the server finds an <code>.htaccess</code> file (as
589 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>),
590 it needs to know which directives declared in that file can override
591 earlier configuration directives.</p>
593 <div class="note"><h3>Only available in <Directory> sections</h3>
594 <code class="directive">AllowOverrideList</code> is valid only in
595 <code class="directive"><a href="#directory"><Directory></a></code>
596 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
597 <code class="directive"><a href="#files"><Files></a></code> sections.
600 <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>,
601 then <a href="#accessfilename">.htaccess</a> files are completely
602 ignored. In this case, the server will not even attempt to read
603 <code>.htaccess</code> files in the filesystem.</p>
607 <pre class="prettyprint lang-config">AllowOverride None
608 AllowOverrideList Redirect RedirectMatch</pre>
611 <p>In the example above, only the <code>Redirect</code> and
612 <code>RedirectMatch</code> directives are allowed. All others will
613 cause an Internal Server Error.</p>
617 <pre class="prettyprint lang-config">AllowOverride AuthConfig
618 AllowOverrideList CookieTracking CookieName</pre>
621 <p>In the example above, <code class="directive"><a href="#allowoverride">AllowOverride
622 </a></code> grants permission to the <code>AuthConfig</code>
623 directive grouping and <code class="directive">AllowOverrideList</code> grants
624 permission to only two directives from the <code>FileInfo</code> directive
625 grouping. All others will cause an Internal Server Error.</p>
629 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
630 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
631 <li><a href="../configuring.html">Configuration Files</a></li>
632 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
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="AsyncFilter" id="AsyncFilter">AsyncFilter</a> <a name="asyncfilter" id="asyncfilter">Directive</a></h2>
637 <table class="directive">
638 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Set the minimum filter type eligible for asynchronous handling</td></tr>
639 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AsyncFilter request|connection|network</code></td></tr>
640 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AsyncFilter request</code></td></tr>
641 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
643 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
644 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only available from Apache 2.5.0 and later.</td></tr>
646 <p>This directive controls the minimum filter levels that are eligible
647 for asynchronous handling. This may be necessary to support legacy external
648 filters that did not handle meta buckets correctly.</p>
650 <p>If set to "network", asynchronous handling will be limited to the network
651 filter only. If set to "connection", all connection and network filters
652 will be eligible for asynchronous handling, including <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>.
653 If set to "request", all filters will be eligible for asynchronous handling.</p>
656 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
657 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
658 <table class="directive">
659 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
661 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
662 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
663 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
664 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
665 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
666 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
668 <p>This directive is used to control how Apache httpd finds the
669 interpreter used to run CGI scripts. For example, setting
670 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
671 cause all CGI script files with a <code>.foo</code> extension to
672 be passed to the FOO interpreter.</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="CGIPassAuth" id="CGIPassAuth">CGIPassAuth</a> <a name="cgipassauth" id="cgipassauth">Directive</a></h2>
677 <table class="directive">
678 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables passing HTTP authorization headers to scripts as CGI
680 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIPassAuth On|Off</code></td></tr>
681 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CGIPassAuth Off</code></td></tr>
682 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
683 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
684 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
685 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
686 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.13 and later</td></tr>
688 <p><code class="directive">CGIPassAuth</code> allows scripts access to HTTP
689 authorization headers such as <code>Authorization</code>, which is
690 required for scripts that implement HTTP Basic authentication.
691 Normally these HTTP headers are hidden from scripts. This is to disallow
692 scripts from seeing user ids and passwords used to access the server when
693 HTTP Basic authentication is enabled in the web server. This directive
694 should be used when scripts are allowed to implement HTTP Basic
697 <p>This directive can be used instead of the compile-time setting
698 <code>SECURITY_HOLE_PASS_AUTHORIZATION</code> which has been available
699 in previous versions of Apache HTTP Server.</p>
701 <p>The setting is respected by any modules which use
702 <code>ap_add_common_vars()</code>, such as <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>,
703 <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code>, <code class="module"><a href="../mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a></code>,
704 <code class="module"><a href="../mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code>, and so on. Notably, it affects
705 modules which don't handle the request in the usual sense but
706 still use this API; examples of this are <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
707 and <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>. Third-party modules that don't
708 use <code>ap_add_common_vars()</code> may choose to respect the setting
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="CGIVar" id="CGIVar">CGIVar</a> <a name="cgivar" id="cgivar">Directive</a></h2>
714 <table class="directive">
715 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls how some CGI variables are set</td></tr>
716 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIVar <var>variable</var> <var>rule</var></code></td></tr>
717 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
718 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
719 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
720 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
721 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.21 and later</td></tr>
723 <p>This directive controls how some CGI variables are set.</p>
725 <p><strong>REQUEST_URI</strong> rules:</p>
727 <dt><code>original-uri</code> (default)</dt>
728 <dd>The value is taken from the original request line, and will not
729 reflect internal redirects or subrequests which change the requested
731 <dt><code>current-uri</code></dt>
732 <dd>The value reflects the resource currently being processed,
733 which may be different than the original request from the client
734 due to internal redirects or subrequests.</dd>
738 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
739 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
740 <table class="directive">
741 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
743 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
744 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
745 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
746 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
747 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
748 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
750 <p>This directive enables the generation of
751 <code>Content-MD5</code> headers as defined in RFC1864
752 respectively RFC2616.</p>
754 <p>MD5 is an algorithm for computing a "message digest"
755 (sometimes called "fingerprint") of arbitrary-length data, with
756 a high degree of confidence that any alterations in the data
757 will be reflected in alterations in the message digest.</p>
759 <p>The <code>Content-MD5</code> header provides an end-to-end
760 message integrity check (MIC) of the entity-body. A proxy or
761 client may check this header for detecting accidental
762 modification of the entity-body in transit. Example header:</p>
764 <div class="example"><p><code>
765 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
768 <p>Note that this can cause performance problems on your server
769 since the message digest is computed on every request (the
770 values are not cached).</p>
772 <p><code>Content-MD5</code> is only sent for documents served
773 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
774 SSI documents, output from CGI scripts, and byte range responses
775 do not have this header.</p>
778 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
779 <div class="directive-section"><h2><a name="DefaultRuntimeDir" id="DefaultRuntimeDir">DefaultRuntimeDir</a> <a name="defaultruntimedir" id="defaultruntimedir">Directive</a></h2>
780 <table class="directive">
781 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server run-time files</td></tr>
782 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultRuntimeDir <var>directory-path</var></code></td></tr>
783 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultRuntimeDir DEFAULT_REL_RUNTIMEDIR (logs/)</code></td></tr>
784 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
785 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
786 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
787 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.2 and later</td></tr>
789 <p>The <code class="directive">DefaultRuntimeDir</code> directive sets the
790 directory in which the server will create various run-time files
791 (shared memory, locks, etc.). If set as a relative path, the full path
792 will be relative to <code class="directive">ServerRoot</code>.</p>
794 <p><strong>Example</strong></p>
795 <pre class="prettyprint lang-config">DefaultRuntimeDir scratch/</pre>
798 <p>The default location of <code class="directive">DefaultRuntimeDir</code> may be
799 modified by changing the <code>DEFAULT_REL_RUNTIMEDIR</code> #define
802 <p>Note: <code class="directive">ServerRoot</code> should be specified before this
803 directive is used. Otherwise, the default value of <code class="directive">ServerRoot</code>
804 would be used to set the base directory.</p>
809 <li><a href="../misc/security_tips.html#serverroot">the
810 security tips</a> for information on how to properly set
811 permissions on the <code class="directive">ServerRoot</code></li>
814 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
815 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
816 <table class="directive">
817 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
818 if the value is not <code>none</code>. In prior versions, DefaultType
819 would specify a default media type to assign to response content for
820 which no other media type configuration could be found.
822 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
823 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
824 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
825 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
826 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
827 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
828 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>All choices except <code>none</code> are DISABLED for 2.3.x and later.
831 <p>This directive has been disabled. For backwards compatibility
832 of configuration files, it may be specified with the value
833 <code>none</code>, meaning no default media type. For example:</p>
835 <pre class="prettyprint lang-config">DefaultType None</pre>
838 <p><code>DefaultType None</code> is only available in
839 httpd-2.2.7 and later.</p>
841 <p>Use the mime.types configuration file and the
842 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
843 type assignments via file extensions, or the
844 <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
845 the media type for specific resources. Otherwise, the server will
846 send the response without a Content-Type header field and the
847 recipient may attempt to guess the media type.</p>
851 <li><code class="directive"><a href="#undefine">UnDefine</a></code></li>
852 <li><code class="directive"><a href="#ifdefine">IfDefine</a></code></li>
855 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
856 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
857 <table class="directive">
858 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a variable</td></tr>
859 <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>
860 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
861 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
862 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
864 <p>In its one parameter form, <code class="directive">Define</code> is
865 equivalent to passing the <code>-D</code> argument to
866 <code class="program"><a href="../programs/httpd.html">httpd</a></code>. It can be used to toggle the use of
867 <code class="directive"><a href="#ifdefine"><IfDefine></a></code>
868 sections without needing to alter <code>-D</code> arguments in any
871 <p>In addition to that, if the second parameter is given, a config variable
872 is set to this value. The variable can be used in the configuration using
873 the <code>${VAR}</code> syntax. The variable is always globally defined
874 and not limited to the scope of the surrounding config section.</p>
876 <pre class="prettyprint lang-config"><IfDefine TEST>
877 Define servername test.example.com
879 <IfDefine !TEST>
880 Define servername www.example.com
884 DocumentRoot "/var/www/${servername}/htdocs"</pre>
887 <p>Variable names may not contain colon ":" characters, to avoid clashes
888 with <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>'s syntax.</p>
890 <p>While this directive is supported in virtual host context,
891 the changes it makes are visible to any later configuration
892 directives, beyond any enclosing virtual host.</p>
895 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
896 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
897 <table class="directive">
898 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
899 named file-system directory, sub-directories, and their contents.</td></tr>
900 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
901 ... </Directory></code></td></tr>
902 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
903 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
904 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
906 <p><code class="directive"><Directory></code> and
907 <code></Directory></code> are used to enclose a group of
908 directives that will apply only to the named directory,
909 sub-directories of that directory, and the files within the respective
910 directories. Any directive that is allowed
911 in a directory context may be used. <var>Directory-path</var> is
912 either the full path to a directory, or a wild-card string using
913 Unix shell-style matching. In a wild-card string, <code>?</code> matches
914 any single character, and <code>*</code> matches any sequences of
915 characters. You may also use <code>[]</code> character ranges. None
916 of the wildcards match a `/' character, so <code><Directory
917 "/*/public_html"></code> will not match
918 <code>/home/user/public_html</code>, but <code><Directory
919 "/home/*/public_html"></code> will match. Example:</p>
921 <pre class="prettyprint lang-config"><Directory "/usr/local/httpd/htdocs">
922 Options Indexes FollowSymLinks
923 </Directory></pre>
926 <p>Directory paths <em>may</em> be quoted, if you like, however, it
927 <em>must</em> be quoted if the path contains spaces. This is because a
928 space would otherwise indicate the end of an argument.</p>
931 <p>Be careful with the <var>directory-path</var> arguments:
932 They have to literally match the filesystem path which Apache httpd uses
933 to access the files. Directives applied to a particular
934 <code><Directory></code> will not apply to files accessed from
935 that same directory via a different path, such as via different symbolic
939 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
940 expressions</a> can also be used, with the addition of the
941 <code>~</code> character. For example:</p>
943 <pre class="prettyprint lang-config"><Directory ~ "^/www/[0-9]{3}">
945 </Directory></pre>
948 <p>would match directories in <code>/www/</code> that consisted of
951 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
952 match the directory (or one of its parents) containing a document,
953 then the directives are applied in the order of shortest match
954 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
957 <pre class="prettyprint lang-config"><Directory "/">
961 <Directory "/home">
962 AllowOverride FileInfo
963 </Directory></pre>
966 <p>for access to the document <code>/home/web/dir/doc.html</code>
970 <li>Apply directive <code>AllowOverride None</code>
971 (disabling <code>.htaccess</code> files).</li>
973 <li>Apply directive <code>AllowOverride FileInfo</code> (for
974 directory <code>/home</code>).</li>
976 <li>Apply any <code>FileInfo</code> directives in
977 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
978 <code>/home/web/dir/.htaccess</code> in that order.</li>
981 <p>Regular expressions are not considered until after all of the
982 normal sections have been applied. Then all of the regular
983 expressions are tested in the order they appeared in the
984 configuration file. For example, with</p>
986 <pre class="prettyprint lang-config"><Directory ~ "abc$">
987 # ... directives here ...
988 </Directory></pre>
991 <p>the regular expression section won't be considered until after
992 all normal <code class="directive"><Directory></code>s and
993 <code>.htaccess</code> files have been applied. Then the regular
994 expression will match on <code>/home/abc/public_html/abc</code> and
995 the corresponding <code class="directive"><Directory></code> will
998 <p><strong>Note that the default access for
999 <code><Directory "/"></code> is to permit all access.
1000 This means that Apache httpd will serve any file mapped from an URL. It is
1001 recommended that you change this with a block such
1004 <pre class="prettyprint lang-config"><Directory "/">
1006 </Directory></pre>
1009 <p><strong>and then override this for directories you
1010 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
1011 details.</strong></p>
1013 <p>The directory sections occur in the <code>httpd.conf</code> file.
1014 <code class="directive"><Directory></code> directives
1015 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>
1019 <li><a href="../sections.html">How <Directory>,
1020 <Location> and <Files> sections work</a> for an
1021 explanation of how these different sections are combined when a
1022 request is received</li>
1025 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1026 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
1027 <table class="directive">
1028 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
1029 the contents of file-system directories matching a regular expression.</td></tr>
1030 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
1031 ... </DirectoryMatch></code></td></tr>
1032 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1033 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1034 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1036 <p><code class="directive"><DirectoryMatch></code> and
1037 <code></DirectoryMatch></code> are used to enclose a group
1038 of directives which will apply only to the named directory (and the files within),
1039 the same as <code class="directive"><a href="#directory"><Directory></a></code>.
1040 However, it takes as an argument a
1041 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>. For example:</p>
1043 <pre class="prettyprint lang-config"><DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
1045 </DirectoryMatch></pre>
1048 <p>matches directories in <code>/www/</code> (or any subdirectory thereof)
1049 that consist of three numbers.</p>
1051 <div class="note"><h3>Compatibility</h3>
1052 Prior to 2.3.9, this directive implicitly applied to sub-directories
1053 (like <code class="directive"><a href="#directory"><Directory></a></code>) and
1054 could not match the end of line symbol ($). In 2.3.9 and later,
1055 only directories that match the expression are affected by the enclosed
1059 <div class="note"><h3>Trailing Slash</h3>
1060 This directive applies to requests for directories that may or may
1061 not end in a trailing slash, so expressions that are anchored to the
1062 end of line ($) must be written with care.
1065 <p>From 2.4.8 onwards, named groups and backreferences are captured and
1066 written to the environment with the corresponding name prefixed with
1067 "MATCH_" and in upper case. This allows elements of paths to be referenced
1068 from within <a href="../expr.html">expressions</a> and modules like
1069 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
1070 (unnamed) backreferences are ignored. Use named groups instead.</p>
1072 <pre class="prettyprint lang-config"><DirectoryMatch "^/var/www/combined/(?<sitename>[^/]+)">
1073 Require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1074 </DirectoryMatch></pre>
1079 <li><code class="directive"><a href="#directory"><Directory></a></code> for
1080 a description of how regular expressions are mixed in with normal
1081 <code class="directive"><Directory></code>s</li>
1082 <li><a href="../sections.html">How <Directory>, <Location> and
1083 <Files> sections work</a> for an explanation of how these different
1084 sections are combined when a request is received</li>
1087 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1088 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
1089 <table class="directive">
1090 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
1091 from the web</td></tr>
1092 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
1093 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot "/usr/local/apache/htdocs"</code></td></tr>
1094 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1095 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1096 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1098 <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1099 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
1100 path from the requested URL to the document root to make the
1101 path to the document. Example:</p>
1103 <pre class="prettyprint lang-config">DocumentRoot "/usr/web"</pre>
1106 <p>then an access to
1107 <code>http://my.example.com/index.html</code> refers to
1108 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
1109 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1111 <p>The <code class="directive">DocumentRoot</code> should be specified without
1112 a trailing slash.</p>
1116 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
1120 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1121 <div class="directive-section"><h2><a name="Else" id="Else"><Else></a> <a name="else" id="else">Directive</a></h2>
1122 <table class="directive">
1123 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if the condition of a
1124 previous <code class="directive"><a href="#if"><If></a></code> or
1125 <code class="directive"><a href="#elseif"><ElseIf></a></code> section is not
1126 satisfied by a request at runtime</td></tr>
1127 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Else> ... </Else></code></td></tr>
1128 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1129 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1130 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1131 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1133 <p>The <code class="directive"><Else></code> applies the enclosed
1134 directives if and only if the most recent
1135 <code class="directive"><If></code> or
1136 <code class="directive"><ElseIf></code> section
1137 in the same scope has not been applied.
1138 For example: In </p>
1140 <pre class="prettyprint lang-config"><If "-z req('Host')">
1148 <p> The <code class="directive"><If></code> would match HTTP/1.0
1149 requests without a <var>Host:</var> header and the
1150 <code class="directive"><Else></code> would match requests
1151 with a <var>Host:</var> header.</p>
1156 <li><code class="directive"><a href="#if"><If></a></code></li>
1157 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
1158 <li><a href="../sections.html">How <Directory>, <Location>,
1159 <Files> sections work</a> for an explanation of how these
1160 different sections are combined when a request is received.
1161 <code class="directive"><If></code>,
1162 <code class="directive"><ElseIf></code>, and
1163 <code class="directive"><Else></code> are applied last.</li>
1166 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1167 <div class="directive-section"><h2><a name="ElseIf" id="ElseIf"><ElseIf></a> <a name="elseif" id="elseif">Directive</a></h2>
1168 <table class="directive">
1169 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is satisfied
1170 by a request at runtime while the condition of a previous
1171 <code class="directive"><a href="#if"><If></a></code> or
1172 <code class="directive"><ElseIf></code> section is not
1174 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><ElseIf <var>expression</var>> ... </ElseIf></code></td></tr>
1175 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1176 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1177 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1178 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1180 <p>The <code class="directive"><ElseIf></code> applies the enclosed
1181 directives if and only if both the given condition evaluates to true and
1182 the most recent <code class="directive"><If></code> or
1183 <code class="directive"><ElseIf></code> section in the same scope has
1184 not been applied. For example: In </p>
1186 <pre class="prettyprint lang-config"><If "-R '10.1.0.0/16'">
1189 <ElseIf "-R '10.0.0.0/8'">
1197 <p>The <code class="directive"><ElseIf></code> would match if
1198 the remote address of a request belongs to the subnet 10.0.0.0/8 but
1199 not to the subnet 10.1.0.0/16.</p>
1204 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
1205 for a complete reference and more examples.</li>
1206 <li><code class="directive"><a href="#if"><If></a></code></li>
1207 <li><code class="directive"><a href="#else"><Else></a></code></li>
1208 <li><a href="../sections.html">How <Directory>, <Location>,
1209 <Files> sections work</a> for an explanation of how these
1210 different sections are combined when a request is received.
1211 <code class="directive"><If></code>,
1212 <code class="directive"><ElseIf></code>, and
1213 <code class="directive"><Else></code> are applied last.</li>
1216 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1217 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
1218 <table class="directive">
1219 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
1220 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
1221 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
1222 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1223 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1224 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1225 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1227 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
1228 memory-mapping if it needs to read the contents of a file during
1229 delivery. By default, when the handling of a request requires
1230 access to the data within a file -- for example, when delivering a
1231 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache httpd
1232 memory-maps the file if the OS supports it.</p>
1234 <p>This memory-mapping sometimes yields a performance improvement.
1235 But in some environments, it is better to disable the memory-mapping
1236 to prevent operational problems:</p>
1239 <li>On some multiprocessor systems, memory-mapping can reduce the
1240 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
1241 <li>Deleting or truncating a file while <code class="program"><a href="../programs/httpd.html">httpd</a></code>
1242 has it memory-mapped can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1243 crash with a segmentation fault.
1247 <p>For server configurations that are vulnerable to these problems,
1248 you should disable memory-mapping of delivered files by specifying:</p>
1250 <pre class="prettyprint lang-config">EnableMMAP Off</pre>
1253 <p>For NFS mounted files, this feature may be disabled explicitly for
1254 the offending files by specifying:</p>
1256 <pre class="prettyprint lang-config"><Directory "/path-to-nfs-files">
1258 </Directory></pre>
1262 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1263 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
1264 <table class="directive">
1265 <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>
1266 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
1267 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile Off</code></td></tr>
1268 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1269 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1270 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1271 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1272 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Default changed to Off in
1273 version 2.3.9.</td></tr>
1275 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
1276 sendfile support from the kernel to transmit file contents to the client.
1277 By default, when the handling of a request requires no access
1278 to the data within a file -- for example, when delivering a
1279 static file -- Apache httpd uses sendfile to deliver the file contents
1280 without ever reading the file if the OS supports it.</p>
1282 <p>This sendfile mechanism avoids separate read and send operations,
1283 and buffer allocations. But on some platforms or within some
1284 filesystems, it is better to disable this feature to avoid
1285 operational problems:</p>
1288 <li>Some platforms may have broken sendfile support that the build
1289 system did not detect, especially if the binaries were built on
1290 another box and moved to such a machine with broken sendfile
1292 <li>On Linux the use of sendfile triggers TCP-checksum
1293 offloading bugs on certain networking cards when using IPv6.</li>
1294 <li>On Linux on Itanium, <code>sendfile</code> may be unable to handle
1295 files over 2GB in size.</li>
1296 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS, SMB, CIFS, FUSE),
1297 the kernel may be unable to serve the network file through
1301 <p>For server configurations that are not vulnerable to these problems,
1302 you may enable this feature by specifying:</p>
1304 <pre class="prettyprint lang-config">EnableSendfile On</pre>
1307 <p>For network mounted files, this feature may be disabled explicitly
1308 for the offending files by specifying:</p>
1310 <pre class="prettyprint lang-config"><Directory "/path-to-nfs-files">
1312 </Directory></pre>
1314 <p>Please note that the per-directory and .htaccess configuration
1315 of <code class="directive">EnableSendfile</code> is not supported by
1316 <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code>.
1317 Only global definition of <code class="directive">EnableSendfile</code>
1318 is taken into account by the module.
1322 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1323 <div class="directive-section"><h2><a name="Error" id="Error">Error</a> <a name="error" id="error">Directive</a></h2>
1324 <table class="directive">
1325 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Abort configuration parsing with a custom error message</td></tr>
1326 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Error <var>message</var></code></td></tr>
1327 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1328 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1329 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1330 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.3.9 and later</td></tr>
1332 <p>If an error can be detected within the configuration, this
1333 directive can be used to generate a custom error message, and halt
1334 configuration parsing. The typical use is for reporting required
1335 modules which are missing from the configuration.</p>
1337 <pre class="prettyprint lang-config"># Example
1338 # ensure that mod_include is loaded
1339 <IfModule !include_module>
1340 Error "mod_include is required by mod_foo. Load it with LoadModule."
1343 # ensure that exactly one of SSL,NOSSL is defined
1344 <IfDefine SSL>
1345 <IfDefine NOSSL>
1346 Error "Both SSL and NOSSL are defined. Define only one of them."
1349 <IfDefine !SSL>
1350 <IfDefine !NOSSL>
1351 Error "Either SSL or NOSSL must be defined."
1353 </IfDefine></pre>
1358 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1359 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
1360 <table class="directive">
1361 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
1362 in case of an error</td></tr>
1363 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
1364 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1365 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1366 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1367 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1369 <p>In the event of a problem or error, Apache httpd can be configured
1370 to do one of four things,</p>
1373 <li>output a simple hardcoded error message</li>
1375 <li>output a customized message</li>
1377 <li>internally redirect to a local <var>URL-path</var> to handle the
1380 <li>redirect to an external <var>URL</var> to handle the
1384 <p>The first option is the default, while options 2-4 are
1385 configured using the <code class="directive">ErrorDocument</code>
1386 directive, which is followed by the HTTP response code and a URL
1387 or a message. Apache httpd will sometimes offer additional information
1388 regarding the problem/error.</p>
1390 <p>From 2.4.13, <a href="../expr.html">expression syntax</a> can be
1391 used inside the directive to produce dynamic strings and URLs.</p>
1393 <p>URLs can begin with a slash (/) for local web-paths (relative
1394 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1395 full URL which the client can resolve. Alternatively, a message
1396 can be provided to be displayed by the browser. Note that deciding
1397 whether the parameter is an URL, a path or a message is performed
1398 before any expression is parsed. Examples:</p>
1400 <pre class="prettyprint lang-config">ErrorDocument 500 http://example.com/cgi-bin/server-error.cgi
1401 ErrorDocument 404 /errors/bad_urls.php
1402 ErrorDocument 401 /subscription_info.html
1403 ErrorDocument 403 "Sorry, can't allow you access today"
1404 ErrorDocument 403 Forbidden!
1405 ErrorDocument 403 /errors/forbidden.py?referrer=%{escape:%{HTTP_REFERER}}</pre>
1408 <p>Additionally, the special value <code>default</code> can be used
1409 to specify Apache httpd's simple hardcoded message. While not required
1410 under normal circumstances, <code>default</code> will restore
1411 Apache httpd's simple hardcoded message for configurations that would
1412 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1414 <pre class="prettyprint lang-config">ErrorDocument 404 /cgi-bin/bad_urls.pl
1416 <Directory "/web/docs">
1417 ErrorDocument 404 default
1418 </Directory></pre>
1421 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1422 that points to a remote URL (ie. anything with a method such as
1423 <code>http</code> in front of it), Apache HTTP Server will send a redirect to the
1424 client to tell it where to find the document, even if the
1425 document ends up being on the same server. This has several
1426 implications, the most important being that the client will not
1427 receive the original error status code, but instead will
1428 receive a redirect status code. This in turn can confuse web
1429 robots and other clients which try to determine if a URL is
1430 valid using the status code. In addition, if you use a remote
1431 URL in an <code>ErrorDocument 401</code>, the client will not
1432 know to prompt the user for a password since it will not
1433 receive the 401 status code. Therefore, <strong>if you use an
1434 <code>ErrorDocument 401</code> directive, then it must refer to a local
1435 document.</strong></p>
1437 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1438 server-generated error messages when they are "too small" and substitute
1439 its own "friendly" error messages. The size threshold varies depending on
1440 the type of error, but in general, if you make your error document
1441 greater than 512 bytes, then MSIE will show the server-generated
1442 error rather than masking it. More information is available in
1443 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1445 <p>Although most error messages can be overridden, there are certain
1446 circumstances where the internal messages are used regardless of the
1447 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1448 particular, if a malformed request is detected, normal request processing
1449 will be immediately halted and the internal error message returned.
1450 This is necessary to guard against security problems caused by
1453 <p>If you are using mod_proxy, you may wish to enable
1454 <code class="directive"><a href="../mod/mod_proxy.html#proxyerroroverride">ProxyErrorOverride</a></code> so that you can provide
1455 custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride,
1456 Apache httpd will not generate custom error documents for proxied content.</p>
1460 <li><a href="../custom-error.html">documentation of
1461 customizable responses</a></li>
1464 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1465 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1466 <table class="directive">
1467 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1468 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLog <var>file-path</var>|syslog[:[<var>facility</var>][:<var>tag</var>]]</code></td></tr>
1469 <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>
1470 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1471 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1472 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1474 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1475 the file to which the server will log any errors it encounters. If
1476 the <var>file-path</var> is not absolute then it is assumed to be
1477 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1479 <pre class="prettyprint lang-config">ErrorLog "/var/log/httpd/error_log"</pre>
1482 <p>If the <var>file-path</var>
1483 begins with a pipe character "<code>|</code>" then it is assumed to be a
1484 command to spawn to handle the error log.</p>
1486 <pre class="prettyprint lang-config">ErrorLog "|/usr/local/bin/httpd_errors"</pre>
1489 <p>See the notes on <a href="../logs.html#piped">piped logs</a> for
1490 more information.</p>
1492 <p>Using <code>syslog</code> instead of a filename enables logging
1493 via syslogd(8) if the system supports it and if <code class="module"><a href="../mod/mod_syslog.html">mod_syslog</a></code>
1494 is loaded. The default is to use syslog facility <code>local7</code>,
1495 but you can override this by using the <code>syslog:<var>facility</var></code>
1496 syntax where <var>facility</var> can be one of the names usually documented in
1497 syslog(1). The facility is effectively global, and if it is changed
1498 in individual virtual hosts, the final facility specified affects the
1499 entire server. Same rules apply for the syslog tag, which by default
1500 uses the Apache binary name, <code>httpd</code> in most cases. You can
1501 also override this by using the <code>syslog::<var>tag</var></code>
1504 <pre class="prettyprint lang-config">ErrorLog syslog:user
1505 ErrorLog syslog:user:httpd.srv1
1506 ErrorLog syslog::httpd.srv2</pre>
1509 <p>Additional modules can provide their own ErrorLog providers. The syntax
1510 is similar to the <code>syslog</code> example above.</p>
1512 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1513 document for details on why your security could be compromised
1514 if the directory where log files are stored is writable by
1515 anyone other than the user that starts the server.</p>
1516 <div class="warning"><h3>Note</h3>
1517 <p>When entering a file path on non-Unix platforms, care should be taken
1518 to make sure that only forward slashes are used even though the platform
1519 may allow the use of back slashes. In general it is a good idea to always
1520 use forward slashes throughout the configuration files.</p>
1525 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1526 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1529 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1530 <div class="directive-section"><h2><a name="ErrorLogFormat" id="ErrorLogFormat">ErrorLogFormat</a> <a name="errorlogformat" id="errorlogformat">Directive</a></h2>
1531 <table class="directive">
1532 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Format specification for error log entries</td></tr>
1533 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLogFormat [connection|request] <var>format</var></code></td></tr>
1534 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1535 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1536 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1538 <p><code class="directive">ErrorLogFormat</code> allows to specify what
1539 supplementary information is logged in the error log in addition to the
1540 actual log message.</p>
1542 <pre class="prettyprint lang-config">#Simple example
1543 ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"</pre>
1546 <p>Specifying <code>connection</code> or <code>request</code> as first
1547 parameter allows to specify additional formats, causing additional
1548 information to be logged when the first message is logged for a specific
1549 connection or request, respectively. This additional information is only
1550 logged once per connection/request. If a connection or request is processed
1551 without causing any log message, the additional information is not logged
1554 <p>It can happen that some format string items do not produce output. For
1555 example, the Referer header is only present if the log message is
1556 associated to a request and the log message happens at a time when the
1557 Referer header has already been read from the client. If no output is
1558 produced, the default behavior is to delete everything from the preceding
1559 space character to the next space character. This means the log line is
1560 implicitly divided into fields on non-whitespace to whitespace transitions.
1561 If a format string item does not produce output, the whole field is
1562 omitted. For example, if the remote address <code>%a</code> in the log
1563 format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
1564 brackets are not logged either. Space characters can be escaped with a
1565 backslash to prevent them from delimiting a field. The combination '% '
1566 (percent space) is a zero-width field delimiter that does not produce any
1569 <p>The above behavior can be changed by adding modifiers to the format
1570 string item. A <code>-</code> (minus) modifier causes a minus to be logged if the
1571 respective item does not produce any output. In once-per-connection/request
1572 formats, it is also possible to use the <code>+</code> (plus) modifier. If an
1573 item with the plus modifier does not produce any output, the whole line is
1576 <p>A number as modifier can be used to assign a log severity level to a
1577 format item. The item will only be logged if the severity of the log
1578 message is not higher than the specified log severity level. The number can
1579 range from 1 (alert) over 4 (warn) and 7 (debug) to 15 (trace8).</p>
1581 <p>For example, here's what would happen if you added modifiers to
1582 the <code>%{Referer}i</code> token, which logs the
1583 <code>Referer</code> request header.</p>
1585 <table class="bordered"><tr class="header"><th>Modified Token</th><th>Meaning</th></tr>
1587 <td><code>%-{Referer}i</code></td>
1588 <td>Logs a <code>-</code> if <code>Referer</code> is not set.</td>
1591 <td><code>%+{Referer}i</code></td>
1592 <td>Omits the entire line if <code>Referer</code> is not set.</td>
1595 <td><code>%4{Referer}i</code></td>
1596 <td>Logs the <code>Referer</code> only if the log message severity
1597 is higher than 4.</td>
1601 <p>Some format string items accept additional parameters in braces.</p>
1603 <table class="bordered"><tr class="header"><th>Format String</th> <th>Description</th></tr>
1604 <tr><td><code>%%</code></td>
1605 <td>The percent sign</td></tr>
1606 <tr class="odd"><td><code>%a</code></td>
1607 <td>Client IP address and port of the request</td></tr>
1608 <tr><td><code>%{c}a</code></td>
1609 <td>Underlying peer IP address and port of the connection (see the
1610 <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module)</td></tr>
1611 <tr class="odd"><td><code>%A</code></td>
1612 <td>Local IP-address and port</td></tr>
1613 <tr><td><code>%{<em>name</em>}e</code></td>
1614 <td>Request environment variable <em>name</em></td></tr>
1615 <tr class="odd"><td><code>%E</code></td>
1616 <td>APR/OS error status code and string</td></tr>
1617 <tr><td><code>%F</code></td>
1618 <td>Source file name and line number of the log call</td></tr>
1619 <tr class="odd"><td><code>%{<em>name</em>}i</code></td>
1620 <td>Request header <em>name</em></td></tr>
1621 <tr><td><code>%k</code></td>
1622 <td>Number of keep-alive requests on this connection</td></tr>
1623 <tr class="odd"><td><code>%l</code></td>
1624 <td>Loglevel of the message</td></tr>
1625 <tr><td><code>%L</code></td>
1626 <td>Log ID of the request</td></tr>
1627 <tr class="odd"><td><code>%{c}L</code></td>
1628 <td>Log ID of the connection</td></tr>
1629 <tr><td><code>%{C}L</code></td>
1630 <td>Log ID of the connection if used in connection scope, empty otherwise</td></tr>
1631 <tr class="odd"><td><code>%m</code></td>
1632 <td>Name of the module logging the message</td></tr>
1633 <tr><td><code>%M</code></td>
1634 <td>The actual log message</td></tr>
1635 <tr class="odd"><td><code>%{<em>name</em>}n</code></td>
1636 <td>Request note <em>name</em></td></tr>
1637 <tr><td><code>%P</code></td>
1638 <td>Process ID of current process</td></tr>
1639 <tr class="odd"><td><code>%T</code></td>
1640 <td>Thread ID of current thread</td></tr>
1641 <tr><td><code>%{g}T</code></td>
1642 <td>System unique thread ID of current thread (the same ID as
1643 displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
1644 <tr class="odd"><td><code>%t</code></td>
1645 <td>The current time</td></tr>
1646 <tr><td><code>%{u}t</code></td>
1647 <td>The current time including micro-seconds</td></tr>
1648 <tr class="odd"><td><code>%{cu}t</code></td>
1649 <td>The current time in compact ISO 8601 format, including
1650 micro-seconds</td></tr>
1651 <tr><td><code>%v</code></td>
1652 <td>The canonical <code class="directive"><a href="#servername">ServerName</a></code>
1653 of the current server.</td></tr>
1654 <tr class="odd"><td><code>%V</code></td>
1655 <td>The server name of the server serving the request according to the
1656 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
1658 <tr><td><code>\ </code> (backslash space)</td>
1659 <td>Non-field delimiting space</td></tr>
1660 <tr class="odd"><td><code>% </code> (percent space)</td>
1661 <td>Field delimiter (no output)</td></tr>
1664 <p>The log ID format <code>%L</code> produces a unique id for a connection
1665 or request. This can be used to correlate which log lines belong to the
1666 same connection or request, which request happens on which connection.
1667 A <code>%L</code> format string is also available in
1668 <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code> to allow to correlate access log entries
1669 with error log lines. If <code class="module"><a href="../mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its
1670 unique id will be used as log ID for requests.</p>
1672 <pre class="prettyprint lang-config">#Example (default format for threaded MPMs)
1673 ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1676 <p>This would result in error messages such as:</p>
1678 <div class="example"><p><code>
1679 [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
1682 <p>Notice that, as discussed above, some fields are omitted
1683 entirely because they are not defined.</p>
1685 <pre class="prettyprint lang-config">#Example (similar to the 2.2.x format)
1686 ErrorLogFormat "[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</pre>
1689 <pre class="prettyprint lang-config">#Advanced example with request/connection log IDs
1690 ErrorLogFormat "[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M"
1691 ErrorLogFormat request "[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T"
1692 ErrorLogFormat request "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'"
1693 ErrorLogFormat request "[%{uc}t] [R:%L] Referer:'%+{Referer}i'"
1694 ErrorLogFormat connection "[%{uc}t] [C:%{c}L] local\ %a remote\ %A"</pre>
1700 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
1701 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1702 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
1705 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1706 <div class="directive-section"><h2><a name="ExtendedStatus" id="ExtendedStatus">ExtendedStatus</a> <a name="extendedstatus" id="extendedstatus">Directive</a></h2>
1707 <table class="directive">
1708 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keep track of extended status information for each
1710 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtendedStatus On|Off</code></td></tr>
1711 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtendedStatus Off[*]</code></td></tr>
1712 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1713 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1714 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1716 <p>This option tracks additional data per worker about the
1717 currently executing request and creates a utilization summary.
1718 You can see these variables during runtime by configuring
1719 <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>. Note that other modules may
1720 rely on this scoreboard.</p>
1722 <p>This setting applies to the entire server and cannot be
1723 enabled or disabled on a virtualhost-by-virtualhost basis.
1724 The collection of extended status information can slow down
1725 the server. Also note that this setting cannot be changed
1726 during a graceful restart.</p>
1729 <p>Note that loading <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> will change
1730 the default behavior to ExtendedStatus On, while other
1731 third party modules may do the same. Such modules rely on
1732 collecting detailed information about the state of all workers.
1733 The default is changed by <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> beginning
1734 with version 2.3.6. The previous default was always Off.</p>
1739 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1740 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1741 <table class="directive">
1742 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1743 HTTP response header for static files</td></tr>
1744 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1745 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag MTime Size</code></td></tr>
1746 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1747 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1748 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1749 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1750 <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
1754 The <code class="directive">FileETag</code> directive configures the file
1755 attributes that are used to create the <code>ETag</code> (entity
1756 tag) response header field when the document is based on a static file.
1757 (The <code>ETag</code> value is used in cache management to save
1758 network bandwidth.) The
1759 <code class="directive">FileETag</code> directive allows you to choose
1760 which of these -- if any -- should be used. The recognized keywords are:
1764 <dt><strong>INode</strong></dt>
1765 <dd>The file's i-node number will be included in the calculation</dd>
1766 <dt><strong>MTime</strong></dt>
1767 <dd>The date and time the file was last modified will be included</dd>
1768 <dt><strong>Size</strong></dt>
1769 <dd>The number of bytes in the file will be included</dd>
1770 <dt><strong>All</strong></dt>
1771 <dd>All available fields will be used. This is equivalent to:
1772 <pre class="prettyprint lang-config">FileETag INode MTime Size</pre>
1774 <dt><strong>None</strong></dt>
1775 <dd>If a document is file-based, no <code>ETag</code> field will be
1776 included in the response</dd>
1779 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1780 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1781 which allow changes to be made to the default setting inherited
1782 from a broader scope. Any keyword appearing without such a prefix
1783 immediately and completely cancels the inherited setting.</p>
1785 <p>If a directory's configuration includes
1786 <code>FileETag INode MTime Size</code>, and a
1787 subdirectory's includes <code>FileETag -INode</code>,
1788 the setting for that subdirectory (which will be inherited by
1789 any sub-subdirectories that don't override it) will be equivalent to
1790 <code>FileETag MTime Size</code>.</p>
1791 <div class="warning"><h3>Warning</h3>
1792 Do not change the default for directories or locations that have WebDAV
1793 enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1794 <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>MTime Size</code>
1795 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1796 These conditional requests will break if the <code>ETag</code> format is
1797 changed via <code class="directive">FileETag</code>.
1799 <div class="note"><h3>Server Side Includes</h3>
1800 An ETag is not generated for responses parsed by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
1801 since the response entity can change without a change of the INode, MTime, or Size
1802 of the static file with embedded SSI directives.
1807 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1808 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1809 <table class="directive">
1810 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1812 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1813 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1814 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1815 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1816 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1818 <p>The <code class="directive"><Files></code> directive
1819 limits the scope of the enclosed directives by filename. It is comparable
1820 to the <code class="directive"><a href="#directory"><Directory></a></code>
1821 and <code class="directive"><a href="#location"><Location></a></code>
1822 directives. It should be matched with a <code></Files></code>
1823 directive. The directives given within this section will be applied to
1824 any object with a basename (last component of filename) matching the
1825 specified filename. <code class="directive"><Files></code>
1826 sections are processed in the order they appear in the
1827 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1828 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1829 that <code class="directive"><Files></code> can be nested
1830 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1831 portion of the filesystem they apply to.</p>
1833 <p>The <var>filename</var> argument should include a filename, or
1834 a wild-card string, where <code>?</code> matches any single character,
1835 and <code>*</code> matches any sequences of characters.</p>
1836 <pre class="prettyprint lang-config"><Files "cat.html">
1837 # Insert stuff that applies to cat.html here
1840 <Files "?at.*">
1841 # This would apply to cat.html, bat.html, hat.php and so on.
1842 </Files></pre>
1844 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1845 can also be used, with the addition of the
1846 <code>~</code> character. For example:</p>
1848 <pre class="prettyprint lang-config"><Files ~ "\.(gif|jpe?g|png)$">
1850 </Files></pre>
1853 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1856 <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
1857 <code>.htaccess</code> files. This allows users to control access to
1858 their own files, at a file-by-file level.</p>
1863 <li><a href="../sections.html">How <Directory>, <Location>
1864 and <Files> sections work</a> for an explanation of how these
1865 different sections are combined when a request is received</li>
1868 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1869 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1870 <table class="directive">
1871 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1873 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1874 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1875 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1876 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1877 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1879 <p>The <code class="directive"><FilesMatch></code> directive
1880 limits the scope of the enclosed directives by filename, just as the
1881 <code class="directive"><a href="#files"><Files></a></code> directive
1882 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1883 expression</a>. For example:</p>
1885 <pre class="prettyprint lang-config"><FilesMatch ".+\.(gif|jpe?g|png)$">
1887 </FilesMatch></pre>
1890 <p>would match most common Internet graphics formats.</p>
1892 <div class="note">The <code>.+</code> at the start of the regex ensures that
1893 files named <code>.png</code>, or <code>.gif</code>, for example,
1894 are not matched.</div>
1896 <p>From 2.4.8 onwards, named groups and backreferences are captured and
1897 written to the environment with the corresponding name prefixed with
1898 "MATCH_" and in upper case. This allows elements of files to be referenced
1899 from within <a href="../expr.html">expressions</a> and modules like
1900 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
1901 (unnamed) backreferences are ignored. Use named groups instead.</p>
1903 <pre class="prettyprint lang-config"><FilesMatch "^(?<sitename>[^/]+)">
1904 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
1905 </FilesMatch></pre>
1910 <li><a href="../sections.html">How <Directory>, <Location>
1911 and <Files> sections work</a> for an explanation of how these
1912 different sections are combined when a request is received</li>
1915 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1916 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1917 <table class="directive">
1918 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1919 media type in the HTTP Content-Type header field</td></tr>
1920 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1921 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1922 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1923 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1924 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1926 <p>When placed into an <code>.htaccess</code> file or a
1927 <code class="directive"><a href="#directory"><Directory></a></code>, or
1928 <code class="directive"><a href="#location"><Location></a></code> or
1929 <code class="directive"><a href="#files"><Files></a></code>
1930 section, this directive forces all matching files to be served
1931 with the content type identification given by
1932 <var>media-type</var>. For example, if you had a directory full of
1933 GIF files, but did not want to label them all with <code>.gif</code>,
1934 you might want to use:</p>
1936 <pre class="prettyprint lang-config">ForceType image/gif</pre>
1939 <p>Note that this directive overrides other indirect media type
1940 associations defined in mime.types or via the
1941 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1943 <p>You can also override more general
1944 <code class="directive">ForceType</code> settings
1945 by using the value of <code>None</code>:</p>
1947 <pre class="prettyprint lang-config"># force all files to be image/gif:
1948 <Location "/images">
1952 # but normal mime-type associations here:
1953 <Location "/images/mixed">
1955 </Location></pre>
1958 <p>This directive primarily overrides the content types generated for
1959 static files served out of the filesystem. For resources other than
1960 static files, where the generator of the response typically specifies
1961 a Content-Type, this directive has no effect.</p>
1964 <div class="note"><h3>Note</h3>
1965 <p>If no handler is explicitly set for a request, the specified content
1966 type will also be used as the handler name. </p>
1968 <p>When explicit directives such as
1969 <code class="directive"><a href="#sethandler">SetHandler</a></code> or
1970 <code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code> do not apply
1971 to the current request, the internal handler name normally set by those
1972 directives is instead set to the content type specified by this directive.
1975 This is a historical behavior that some third-party modules
1976 (such as mod_php) may look for a "synthetic" content type used only to
1977 signal the module to take responsibility for the matching request.
1980 <p>Configurations that rely on such "synthetic" types should be avoided.
1981 Additionally, configurations that restrict access to
1982 <code class="directive"><a href="#sethandler">SetHandler</a></code> or
1983 <code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code> should
1984 restrict access to this directive as well.</p>
1989 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1990 <div class="directive-section"><h2><a name="GprofDir" id="GprofDir">GprofDir</a> <a name="gprofdir" id="gprofdir">Directive</a></h2>
1991 <table class="directive">
1992 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory to write gmon.out profiling data to. </td></tr>
1993 <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>
1994 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1995 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1996 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1998 <p>When the server has been compiled with gprof profiling support,
1999 <code class="directive">GprofDir</code> causes <code>gmon.out</code> files to
2000 be written to the specified directory when the process exits. If the
2001 argument ends with a percent symbol ('%'), subdirectories are created
2002 for each process id.</p>
2004 <p>This directive currently only works with the <code class="module"><a href="../mod/prefork.html">prefork</a></code>
2008 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2009 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
2010 <table class="directive">
2011 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
2012 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
2013 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
2014 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2015 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2016 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2018 <p>This directive enables DNS lookups so that host names can be
2019 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
2020 The value <code>Double</code> refers to doing double-reverse
2021 DNS lookup. That is, after a reverse lookup is performed, a forward
2022 lookup is then performed on that result. At least one of the IP
2023 addresses in the forward lookup must match the original
2024 address. (In "tcpwrappers" terminology this is called
2025 <code>PARANOID</code>.)</p>
2027 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
2028 used for controlling access by hostname, a double reverse lookup
2029 will be performed. This is necessary for security. Note that the
2030 result of this double-reverse isn't generally available unless you
2031 set <code>HostnameLookups Double</code>. For example, if only
2032 <code>HostnameLookups On</code> and a request is made to an object
2033 that is protected by hostname restrictions, regardless of whether
2034 the double-reverse fails or not, CGIs will still be passed the
2035 single-reverse result in <code>REMOTE_HOST</code>.</p>
2037 <p>The default is <code>Off</code> in order to save the network
2038 traffic for those sites that don't truly need the reverse
2039 lookups done. It is also better for the end users because they
2040 don't have to suffer the extra latency that a lookup entails.
2041 Heavily loaded sites should leave this directive
2042 <code>Off</code>, since DNS lookups can take considerable
2043 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
2044 default to the <code>bin</code> subdirectory of your installation
2045 directory, can be used to look up host names from logged IP addresses
2048 <p>Finally, if you have <a href="mod_authz_host.html#reqhost">hostname-based Require
2049 directives</a>, a hostname lookup will be performed regardless of
2050 the setting of <code>HostnameLookups</code>.</p>
2053 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2054 <div class="directive-section"><h2><a name="HttpProtocolOptions" id="HttpProtocolOptions">HttpProtocolOptions</a> <a name="httpprotocoloptions" id="httpprotocoloptions">Directive</a></h2>
2055 <table class="directive">
2056 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Modify restrictions on HTTP Request Messages</td></tr>
2057 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HttpProtocolOptions [Strict|Unsafe] [RegisteredMethods|LenientMethods]
2058 [Allow0.9|Require1.0]</code></td></tr>
2059 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HttpProtocolOptions Strict LenientMethods Allow0.9</code></td></tr>
2060 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2061 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2062 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2063 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.2.32 or 2.4.24 and later</td></tr>
2065 <p>This directive changes the rules applied to the HTTP Request Line
2066 (<a href="https://tools.ietf.org/html/rfc7230#section-3.1.1">RFC 7230 §3.1.1</a>) and the HTTP Request Header Fields
2067 (<a href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230 §3.2</a>), which are now applied by default or using
2068 the <code>Strict</code> option. Due to legacy modules, applications or
2069 custom user-agents which must be deprecated the <code>Unsafe</code>
2070 option has been added to revert to the legacy behaviors.</p>
2072 <p>These rules are applied prior to request processing,
2073 so must be configured at the global or default (first) matching
2074 virtual host section, by IP/port interface (and not by name)
2077 <p>The directive accepts three parameters from the following list
2078 of choices, applying the default to the ones not specified:</p>
2081 <dt>Strict|Unsafe</dt>
2083 <p>Prior to the introduction of this directive, the Apache HTTP Server
2084 request message parsers were tolerant of a number of forms of input
2085 which did not conform to the protocol.
2086 <a href="https://tools.ietf.org/html/rfc7230#section-9.4">RFC 7230 §9.4 Request Splitting</a> and
2087 <a href="https://tools.ietf.org/html/rfc7230#section-9.5">§9.5 Response Smuggling</a> call out only two of the potential
2088 risks of accepting non-conformant request messages, while
2089 <a href="https://tools.ietf.org/html/rfc7230#section-3.5">RFC 7230 §3.5</a> "Message Parsing Robustness" identify the
2090 risks of accepting obscure whitespace and request message formatting.
2091 As of the introduction of this directive, all grammar rules of the
2092 specification are enforced in the default <code>Strict</code> operating
2093 mode, and the strict whitespace suggested by section 3.5 is enforced
2094 and cannot be relaxed.</p>
2096 <div class="warning"><h3>Security risks of Unsafe</h3>
2097 <p>Users are strongly cautioned against toggling the <code>Unsafe</code>
2098 mode of operation, particularly on outward-facing, publicly accessible
2099 server deployments. If an interface is required for faulty monitoring
2100 or other custom service consumers running on an intranet, users should
2101 toggle the Unsafe option only on a specific virtual host configured
2102 to service their internal private network.</p>
2105 <div class="example"><h3>Example of a request leading to HTTP 400 with Strict mode</h3><p><code>
2107 # Missing CRLF<br />
2110 <div class="warning"><h3>Command line tools and CRLF</h3>
2111 <p>Some tools need to be forced to use CRLF, otherwise httpd will return
2112 a HTTP 400 response like described in the above use case. For example,
2113 the <strong>OpenSSL s_client needs the -crlf parameter to work
2114 properly</strong>.</p>
2115 <p>The <code class="directive"><a href="../mod/mod_dumpio.html#dumpioinput">DumpIOInput</a></code> directive
2116 can help while reviewing the HTTP request to identify issues like the
2117 absence of CRLF.</p>
2120 <dt>RegisteredMethods|LenientMethods</dt>
2122 <p><a href="https://tools.ietf.org/html/rfc7231#section-4.1">RFC 7231 §4.1</a> "Request Methods" "Overview" requires that
2123 origin servers shall respond with a HTTP 501 status code when an
2124 unsupported method is encountered in the request line.
2125 This already happens when the <code>LenientMethods</code> option is used,
2126 but administrators may wish to toggle the <code>RegisteredMethods</code>
2127 option and register any non-standard methods using the
2128 <code class="directive"><a href="#registerhttpmethod">RegisterHttpMethod</a></code>
2129 directive, particularly if the <code>Unsafe</code>
2130 option has been toggled.</p>
2132 <div class="warning"><h3>Forward Proxy compatibility</h3>
2133 <p>The <code>RegisteredMethods</code> option should <strong>not</strong>
2134 be toggled for forward proxy hosts, as the methods supported by the
2135 origin servers are unknown to the proxy server.</p>
2138 <div class="example"><h3>Example of a request leading to HTTP 501 with LenientMethods mode</h3><p><code>
2140 # Unknown HTTP method<br />
2141 WOW / HTTP/1.0\r\n\r\n<br /><br />
2142 # Lowercase HTTP method<br />
2143 get / HTTP/1.0\r\n\r\n<br />
2146 <dt>Allow0.9|Require1.0</dt>
2148 <p><a href="https://tools.ietf.org/html/rfc2616#section-19.6">RFC 2616 §19.6</a> "Compatibility With Previous Versions" had
2149 encouraged HTTP servers to support legacy HTTP/0.9 requests. RFC 7230
2150 supersedes this with "The expectation to support HTTP/0.9 requests has
2151 been removed" and offers additional comments in
2152 <a href="https://tools.ietf.org/html/rfc7230#appendix-A">RFC 7230 Appendix A</a>. The <code>Require1.0</code> option allows
2153 the user to remove support of the default <code>Allow0.9</code> option's
2156 <div class="example"><h3>Example of a request leading to HTTP 400 with Require1.0 mode</h3><p><code>
2158 # Unsupported HTTP version<br />
2163 <p>Reviewing the messages logged to the
2164 <code class="directive"><a href="#errorlog">ErrorLog</a></code>, configured with
2165 <code class="directive"><a href="#loglevel">LogLevel</a></code> <code>debug</code> level,
2166 can help identify such faulty requests along with their origin.
2167 Users should pay particular attention to the 400 responses in the access
2168 log for invalid requests which were unexpectedly rejected.</p>
2171 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2172 <div class="directive-section"><h2><a name="If" id="If"><If></a> <a name="if" id="if">Directive</a></h2>
2173 <table class="directive">
2174 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
2175 satisfied by a request at runtime</td></tr>
2176 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><If <var>expression</var>> ... </If></code></td></tr>
2177 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2178 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2179 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2180 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2182 <p>The <code class="directive"><If></code> directive
2183 evaluates an expression at runtime, and applies the enclosed
2184 directives if and only if the expression evaluates to true.
2187 <pre class="prettyprint lang-config"><If "-z req('Host')"></pre>
2190 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.
2191 Expressions may contain various shell-like operators for string
2192 comparison (<code>==</code>, <code>!=</code>, <code><</code>, ...),
2193 integer comparison (<code>-eq</code>, <code>-ne</code>, ...),
2194 and others (<code>-n</code>, <code>-z</code>, <code>-f</code>, ...).
2195 It is also possible to use regular expressions, </p>
2197 <pre class="prettyprint lang-config"><If "%{QUERY_STRING} =~ /(delete|commit)=.*?elem/"></pre>
2200 <p>shell-like pattern matches and many other operations. These operations
2201 can be done on request headers (<code>req</code>), environment variables
2202 (<code>env</code>), and a large number of other properties. The full
2203 documentation is available in <a href="../expr.html">Expressions in
2204 Apache HTTP Server</a>.</p>
2206 <p>Only directives that support the <a href="directive-dict.html#Context">directory context</a> can be used within this configuration section.</p>
2208 <div class="warning">
2209 Certain variables, such as <code>CONTENT_TYPE</code> and other
2210 response headers, are set after <If> conditions have already
2211 been evaluated, and so will not be available to use in this
2218 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
2219 for a complete reference and more examples.</li>
2220 <li><code class="directive"><a href="#elseif"><ElseIf></a></code></li>
2221 <li><code class="directive"><a href="#else"><Else></a></code></li>
2222 <li><a href="../sections.html">How <Directory>, <Location>,
2223 <Files> sections work</a> for an explanation of how these
2224 different sections are combined when a request is received.
2225 <code class="directive"><If></code>,
2226 <code class="directive"><ElseIf></code>, and
2227 <code class="directive"><Else></code> are applied last.</li>
2230 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2231 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
2232 <table class="directive">
2233 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
2234 if a test is true at startup</td></tr>
2235 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
2236 </IfDefine></code></td></tr>
2237 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2238 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2239 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2240 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2242 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
2243 </code> section is used to mark directives that are conditional. The
2244 directives within an <code class="directive"><IfDefine></code>
2245 section are only processed if the <var>test</var> is true. If <var>
2246 test</var> is false, everything between the start and end markers is
2249 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
2252 <li><var>parameter-name</var></li>
2254 <li><code>!</code><var>parameter-name</var></li>
2257 <p>In the former case, the directives between the start and end
2258 markers are only processed if the parameter named
2259 <var>parameter-name</var> is defined. The second format reverses
2260 the test, and only processes the directives if
2261 <var>parameter-name</var> is <strong>not</strong> defined.</p>
2263 <p>The <var>parameter-name</var> argument is a define as given on the
2264 <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
2265 </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
2267 <p><code class="directive"><IfDefine></code> sections are
2268 nest-able, which can be used to implement simple
2269 multiple-parameter tests. Example:</p>
2271 <div class="example"><p><code>httpd -DReverseProxy -DUseCache -DMemCache ...</code></p></div>
2272 <pre class="prettyprint lang-config"><IfDefine ReverseProxy>
2273 LoadModule proxy_module modules/mod_proxy.so
2274 LoadModule proxy_http_module modules/mod_proxy_http.so
2275 <IfDefine UseCache>
2276 LoadModule cache_module modules/mod_cache.so
2277 <IfDefine MemCache>
2278 LoadModule mem_cache_module modules/mod_mem_cache.so
2280 <IfDefine !MemCache>
2281 LoadModule cache_disk_module modules/mod_cache_disk.so
2284 </IfDefine></pre>
2288 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2289 <div class="directive-section"><h2><a name="IfDirective" id="IfDirective"><IfDirective></a> <a name="ifdirective" id="ifdirective">Directive</a></h2>
2290 <table class="directive">
2291 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2292 presence or absence of a specific directive</td></tr>
2293 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDirective [!]<var>directive-name</var>> ...
2294 </IfDirective></code></td></tr>
2295 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2296 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2297 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2298 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2300 <p>The <code><IfDirective <var>test</var>>...</IfDirective></code>
2301 section is used to mark directives that are conditional on the presence of
2302 a specific directive. The directives within an <code class="directive"><IfDirective></code> section are only processed if the <var>test</var>
2303 is true. If <var>test</var> is false, everything between the start and
2304 end markers is ignored.</p>
2306 <p>The <var>test</var> in the <code class="directive"><IfDirective></code> section can be one of two forms:</p>
2309 <li><var>directive-name</var></li>
2311 <li>!<var>directive-name</var></li>
2314 <p>In the former case, the directives between the start and end
2315 markers are only processed if a directive of the given name is
2316 available at the time of processing. The second format reverses the test,
2317 and only processes the directives if the <var>directive-name</var> is
2318 <strong>not</strong> defined.</p>
2320 <div class="note">This section should only be used if you need to have one
2321 configuration file that works across multiple versions of
2322 <code class="program"><a href="../programs/httpd.html">httpd</a></code>, regardless of whether a particular
2323 directive is available. In normal operation, directives need not
2324 be placed in <code class="directive"><IfDirective></code>
2329 <li><code class="directive"><a href="#ifsection"><IfSection></a></code></li>
2332 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2333 <div class="directive-section"><h2><a name="IfFile" id="IfFile"><IfFile></a> <a name="iffile" id="iffile">Directive</a></h2>
2334 <table class="directive">
2335 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
2336 if file exists at startup</td></tr>
2337 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfFile [!]<var>parameter-name</var>> ...
2338 </IfFile></code></td></tr>
2339 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2340 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2341 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2343 <p>The <code><IfFile <var>filename</var>>...</IfFile>
2344 </code> section is used to mark directives that are conditional on
2345 the existence of a file on disk. The directives within an
2346 <code class="directive"><IfFile></code> section are only
2347 processed if the <var>filename</var> exists. If <var> filename</var>
2348 doesn't exist, everything between the start and end markers is
2349 ignored. <var>filename</var> can be an absolute path or a path
2350 relative to the server root.</p>
2352 <p>The <var>filename</var> in the <code class="directive"><IfFile
2353 ></code> section directive can take the same forms as the
2354 <var>test</var> variable in the <code class="directive"><IfDefine
2355 ></code> section, i.e. the test can be negated if the <code>
2356 !</code> character is placed directly before <var>filename</var>.
2359 <p>If a relative <var>filename</var> is supplied, the check is
2360 <code class="directive">ServerRoot</code> relative. In the case where
2361 this directive occurs before the <code class="directive">ServerRoot</code>,
2362 the path will be checked relative to the compiled-in server root or
2363 the server root passed in on the command line via the <code>-d</code>
2368 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2369 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
2370 <table class="directive">
2371 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2372 presence or absence of a specific module</td></tr>
2373 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
2374 </IfModule></code></td></tr>
2375 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2376 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2377 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2378 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2380 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
2381 section is used to mark directives that are conditional on the presence of
2382 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
2383 is true. If <var>test</var> is false, everything between the start and
2384 end markers is ignored.</p>
2386 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
2389 <li><var>module</var></li>
2391 <li>!<var>module</var></li>
2394 <p>In the former case, the directives between the start and end
2395 markers are only processed if the module named <var>module</var>
2396 is included in Apache httpd -- either compiled in or
2397 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
2398 and only processes the directives if <var>module</var> is
2399 <strong>not</strong> included.</p>
2401 <p>The <var>module</var> argument can be either the module identifier or
2402 the file name of the module, at the time it was compiled. For example,
2403 <code>rewrite_module</code> is the identifier and
2404 <code>mod_rewrite.c</code> is the file name. If a module consists of
2405 several source files, use the name of the file containing the string
2406 <code>STANDARD20_MODULE_STUFF</code>.</p>
2408 <p><code class="directive"><IfModule></code> sections are
2409 nest-able, which can be used to implement simple multiple-module
2412 <div class="note">This section should only be used if you need to have one
2413 configuration file that works whether or not a specific module
2414 is available. In normal operation, directives need not be
2415 placed in <code class="directive"><IfModule></code>
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="IfSection" id="IfSection"><IfSection></a> <a name="ifsection" id="ifsection">Directive</a></h2>
2421 <table class="directive">
2422 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
2423 presence or absence of a specific section directive</td></tr>
2424 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfSection [!]<var>section-name</var>> ...
2425 </IfSection></code></td></tr>
2426 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2427 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2428 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2429 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2431 <p>The <code><IfSection
2432 <var>test</var>>...</IfSection></code> section is used
2433 to mark directives that are conditional on the presence of a
2434 specific section directive. A section directive is any directive
2435 such as <code class="directive"><virtualhost></code> which
2436 encloses other directives, and has a directive name with a leading
2439 The directives within an <code class="directive"><IfSection></code> section are only processed if the <var>test</var>
2440 is true. If <var>test</var> is false, everything between the start and
2441 end markers is ignored.</p>
2443 <p>The <var>section-name</var> specified must not include the
2444 leading "<". The <var>test</var> in the <code class="directive"><IfSection></code> section can be one of two
2448 <li><var>section-name</var></li>
2449 <li>!<var>section-name</var></li>
2452 <p>In the former case, the directives between the start and
2453 end markers are only processed if a section directive of the given
2454 name is available at the time of processing. The second format
2455 reverses the test, and only processes the directives if the
2456 <var>section-name</var> is <strong>not</strong> defined.</p>
2460 <pre class="prettyprint lang-config"><IfSection VirtualHost>
2462 </IfSection></pre>
2465 <div class="note">This section should only be used if you need to have one
2466 configuration file that works across multiple versions of <code class="program"><a href="../programs/httpd.html">httpd</a></code>,
2467 regardless of whether a particular section directive is
2468 available. In normal operation, directives need not be placed in
2469 <code class="directive"><IfSection></code> sections.</div>
2473 <li><code class="directive"><a href="#ifdirective"><IfDirective></a></code></li>
2476 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2477 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
2478 <table class="directive">
2479 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2480 the server configuration files</td></tr>
2481 <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>
2482 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2483 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2484 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2485 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Directory
2486 wildcard matching available in 2.3.6 and later</td></tr>
2488 <p>This directive allows inclusion of other configuration files
2489 from within the server configuration files.</p>
2491 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used
2492 in the filename or directory parts of the path to include several files
2493 at once, in alphabetical order. In addition, if
2494 <code class="directive">Include</code> points to a directory, rather than a file,
2495 Apache httpd will read all files in that directory and any subdirectory.
2496 However, including entire directories is not recommended, because it is
2497 easy to accidentally leave temporary files in a directory that can cause
2498 <code class="program"><a href="../programs/httpd.html">httpd</a></code> to fail. Instead, we encourage you to use the
2499 wildcard syntax shown below, to include files that match a particular
2500 pattern, such as *.conf, for example.</p>
2502 <p>The <code class="directive"><a href="#include">Include</a></code> directive will
2503 <strong>fail with an error</strong> if a wildcard expression does not
2504 match any file. The <code class="directive"><a href="#includeoptional">IncludeOptional</a></code>
2505 directive can be used if non-matching wildcards should be ignored.</p>
2507 <p>The file path specified may be an absolute path, or may be relative
2508 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
2512 <pre class="prettyprint lang-config">Include /usr/local/apache2/conf/ssl.conf
2513 Include /usr/local/apache2/conf/vhosts/*.conf</pre>
2516 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
2518 <pre class="prettyprint lang-config">Include conf/ssl.conf
2519 Include conf/vhosts/*.conf</pre>
2522 <p>Wildcards may be included in the directory or file portion of the
2523 path. This example will fail if there is no subdirectory in conf/vhosts
2524 that contains at least one *.conf file:</p>
2526 <pre class="prettyprint lang-config">Include conf/vhosts/*/*.conf</pre>
2529 <p>Alternatively, the following command will just be ignored in case of
2530 missing files or directories:</p>
2532 <pre class="prettyprint lang-config">IncludeOptional conf/vhosts/*/*.conf</pre>
2538 <li><code class="directive"><a href="#includeoptional">IncludeOptional</a></code></li>
2539 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2542 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2543 <div class="directive-section"><h2><a name="IncludeOptional" id="IncludeOptional">IncludeOptional</a> <a name="includeoptional" id="includeoptional">Directive</a></h2>
2544 <table class="directive">
2545 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
2546 the server configuration files</td></tr>
2547 <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>
2548 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2549 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2550 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2551 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in 2.3.6 and later</td></tr>
2553 <p>This directive allows inclusion of other configuration files
2554 from within the server configuration files. It works identically to the
2555 <code class="directive"><a href="#include">Include</a></code> directive, with the
2556 exception that if wildcards do not match any file or directory, the
2557 <code class="directive"><a href="#includeoptional">IncludeOptional</a></code> directive will be
2558 silently ignored instead of causing an error.</p>
2562 <li><code class="directive"><a href="#include">Include</a></code></li>
2563 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
2566 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2567 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
2568 <table class="directive">
2569 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
2570 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
2571 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
2572 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2573 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2574 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2576 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
2577 connection feature of HTTP/1.1 provide long-lived HTTP sessions
2578 which allow multiple requests to be sent over the same TCP
2579 connection. In some cases this has been shown to result in an
2580 almost 50% speedup in latency times for HTML documents with
2581 many images. To enable Keep-Alive connections, set
2582 <code>KeepAlive On</code>.</p>
2584 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
2585 used if they are specifically requested by a client. In
2586 addition, a Keep-Alive connection with an HTTP/1.0 client can
2587 only be used when the length of the content is known in
2588 advance. This implies that dynamic content such as CGI output,
2589 SSI pages, and server-generated directory listings will
2590 generally not use Keep-Alive connections to HTTP/1.0 clients.
2591 For HTTP/1.1 clients, persistent connections are the default
2592 unless otherwise specified. If the client requests it, chunked
2593 encoding will be used in order to send content of unknown
2594 length over persistent connections.</p>
2596 <p>When a client uses a Keep-Alive connection, it will be counted
2597 as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> directive, regardless
2598 of how many requests are sent using the connection.</p>
2602 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
2605 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2606 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
2607 <table class="directive">
2608 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
2609 requests on a persistent connection</td></tr>
2610 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
2611 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
2612 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2613 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2614 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2616 <p>The number of seconds Apache httpd will wait for a subsequent
2617 request before closing the connection. By adding a postfix of ms the
2618 timeout can be also set in milliseconds. Once a request has been
2619 received, the timeout value specified by the
2620 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
2622 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
2623 may cause performance problems in heavily loaded servers. The
2624 higher the timeout, the more server processes will be kept
2625 occupied waiting on connections with idle clients.</p>
2627 <p>If <code class="directive">KeepAliveTimeout</code> is <strong>not</strong>
2628 set for a name-based virtual host, the value of the first defined
2629 virtual host best matching the local IP and port will be used.</p>
2632 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2633 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
2634 <table class="directive">
2635 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
2637 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
2638 </Limit></code></td></tr>
2639 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2640 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2641 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2642 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2644 <p>Access controls are normally effective for
2645 <strong>all</strong> access methods, and this is the usual
2646 desired behavior. <strong>In the general case, access control
2647 directives should not be placed within a
2648 <code class="directive"><Limit></code> section.</strong></p>
2650 <p>The purpose of the <code class="directive"><Limit></code>
2651 directive is to restrict the effect of the access controls to the
2652 nominated HTTP methods. For all other methods, the access
2653 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
2654 effect</strong>. The following example applies the access control
2655 only to the methods <code>POST</code>, <code>PUT</code>, and
2656 <code>DELETE</code>, leaving all other methods unprotected:</p>
2658 <pre class="prettyprint lang-config"><Limit POST PUT DELETE>
2660 </Limit></pre>
2663 <p>The method names listed can be one or more of: <code>GET</code>,
2664 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
2665 <code>CONNECT</code>, <code>OPTIONS</code>,
2666 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
2667 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
2668 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
2669 case-sensitive.</strong> If <code>GET</code> is used, it will also
2670 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
2671 cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
2673 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
2674 used in preference to a <code class="directive"><Limit></code>
2675 section when restricting access, since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
2676 against arbitrary methods.</div>
2678 <p>The <code class="directive"><Limit></code> and
2679 <code class="directive"><a href="#limitexcept"><LimitExcept></a></code>
2680 directives may be nested. In this case, each successive level of
2681 <code class="directive"><Limit></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> directives must
2682 further restrict the set of methods to which access controls apply.</p>
2684 <div class="warning">When using
2685 <code class="directive"><Limit></code> or
2686 <code class="directive"><LimitExcept></code> directives with
2687 the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
2688 note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
2689 to succeed authorizes the request, regardless of the presence of other
2690 <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
2692 <p>For example, given the following configuration, all users will
2693 be authorized for <code>POST</code> requests, and the
2694 <code>Require group editors</code> directive will be ignored
2697 <pre class="prettyprint lang-config"><LimitExcept GET>
2699 </LimitExcept>
2701 Require group editors
2702 </Limit></pre>
2706 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2707 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
2708 <table class="directive">
2709 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
2710 except the named ones</td></tr>
2711 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
2712 </LimitExcept></code></td></tr>
2713 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2714 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
2715 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2716 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2718 <p><code class="directive"><LimitExcept></code> and
2719 <code></LimitExcept></code> are used to enclose
2720 a group of access control directives which will then apply to any
2721 HTTP access method <strong>not</strong> listed in the arguments;
2722 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
2723 both standard and nonstandard/unrecognized methods. See the
2724 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
2728 <pre class="prettyprint lang-config"><LimitExcept POST GET>
2730 </LimitExcept></pre>
2735 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2736 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
2737 <table class="directive">
2738 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
2739 subrequests</td></tr>
2740 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
2741 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
2742 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2743 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2744 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2746 <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
2747 redirects the original request to a CGI script. A subrequest is Apache httpd's
2748 mechanism to find out what would happen for some URI if it were requested.
2749 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
2750 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2753 <p><code class="directive">LimitInternalRecursion</code> prevents the server
2754 from crashing when entering an infinite loop of internal redirects or
2755 subrequests. Such loops are usually caused by misconfigurations.</p>
2757 <p>The directive stores two different limits, which are evaluated on
2758 per-request basis. The first <var>number</var> is the maximum number of
2759 internal redirects that may follow each other. The second <var>number</var>
2760 determines how deeply subrequests may be nested. If you specify only one
2761 <var>number</var>, it will be assigned to both limits.</p>
2763 <pre class="prettyprint lang-config">LimitInternalRecursion 5</pre>
2767 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2768 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
2769 <table class="directive">
2770 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
2771 from the client</td></tr>
2772 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
2773 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
2774 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2775 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2776 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2777 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2779 <p>This directive specifies the number of <var>bytes</var> from 0
2780 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
2781 request body. See the note below for the limited applicability
2782 to proxy requests.</p>
2784 <p>The <code class="directive">LimitRequestBody</code> directive allows
2785 the user to set a limit on the allowed size of an HTTP request
2786 message body within the context in which the directive is given
2787 (server, per-directory, per-file or per-location). If the client
2788 request exceeds that limit, the server will return an error
2789 response instead of servicing the request. The size of a normal
2790 request message body will vary greatly depending on the nature of
2791 the resource and the methods allowed on that resource. CGI scripts
2792 typically use the message body for retrieving form information.
2793 Implementations of the <code>PUT</code> method will require
2794 a value at least as large as any representation that the server
2795 wishes to accept for that resource.</p>
2797 <p>This directive gives the server administrator greater
2798 control over abnormal client request behavior, which may be
2799 useful for avoiding some forms of denial-of-service
2802 <p>If, for example, you are permitting file upload to a particular
2803 location and wish to limit the size of the uploaded file to 100K,
2804 you might use the following directive:</p>
2806 <pre class="prettyprint lang-config">LimitRequestBody 102400</pre>
2809 <div class="note"><p>For a full description of how this directive is interpreted by
2810 proxy requests, see the <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> documentation.</p>
2815 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2816 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
2817 <table class="directive">
2818 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
2819 will be accepted from the client</td></tr>
2820 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
2821 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
2822 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2823 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2824 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2826 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
2827 32767. The default value is defined by the compile-time
2828 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
2831 <p>The <code class="directive">LimitRequestFields</code> directive allows
2832 the server administrator to modify the limit on the number of
2833 request header fields allowed in an HTTP request. A server needs
2834 this value to be larger than the number of fields that a normal
2835 client request might include. The number of request header fields
2836 used by a client rarely exceeds 20, but this may vary among
2837 different client implementations, often depending upon the extent
2838 to which a user has configured their browser to support detailed
2839 content negotiation. Optional HTTP extensions are often expressed
2840 using request header fields.</p>
2842 <p>This directive gives the server administrator greater
2843 control over abnormal client request behavior, which may be
2844 useful for avoiding some forms of denial-of-service attacks.
2845 The value should be increased if normal clients see an error
2846 response from the server that indicates too many fields were
2847 sent in the request.</p>
2851 <pre class="prettyprint lang-config">LimitRequestFields 50</pre>
2854 <div class="warning"><h3>Warning</h3>
2855 <p> When name-based virtual hosting is used, the value for this
2856 directive is taken from the default (first-listed) virtual host for the
2857 local IP and port combination.</p>
2862 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2863 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
2864 <table class="directive">
2865 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
2867 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
2868 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
2869 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2870 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2871 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2873 <p>This directive specifies the number of <var>bytes</var>
2874 that will be allowed in an HTTP request header.</p>
2876 <p>The <code class="directive">LimitRequestFieldSize</code> directive
2877 allows the server administrator to set the limit
2878 on the allowed size of an HTTP request header field. A server
2879 needs this value to be large enough to hold any one header field
2880 from a normal client request. The size of a normal request header
2881 field will vary greatly among different client implementations,
2882 often depending upon the extent to which a user has configured
2883 their browser to support detailed content negotiation. SPNEGO
2884 authentication headers can be up to 12392 bytes.</p>
2886 <p>This directive gives the server administrator greater
2887 control over abnormal client request behavior, which may be
2888 useful for avoiding some forms of denial-of-service attacks.</p>
2892 <pre class="prettyprint lang-config">LimitRequestFieldSize 4094</pre>
2895 <div class="note">Under normal conditions, the value should not be changed from
2898 <div class="warning"><h3>Warning</h3>
2899 <p> When name-based virtual hosting is used, the value for this
2900 directive is taken from the default (first-listed) virtual host best
2901 matching the current IP address and port combination.</p>
2905 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2906 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
2907 <table class="directive">
2908 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
2909 from the client</td></tr>
2910 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
2911 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
2912 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2913 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2914 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2916 <p>This directive sets the number of <var>bytes</var> that will be
2917 allowed on the HTTP request-line.</p>
2919 <p>The <code class="directive">LimitRequestLine</code> directive allows
2920 the server administrator to set the limit on the allowed size
2921 of a client's HTTP request-line. Since the request-line consists of the
2922 HTTP method, URI, and protocol version, the
2923 <code class="directive">LimitRequestLine</code> directive places a
2924 restriction on the length of a request-URI allowed for a request
2925 on the server. A server needs this value to be large enough to
2926 hold any of its resource names, including any information that
2927 might be passed in the query part of a <code>GET</code> request.</p>
2929 <p>This directive gives the server administrator greater
2930 control over abnormal client request behavior, which may be
2931 useful for avoiding some forms of denial-of-service attacks.</p>
2935 <pre class="prettyprint lang-config">LimitRequestLine 4094</pre>
2938 <div class="note">Under normal conditions, the value should not be changed from
2941 <div class="warning"><h3>Warning</h3>
2942 <p> When name-based virtual hosting is used, the value for this
2943 directive is taken from the default (first-listed) virtual host best
2944 matching the current IP address and port combination.</p>
2949 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2950 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
2951 <table class="directive">
2952 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
2953 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
2954 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
2955 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2956 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2957 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2958 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2960 <p>Limit (in bytes) on maximum size of an XML-based request
2961 body. A value of <code>0</code> will disable any checking.</p>
2965 <pre class="prettyprint lang-config">LimitXMLRequestBody 0</pre>
2970 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2971 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
2972 <table class="directive">
2973 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
2975 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
2976 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
2977 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2978 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2979 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2981 <p>The <code class="directive"><Location></code> directive
2982 limits the scope of the enclosed directives by URL. It is similar to the
2983 <code class="directive"><a href="#directory"><Directory></a></code>
2984 directive, and starts a subsection which is terminated with a
2985 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
2986 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
2987 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
2989 <p><code class="directive"><Location></code> sections operate
2990 completely outside the filesystem. This has several consequences.
2991 Most importantly, <code class="directive"><Location></code>
2992 directives should not be used to control access to filesystem
2993 locations. Since several different URLs may map to the same
2994 filesystem location, such access controls may by circumvented.</p>
2996 <p>The enclosed directives will be applied to the request if the path component
2997 of the URL meets <em>any</em> of the following criteria:
3000 <li>The specified location matches exactly the path component of the URL.
3002 <li>The specified location, which ends in a forward slash, is a prefix
3003 of the path component of the URL (treated as a context root).
3005 <li>The specified location, with the addition of a trailing slash, is a
3006 prefix of the path component of the URL (also treated as a context root).
3010 In the example below, where no trailing slash is used, requests to
3011 /private1, /private1/ and /private1/file.txt will have the enclosed
3012 directives applied, but /private1other would not.
3014 <pre class="prettyprint lang-config"><Location "/private1">
3016 </Location></pre>
3019 In the example below, where a trailing slash is used, requests to
3020 /private2/ and /private2/file.txt will have the enclosed
3021 directives applied, but /private2 and /private2other would not.
3023 <pre class="prettyprint lang-config"><Location "/private2<em>/</em>">
3025 </Location></pre>
3028 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
3030 <p>Use <code class="directive"><Location></code> to apply
3031 directives to content that lives outside the filesystem. For
3032 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
3033 <code><Location "/"></code>, which is an easy way to
3034 apply a configuration to the entire server.</p>
3037 <p>For all origin (non-proxy) requests, the URL to be matched is a
3038 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
3039 port, or query string may be included.</em> For proxy requests, the
3040 URL to be matched is of the form
3041 <code>scheme://servername/path</code>, and you must include the
3044 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
3045 any single character, and <code>*</code> matches any sequences of
3046 characters. Neither wildcard character matches a / in the URL-path.</p>
3048 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
3049 can also be used, with the addition of the <code>~</code>
3050 character. For example:</p>
3052 <pre class="prettyprint lang-config"><Location ~ "/(extra|special)/data">
3054 </Location></pre>
3057 <p>would match URLs that contained the substring <code>/extra/data</code>
3058 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
3059 identical to the regex version of <code class="directive"><Location></code>, and is preferred, for the
3060 simple reason that <code>~</code> is hard to distinguish from
3061 <code>-</code> in many fonts.</p>
3063 <p>The <code class="directive"><Location></code>
3064 functionality is especially useful when combined with the
3065 <code class="directive"><a href="#sethandler">SetHandler</a></code>
3066 directive. For example, to enable status requests but allow them
3067 only from browsers at <code>example.com</code>, you might use:</p>
3069 <pre class="prettyprint lang-config"><Location "/status">
3070 SetHandler server-status
3071 Require host example.com
3072 </Location></pre>
3075 <div class="note"><h3>Note about / (slash)</h3>
3076 <p>The slash character has special meaning depending on where in a
3077 URL it appears. People may be used to its behavior in the filesystem
3078 where multiple adjacent slashes are frequently collapsed to a single
3079 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
3080 <code>/home/foo</code>). In URL-space this is not necessarily true.
3081 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
3082 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
3083 slashes if that is your intention.</p>
3085 <p>For example, <code><LocationMatch "^/abc"></code> would match
3086 the request URL <code>/abc</code> but not the request URL <code>
3087 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
3088 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
3089 implicitly match multiple slashes with a single slash. For example,
3090 if you specify <code><Location "/abc/def"></code> and the
3091 request is to <code>/abc//def</code> then it will match.</p>
3096 <li><a href="../sections.html">How <Directory>, <Location>
3097 and <Files> sections work</a> for an explanation of how these
3098 different sections are combined when a request is received.</li>
3099 <li><code class="directive"><a href="#locationmatch">LocationMatch</a></code></li>
3102 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3103 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
3104 <table class="directive">
3105 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
3106 matching URLs</td></tr>
3107 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
3108 <var>regex</var>> ... </LocationMatch></code></td></tr>
3109 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3110 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3111 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3113 <p>The <code class="directive"><LocationMatch></code> directive
3114 limits the scope of the enclosed directives by URL, in an identical manner
3115 to <code class="directive"><a href="#location"><Location></a></code>. However,
3116 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
3117 as an argument instead of a simple string. For example:</p>
3119 <pre class="prettyprint lang-config"><LocationMatch "/(extra|special)/data">
3121 </LocationMatch></pre>
3124 <p>would match URLs that contained the substring <code>/extra/data</code>
3125 or <code>/special/data</code>.</p>
3127 <div class="note"><p>If the intent is that a URL <strong>starts with</strong>
3128 <code>/extra/data</code>, rather than merely
3129 <strong>contains</strong> <code>/extra/data</code>, prefix the
3130 regular expression with a <code>^</code> to require this.</p>
3132 <pre class="prettyprint lang-config"><LocationMatch "^/(extra|special)/data"></pre>
3136 <p>From 2.4.8 onwards, named groups and backreferences are captured and
3137 written to the environment with the corresponding name prefixed with
3138 "MATCH_" and in upper case. This allows elements of URLs to be referenced
3139 from within <a href="../expr.html">expressions</a> and modules like
3140 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. In order to prevent confusion, numbered
3141 (unnamed) backreferences are ignored. Use named groups instead.</p>
3143 <pre class="prettyprint lang-config"><LocationMatch "^/combined/(?<sitename>[^/]+)">
3144 require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
3145 </LocationMatch></pre>
3150 <li><a href="../sections.html">How <Directory>, <Location>
3151 and <Files> sections work</a> for an explanation of how these
3152 different sections are combined when a request is received</li>
3155 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3156 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
3157 <table class="directive">
3158 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
3159 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel [<var>module</var>:]<var>level</var>
3160 [<var>module</var>:<var>level</var>] ...
3162 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
3163 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3164 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3165 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3166 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Per-module and per-directory configuration is available in
3167 Apache HTTP Server 2.3.6 and later</td></tr>
3169 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
3170 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
3171 <var>level</var>s are available, in order of decreasing
3174 <table class="bordered">
3177 <th><strong>Level</strong> </th>
3179 <th><strong>Description</strong> </th>
3181 <th><strong>Example</strong> </th>
3185 <td><code>emerg</code> </td>
3187 <td>Emergencies - system is unusable.</td>
3189 <td>"Child cannot open lock file. Exiting"</td>
3193 <td><code>alert</code> </td>
3195 <td>Action must be taken immediately.</td>
3197 <td>"getpwuid: couldn't determine user name from uid"</td>
3201 <td><code>crit</code> </td>
3203 <td>Critical Conditions.</td>
3205 <td>"socket: Failed to get a socket, exiting child"</td>
3209 <td><code>error</code> </td>
3211 <td>Error conditions.</td>
3213 <td>"Premature end of script headers"</td>
3217 <td><code>warn</code> </td>
3219 <td>Warning conditions.</td>
3221 <td>"child process 1234 did not exit, sending another
3226 <td><code>notice</code> </td>
3228 <td>Normal but significant condition.</td>
3230 <td>"httpd: caught SIGBUS, attempting to dump core in
3235 <td><code>info</code> </td>
3237 <td>Informational.</td>
3239 <td>"Server seems busy, (you may need to increase
3240 StartServers, or Min/MaxSpareServers)..."</td>
3244 <td><code>debug</code> </td>
3246 <td>Debug-level messages</td>
3248 <td>"Opening config file ..."</td>
3251 <td><code>trace1</code> </td>
3253 <td>Trace messages</td>
3255 <td>"proxy: FTP: control connection complete"</td>
3258 <td><code>trace2</code> </td>
3260 <td>Trace messages</td>
3262 <td>"proxy: CONNECT: sending the CONNECT request to the remote proxy"</td>
3265 <td><code>trace3</code> </td>
3267 <td>Trace messages</td>
3269 <td>"openssl: Handshake: start"</td>
3272 <td><code>trace4</code> </td>
3274 <td>Trace messages</td>
3276 <td>"read from buffered SSL brigade, mode 0, 17 bytes"</td>
3279 <td><code>trace5</code> </td>
3281 <td>Trace messages</td>
3283 <td>"map lookup FAILED: map=rewritemap key=keyname"</td>
3286 <td><code>trace6</code> </td>
3288 <td>Trace messages</td>
3290 <td>"cache lookup FAILED, forcing new map lookup"</td>
3293 <td><code>trace7</code> </td>
3295 <td>Trace messages, dumping large amounts of data</td>
3297 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
3300 <td><code>trace8</code> </td>
3302 <td>Trace messages, dumping large amounts of data</td>
3304 <td>"| 0000: 02 23 44 30 13 40 ac 34 df 3d bf 9a 19 49 39 15 |"</td>
3308 <p>When a particular level is specified, messages from all
3309 other levels of higher significance will be reported as well.
3310 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
3311 then messages with log levels of <code>notice</code> and
3312 <code>warn</code> will also be posted.</p>
3314 <p>Using a level of at least <code>crit</code> is
3319 <pre class="prettyprint lang-config">LogLevel notice</pre>
3322 <div class="note"><h3>Note</h3>
3323 <p>When logging to a regular file, messages of the level
3324 <code>notice</code> cannot be suppressed and thus are always
3325 logged. However, this doesn't apply when logging is done
3326 using <code>syslog</code>.</p>
3329 <p>Specifying a level without a module name will reset the level
3330 for all modules to that level. Specifying a level with a module
3331 name will set the level for that module only. It is possible to
3332 use the module source file name, the module identifier, or the
3333 module identifier with the trailing <code>_module</code> omitted
3334 as module specification. This means the following three specifications
3337 <pre class="prettyprint lang-config">LogLevel info ssl:warn
3338 LogLevel info mod_ssl.c:warn
3339 LogLevel info ssl_module:warn</pre>
3342 <p>It is also possible to change the level per directory:</p>
3344 <pre class="prettyprint lang-config">LogLevel info
3345 <Directory "/usr/local/apache/htdocs/app">
3347 </Directory></pre>
3351 Per directory loglevel configuration only affects messages that are
3352 logged after the request has been parsed and that are associated with
3353 the request. Log messages which are associated with the server or
3354 the connection are not affected. The latter can be influenced by the
3355 <code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code> directive,
3361 <li><code class="directive"><a href="#errorlog">ErrorLog</a></code></li>
3362 <li><code class="directive"><a href="#errorlogformat">ErrorLogFormat</a></code></li>
3363 <li><code class="directive"><a href="#logleveloverride">LogLevelOverride</a></code></li>
3364 <li><a href="../logs.html">Apache HTTP Server Log Files</a></li>
3367 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3368 <div class="directive-section"><h2><a name="LogLevelOverride" id="LogLevelOverride">LogLevelOverride</a> <a name="logleveloverride" id="logleveloverride">Directive</a></h2>
3369 <table class="directive">
3370 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override the verbosity of the ErrorLog for certain clients</td></tr>
3371 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>ipaddress</var>[/<var>prefixlen</var>]
3372 [<var>module</var>:]<var>level</var> [<var>module</var>:<var>level</var>] ...
3374 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>unset</code></td></tr>
3375 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3376 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3377 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3378 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.5.0 and later</td></tr>
3380 <p><code class="directive">LogLevelOverride</code> adjusts the
3381 <code class="directive"><a href="#loglevel">LogLevel</a></code> for requests coming from
3382 certain client IP addresses.
3383 This allows to enable verbose logging only for certain test clients.
3384 The IP address is checked at a very early state in the connection
3385 processing. Therefore, <code class="directive">LogLevelOverride</code> allows to
3386 change the log level for things like the SSL handshake which happen before
3387 a <code class="directive"><a href="#loglevel">LogLevel</a></code> directive in an
3388 <code class="directive"><a href="#if"><If></a></code> container would
3391 <p><code class="directive">LogLevelOverride</code> accepts either a single
3392 IP-address or a CIDR IP-address/len subnet specification.
3393 For the syntax of the loglevel specification, see the
3394 <code class="directive"><a href="#loglevel">LogLevel</a></code> directive.</p>
3396 <p>For requests that match a <code class="directive">LogLevelOverride</code>
3397 directive, per-directory specifications of
3398 <code class="directive"><a href="#loglevel">LogLevel</a></code> are ignored.</p>
3402 <pre class="prettyprint lang-config"> LogLevelOverride 192.0.2.0/24 ssl:trace6
3403 LogLevelOverride 192.0.2.7 ssl:trace8</pre>
3407 <code class="directive">LogLevelOverride</code> only affects
3408 log messages that are associated with the request or the connection.
3409 Log messages which are associated with the server are not affected.
3415 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
3418 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3419 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
3420 <table class="directive">
3421 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
3422 connection</td></tr>
3423 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
3424 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
3425 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3426 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3427 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3429 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
3430 limits the number of requests allowed per connection when
3431 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
3432 set to <code>0</code>, unlimited requests will be allowed. We
3433 recommend that this setting be kept to a high value for maximum
3434 server performance.</p>
3438 <pre class="prettyprint lang-config">MaxKeepAliveRequests 500</pre>
3442 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3443 <div class="directive-section"><h2><a name="MaxRangeOverlaps" id="MaxRangeOverlaps">MaxRangeOverlaps</a> <a name="maxrangeoverlaps" id="maxrangeoverlaps">Directive</a></h2>
3444 <table class="directive">
3445 <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
3447 <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>
3448 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeOverlaps 20</code></td></tr>
3449 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3450 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3451 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3452 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3454 <p>The <code class="directive">MaxRangeOverlaps</code> directive
3455 limits the number of overlapping HTTP ranges the server is willing to
3456 return to the client. If more overlapping ranges than permitted are requested,
3457 the complete resource is returned instead.</p>
3460 <dt><strong>default</strong></dt>
3461 <dd>Limits the number of overlapping ranges to a compile-time default of 20.</dd>
3463 <dt><strong>none</strong></dt>
3464 <dd>No overlapping Range headers are allowed.</dd>
3466 <dt><strong>unlimited</strong></dt>
3467 <dd>The server does not limit the number of overlapping ranges it is
3468 willing to satisfy.</dd>
3470 <dt><var>number-of-ranges</var></dt>
3471 <dd>A positive number representing the maximum number of overlapping ranges the
3472 server is willing to satisfy.</dd>
3476 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3477 <div class="directive-section"><h2><a name="MaxRangeReversals" id="MaxRangeReversals">MaxRangeReversals</a> <a name="maxrangereversals" id="maxrangereversals">Directive</a></h2>
3478 <table class="directive">
3479 <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
3481 <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>
3482 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRangeReversals 20</code></td></tr>
3483 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3484 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3485 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3486 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3488 <p>The <code class="directive">MaxRangeReversals</code> directive
3489 limits the number of HTTP Range reversals the server is willing to
3490 return to the client. If more ranges reversals than permitted are requested,
3491 the complete resource is returned instead.</p>
3494 <dt><strong>default</strong></dt>
3495 <dd>Limits the number of range reversals to a compile-time default of 20.</dd>
3497 <dt><strong>none</strong></dt>
3498 <dd>No Range reversals headers are allowed.</dd>
3500 <dt><strong>unlimited</strong></dt>
3501 <dd>The server does not limit the number of range reversals it is
3502 willing to satisfy.</dd>
3504 <dt><var>number-of-ranges</var></dt>
3505 <dd>A positive number representing the maximum number of range reversals the
3506 server is willing to satisfy.</dd>
3510 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3511 <div class="directive-section"><h2><a name="MaxRanges" id="MaxRanges">MaxRanges</a> <a name="maxranges" id="maxranges">Directive</a></h2>
3512 <table class="directive">
3513 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of ranges allowed before returning the complete
3515 <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>
3516 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRanges 200</code></td></tr>
3517 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3518 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3519 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3520 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.15 and later</td></tr>
3522 <p>The <code class="directive">MaxRanges</code> directive
3523 limits the number of HTTP ranges the server is willing to
3524 return to the client. If more ranges than permitted are requested,
3525 the complete resource is returned instead.</p>
3528 <dt><strong>default</strong></dt>
3529 <dd>Limits the number of ranges to a compile-time default of 200.</dd>
3531 <dt><strong>none</strong></dt>
3532 <dd>Range headers are ignored.</dd>
3534 <dt><strong>unlimited</strong></dt>
3535 <dd>The server does not limit the number of ranges it is
3536 willing to satisfy.</dd>
3538 <dt><var>number-of-ranges</var></dt>
3539 <dd>A positive number representing the maximum number of ranges the
3540 server is willing to satisfy.</dd>
3544 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3545 <div class="directive-section"><h2><a name="MergeTrailers" id="MergeTrailers">MergeTrailers</a> <a name="mergetrailers" id="mergetrailers">Directive</a></h2>
3546 <table class="directive">
3547 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether trailers are merged into headers</td></tr>
3548 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MergeTrailers [on|off]</code></td></tr>
3549 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MergeTrailers off</code></td></tr>
3550 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3551 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3552 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3553 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.4.11 and later</td></tr>
3555 <p>This directive controls whether HTTP trailers are copied into the
3556 internal representation of HTTP headers. This merging occurs when the
3557 request body has been completely consumed, long after most header
3558 processing would have a chance to examine or modify request headers.</p>
3559 <p>This option is provided for compatibility with releases prior to 2.4.11,
3560 where trailers were always merged.</p>
3563 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3564 <div class="directive-section"><h2><a name="Mutex" id="Mutex">Mutex</a> <a name="mutex" id="mutex">Directive</a></h2>
3565 <table class="directive">
3566 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures mutex mechanism and lock file directory for all
3567 or specified mutexes</td></tr>
3568 <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>
3569 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Mutex default</code></td></tr>
3570 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3571 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3572 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3573 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.4 and later</td></tr>
3575 <p>The <code class="directive">Mutex</code> directive sets the mechanism,
3576 and optionally the lock file location, that httpd and modules use
3577 to serialize access to resources. Specify <code>default</code> as
3578 the second argument to change the settings for all mutexes; specify
3579 a mutex name (see table below) as the second argument to override
3580 defaults only for that mutex.</p>
3582 <p>The <code class="directive">Mutex</code> directive is typically used in
3583 the following exceptional situations:</p>
3586 <li>change the mutex mechanism when the default mechanism selected
3587 by <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> has a functional or performance
3590 <li>change the directory used by file-based mutexes when the
3591 default directory does not support locking</li>
3594 <div class="note"><h3>Supported modules</h3>
3595 <p>This directive only configures mutexes which have been registered
3596 with the core server using the <code>ap_mutex_register()</code> API.
3597 All modules bundled with httpd support the <code class="directive">Mutex</code>
3598 directive, but third-party modules may not. Consult the documentation
3599 of the third-party module, which must indicate the mutex name(s) which
3600 can be configured if this directive is supported.</p>
3603 <p>The following mutex <em>mechanisms</em> are available:</p>
3605 <li><code>default | yes</code>
3606 <p>This selects the default locking implementation, as determined by
3607 <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>. The default locking implementation can
3608 be displayed by running <code class="program"><a href="../programs/httpd.html">httpd</a></code> with the
3609 <code>-V</code> option.</p></li>
3611 <li><code>none | no</code>
3612 <p>This effectively disables the mutex, and is only allowed for a
3613 mutex if the module indicates that it is a valid choice. Consult the
3614 module documentation for more information.</p></li>
3616 <li><code>posixsem</code>
3617 <p>This is a mutex variant based on a Posix semaphore.</p>
3619 <div class="warning"><h3>Warning</h3>
3620 <p>The semaphore ownership is not recovered if a thread in the process
3621 holding the mutex segfaults, resulting in a hang of the web server.</p>
3625 <li><code>sysvsem</code>
3626 <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
3628 <div class="warning"><h3>Warning</h3>
3629 <p>It is possible to "leak" SysV semaphores if processes crash
3630 before the semaphore is removed.</p>
3633 <div class="warning"><h3>Security</h3>
3634 <p>The semaphore API allows for a denial of service attack by any
3635 CGIs running under the same uid as the webserver (<em>i.e.</em>,
3636 all CGIs, unless you use something like <code class="program"><a href="../programs/suexec.html">suexec</a></code>
3637 or <code>cgiwrapper</code>).</p>
3641 <li><code>sem</code>
3642 <p>This selects the "best" available semaphore implementation, choosing
3643 between Posix and SystemV IPC semaphores, in that order.</p></li>
3645 <li><code>pthread</code>
3646 <p>This is a mutex variant based on cross-process Posix thread
3649 <div class="warning"><h3>Warning</h3>
3650 <p>On most systems, if a child process terminates abnormally while
3651 holding a mutex that uses this implementation, the server will deadlock
3652 and stop responding to requests. When this occurs, the server will
3653 require a manual restart to recover.</p>
3654 <p>Solaris and Linux are notable exceptions as they provide a mechanism which
3655 usually allows the mutex to be recovered after a child process
3656 terminates abnormally while holding a mutex.</p>
3657 <p>If your system is POSIX compliant or if it implements the
3658 <code>pthread_mutexattr_setrobust_np()</code> function, you may be able
3659 to use the <code>pthread</code> option safely.</p>
3663 <li><code>fcntl:/path/to/mutex</code>
3664 <p>This is a mutex variant where a physical (lock-)file and the
3665 <code>fcntl()</code> function are used as the mutex.</p>
3667 <div class="warning"><h3>Warning</h3>
3668 <p>When multiple mutexes based on this mechanism are used within
3669 multi-threaded, multi-process environments, deadlock errors (EDEADLK)
3670 can be reported for valid mutex operations if <code>fcntl()</code>
3671 is not thread-aware, such as on Solaris.</p>
3675 <li><code>flock:/path/to/mutex</code>
3676 <p>This is similar to the <code>fcntl:/path/to/mutex</code> method
3677 with the exception that the <code>flock()</code> function is used to
3678 provide file locking.</p></li>
3680 <li><code>file:/path/to/mutex</code>
3681 <p>This selects the "best" available file locking implementation,
3682 choosing between <code>fcntl</code> and <code>flock</code>, in that
3686 <p>Most mechanisms are only available on selected platforms, where the
3687 underlying platform and <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a> support it. Mechanisms
3688 which aren't available on all platforms are <em>posixsem</em>,
3689 <em>sysvsem</em>, <em>sem</em>, <em>pthread</em>, <em>fcntl</em>,
3690 <em>flock</em>, and <em>file</em>.</p>
3692 <p>With the file-based mechanisms <em>fcntl</em> and <em>flock</em>,
3693 the path, if provided, is a directory where the lock file will be created.
3694 The default directory is httpd's run-time file directory,
3695 <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>. If a relative
3696 path is provided, it is relative to
3697 <code class="directive"><a href="#defaultruntimedir">DefaultRuntimeDir</a></code>. Always use a local
3698 disk filesystem for <code>/path/to/mutex</code> and never a directory residing
3699 on a NFS- or AFS-filesystem. The basename of the file will be the mutex
3700 type, an optional instance string provided by the module, and unless the
3701 <code>OmitPID</code> keyword is specified, the process id of the httpd
3702 parent process will be appended to make the file name unique, avoiding
3703 conflicts when multiple httpd instances share a lock file directory. For
3704 example, if the mutex name is <code>mpm-accept</code> and the lock file
3705 directory is <code>/var/httpd/locks</code>, the lock file name for the
3706 httpd instance with parent process id 12345 would be
3707 <code>/var/httpd/locks/mpm-accept.12345</code>.</p>
3709 <div class="warning"><h3>Security</h3>
3710 <p>It is best to <em>avoid</em> putting mutex files in a world-writable
3711 directory such as <code>/var/tmp</code> because someone could create
3712 a denial of service attack and prevent the server from starting by
3713 creating a lockfile with the same name as the one the server will try
3717 <p>The following table documents the names of mutexes used by httpd
3718 and bundled modules.</p>
3720 <table class="bordered"><tr class="header">
3723 <th>Protected resource</th>
3726 <td><code>mpm-accept</code></td>
3727 <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>
3728 <td>incoming connections, to avoid the thundering herd problem;
3729 for more information, refer to the
3730 <a href="../misc/perf-tuning.html">performance tuning</a>
3734 <td><code>authdigest-client</code></td>
3735 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3736 <td>client list in shared memory</td>
3739 <td><code>authdigest-opaque</code></td>
3740 <td><code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code></td>
3741 <td>counter in shared memory</td>
3744 <td><code>ldap-cache</code></td>
3745 <td><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code></td>
3746 <td>LDAP result cache</td>
3749 <td><code>rewrite-map</code></td>
3750 <td><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></td>
3751 <td>communication with external mapping programs, to avoid
3752 intermixed I/O from multiple requests</td>
3755 <td><code>ssl-cache</code></td>
3756 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3757 <td>SSL session cache</td>
3760 <td><code>ssl-stapling</code></td>
3761 <td><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></td>
3762 <td>OCSP stapling response cache</td>
3765 <td><code>watchdog-callback</code></td>
3766 <td><code class="module"><a href="../mod/mod_watchdog.html">mod_watchdog</a></code></td>
3767 <td>callback function of a particular client module</td>
3771 <p>The <code>OmitPID</code> keyword suppresses the addition of the httpd
3772 parent process id from the lock file name.</p>
3774 <p>In the following example, the mutex mechanism for the MPM accept
3775 mutex will be changed from the compiled-in default to <code>fcntl</code>,
3776 with the associated lock file created in directory
3777 <code>/var/httpd/locks</code>. The mutex mechanism for all other mutexes
3778 will be changed from the compiled-in default to <code>sysvsem</code>.</p>
3780 <pre class="prettyprint lang-config">Mutex sysvsem default
3781 Mutex fcntl:/var/httpd/locks mpm-accept</pre>
3785 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3786 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
3787 <table class="directive">
3788 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>DEPRECATED: Designates an IP address for name-virtual
3790 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
3791 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3792 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3793 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3796 <p>Prior to 2.3.11, <code class="directive">NameVirtualHost</code> was required
3797 to instruct the server that a particular IP address and port combination
3798 was usable as a name-based virtual host. In 2.3.11 and later,
3799 any time an IP address and port combination is used in multiple virtual
3800 hosts, name-based virtual hosting is automatically enabled for that address.</p>
3802 <p>This directive currently has no effect.</p>
3806 <li><a href="../vhosts/">Virtual Hosts
3807 documentation</a></li>
3810 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3811 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
3812 <table class="directive">
3813 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
3815 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
3816 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
3817 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options FollowSymlinks</code></td></tr>
3818 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3819 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
3820 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3821 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3822 <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>
3824 <p>The <code class="directive">Options</code> directive controls which
3825 server features are available in a particular directory.</p>
3827 <p><var>option</var> can be set to <code>None</code>, in which
3828 case none of the extra features are enabled, or one or more of
3832 <dt><code>All</code></dt>
3834 <dd>All options except for <code>MultiViews</code>.</dd>
3836 <dt><code>ExecCGI</code></dt>
3839 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
3842 <dt><code>FollowSymLinks</code></dt>
3845 The server will follow symbolic links in this directory. This is
3846 the default setting.
3848 <p>Even though the server follows the symlink it does <em>not</em>
3849 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
3851 <p>The <code>FollowSymLinks</code> and
3852 <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory"><Directory></a></code> sections or
3853 <code>.htaccess</code> files.</p>
3855 <p>Omitting this option should not be considered a security restriction,
3856 since symlink testing is subject to race conditions that make it
3860 <dt><code>Includes</code></dt>
3863 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
3866 <dt><code>IncludesNOEXEC</code></dt>
3870 Server-side includes are permitted, but the <code>#exec
3871 cmd</code> and <code>#exec cgi</code> are disabled. It is still
3872 possible to <code>#include virtual</code> CGI scripts from
3873 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
3876 <dt><code>Indexes</code></dt>
3879 If a URL which maps to a directory is requested and there
3880 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
3881 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
3882 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
3883 of the directory.</dd>
3885 <dt><code>MultiViews</code></dt>
3888 <a href="../content-negotiation.html">Content negotiated</a>
3889 "MultiViews" are allowed using
3890 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.
3891 <div class="note"><h3>Note</h3> <p>This option gets ignored if set
3892 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>
3893 needs real resources to compare against and evaluate from.</p></div>
3896 <dt><code>SymLinksIfOwnerMatch</code></dt>
3898 <dd>The server will only follow symbolic links for which the
3899 target file or directory is owned by the same user id as the
3902 <div class="note"><h3>Note</h3>
3903 <p>The <code>FollowSymLinks</code> and
3904 <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="#options">Options</a></code> work only in <code class="directive"><a href="#directory"><Directory></a></code> sections or
3905 <code>.htaccess</code> files.</p>
3907 <p>This option should not be considered a security restriction,
3908 since symlink testing is subject to race conditions that make it
3913 <p>Normally, if multiple <code class="directive">Options</code> could
3914 apply to a directory, then the most specific one is used and
3915 others are ignored; the options are not merged. (See <a href="../sections.html#merging">how sections are merged</a>.)
3916 However if <em>all</em> the options on the
3917 <code class="directive">Options</code> directive are preceded by a
3918 <code>+</code> or <code>-</code> symbol, the options are
3919 merged. Any options preceded by a <code>+</code> are added to the
3920 options currently in force, and any options preceded by a
3921 <code>-</code> are removed from the options currently in
3924 <div class="note"><h3>Note</h3>
3925 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
3926 <code>-</code> with those without is not valid syntax and will be
3927 rejected during server startup by the syntax check with an abort.</p>
3930 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
3932 <pre class="prettyprint lang-config"><Directory "/web/docs">
3933 Options Indexes FollowSymLinks
3936 <Directory "/web/docs/spec">
3938 </Directory></pre>
3941 <p>then only <code>Includes</code> will be set for the
3942 <code>/web/docs/spec</code> directory. However if the second
3943 <code class="directive">Options</code> directive uses the <code>+</code> and
3944 <code>-</code> symbols:</p>
3946 <pre class="prettyprint lang-config"><Directory "/web/docs">
3947 Options Indexes FollowSymLinks
3950 <Directory "/web/docs/spec">
3951 Options +Includes -Indexes
3952 </Directory></pre>
3955 <p>then the options <code>FollowSymLinks</code> and
3956 <code>Includes</code> are set for the <code>/web/docs/spec</code>
3959 <div class="note"><h3>Note</h3>
3960 <p>Using <code>-IncludesNOEXEC</code> or
3961 <code>-Includes</code> disables server-side includes completely
3962 regardless of the previous setting.</p>
3965 <p>The default in the absence of any other settings is
3966 <code>FollowSymlinks</code>.</p>
3969 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3970 <div class="directive-section"><h2><a name="Protocol" id="Protocol">Protocol</a> <a name="protocol" id="protocol">Directive</a></h2>
3971 <table class="directive">
3972 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocol for a listening socket</td></tr>
3973 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocol <var>protocol</var></code></td></tr>
3974 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3975 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3976 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3977 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>On Windows, only available from Apache 2.3.3 and later.</td></tr>
3979 <p>This directive specifies the protocol used for a specific listening socket.
3980 The protocol is used to determine which module should handle a request and
3981 to apply protocol specific optimizations with the <code class="directive">AcceptFilter</code>
3984 <p>You only need to set the protocol if you are running on non-standard ports;
3985 otherwise, <code>http</code> is assumed for port 80 and <code>https</code>
3988 <p>For example, if you are running <code>https</code> on a non-standard port,
3989 specify the protocol explicitly:</p>
3991 <pre class="prettyprint lang-config">Protocol https</pre>
3994 <p>You can also specify the protocol using the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive.</p>
3998 <li><code class="directive"><a href="#acceptfilter">AcceptFilter</a></code></li>
3999 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4002 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4003 <div class="directive-section"><h2><a name="Protocols" id="Protocols">Protocols</a> <a name="protocols" id="protocols">Directive</a></h2>
4004 <table class="directive">
4005 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Protocols available for a server/virtual host</td></tr>
4006 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Protocols <var>protocol</var> ...</code></td></tr>
4007 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Protocols http/1.1</code></td></tr>
4008 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4009 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4010 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4011 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only available from Apache 2.4.17 and later.</td></tr>
4013 <p>This directive specifies the list of protocols supported for a
4014 server/virtual host. The list determines the allowed protocols
4015 a client may negotiate for this server/host.</p>
4017 <p>You need to set protocols if you want to extend the available
4018 protocols for a server/host. By default, only the http/1.1 protocol
4019 (which includes the compatibility with 1.0 and 0.9 clients) is
4022 <p>For example, if you want to support HTTP/2 for a server with TLS,
4025 <pre class="prettyprint lang-config">Protocols h2 http/1.1</pre>
4028 <p>Valid protocols are <code>http/1.1</code> for http and https connections,
4029 <code>h2</code> on https connections and <code>h2c</code> for http
4030 connections. Modules may enable more protocols.</p>
4032 <p>It is safe to specify protocols that are unavailable/disabled. Such
4033 protocol names will simply be ignored.</p>
4035 <p>Protocols specified in base servers are inherited for virtual hosts
4036 only if the virtual host has no own Protocols directive. Or, the other
4037 way around, Protocols directives in virtual hosts replace any
4038 such directive in the base server.
4044 <li><code class="directive"><a href="#protocolshonororder">ProtocolsHonorOrder</a></code></li>
4047 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4048 <div class="directive-section"><h2><a name="ProtocolsHonorOrder" id="ProtocolsHonorOrder">ProtocolsHonorOrder</a> <a name="protocolshonororder" id="protocolshonororder">Directive</a></h2>
4049 <table class="directive">
4050 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines if order of Protocols determines precedence during negotiation</td></tr>
4051 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProtocolsHonorOrder On|Off</code></td></tr>
4052 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProtocolsHonorOrder On</code></td></tr>
4053 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</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>Only available from Apache 2.4.17 and later.</td></tr>
4058 <p>This directive specifies if the server should honor the order in which
4059 the <code class="directive">Protocols</code> directive lists protocols.</p>
4061 <p>If configured Off, the client supplied list order of protocols has
4062 precedence over the order in the server configuration.</p>
4064 <p>With <code class="directive">ProtocolsHonorOrder</code> set to <code>on</code>
4065 (default), the client ordering does not matter and only the ordering
4066 in the server settings influences the outcome of the protocol
4072 <li><code class="directive"><a href="#protocols">Protocols</a></code></li>
4075 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4076 <div class="directive-section"><h2><a name="QualifyRedirectURL" id="QualifyRedirectURL">QualifyRedirectURL</a> <a name="qualifyredirecturl" id="qualifyredirecturl">Directive</a></h2>
4077 <table class="directive">
4078 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls whether the REDIRECT_URL environment variable is
4079 fully qualified</td></tr>
4080 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>QualifyRedirectURL ON|OFF</code></td></tr>
4081 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>QualifyRedirectURL OFF</code></td></tr>
4082 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4083 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4084 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4085 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4086 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Directive supported in 2.4.18 and later. 2.4.17 acted
4087 as if 'QualifyRedirectURL ON' was configured.</td></tr>
4089 <p>This directive controls whether the server will ensure that the
4090 REDIRECT_URL environment variable is fully qualified. By default,
4091 the variable contains the verbatim URL requested by the client,
4092 such as "/index.html". With <code class="directive"><a href="#qualifyredirecturl on">QualifyRedirectURL ON</a></code>, the same request would result in a
4093 value such as "http://www.example.com/index.html".</p>
4094 <p>Even without this directive set, when a request is issued against a
4095 fully qualified URL, REDIRECT_URL will remain fully qualified.
4099 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4100 <div class="directive-section"><h2><a name="RegisterHttpMethod" id="RegisterHttpMethod">RegisterHttpMethod</a> <a name="registerhttpmethod" id="registerhttpmethod">Directive</a></h2>
4101 <table class="directive">
4102 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Register non-standard HTTP methods</td></tr>
4103 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RegisterHttpMethod <var>method</var> [<var>method</var> [...]]</code></td></tr>
4104 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4105 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4106 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4108 <p>HTTP Methods that are not conforming to the relevant RFCs are normally
4109 rejected by request processing in Apache HTTPD. To avoid this, modules
4110 can register non-standard HTTP methods they support.
4111 The <code class="directive">RegisterHttpMethod</code> allows to register such
4112 methods manually. This can be useful if such methods are forwarded
4113 for external processing, e.g. to a CGI script.</p>
4116 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4117 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
4118 <table class="directive">
4119 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
4120 by Apache httpd children</td></tr>
4121 <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>
4122 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
4123 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4124 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4125 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4126 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4128 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4129 resource limit for all processes and the second parameter sets
4130 the maximum resource limit. Either parameter can be a number,
4131 or <code>max</code> to indicate to the server that the limit should
4132 be set to the maximum allowed by the operating system
4133 configuration. Raising the maximum resource limit requires that
4134 the server is running as <code>root</code> or in the initial startup
4137 <p>This applies to processes forked from Apache httpd children
4138 servicing requests, not the Apache httpd children themselves. This
4139 includes CGI scripts and SSI exec commands, but not any
4140 processes forked from the Apache httpd parent, such as piped
4143 <p>CPU resource limits are expressed in seconds per
4148 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
4149 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
4152 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4153 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
4154 <table class="directive">
4155 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
4156 by Apache httpd children</td></tr>
4157 <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>
4158 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
4159 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4160 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4161 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4162 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4164 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4165 resource limit for all processes and the second parameter sets
4166 the maximum resource limit. Either parameter can be a number,
4167 or <code>max</code> to indicate to the server that the limit should
4168 be set to the maximum allowed by the operating system
4169 configuration. Raising the maximum resource limit requires that
4170 the server is running as <code>root</code> or in the initial startup
4173 <p>This applies to processes forked from Apache httpd children
4174 servicing requests, not the Apache httpd children themselves. This
4175 includes CGI scripts and SSI exec commands, but not any
4176 processes forked from the Apache httpd parent, such as piped
4179 <p>Memory resource limits are expressed in bytes per
4184 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
4185 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
4188 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4189 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
4190 <table class="directive">
4191 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
4192 processes launched by Apache httpd children</td></tr>
4193 <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>
4194 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
4195 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4196 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4197 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4198 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4200 <p>Takes 1 or 2 parameters. The first parameter sets the soft
4201 resource limit for all processes, and the second parameter sets
4202 the maximum resource limit. Either parameter can be a number,
4203 or <code>max</code> to indicate to the server that the limit
4204 should be set to the maximum allowed by the operating system
4205 configuration. Raising the maximum resource limit requires that
4206 the server is running as <code>root</code> or in the initial startup
4209 <p>This applies to processes forked from Apache httpd children
4210 servicing requests, not the Apache httpd children themselves. This
4211 includes CGI scripts and SSI exec commands, but not any
4212 processes forked from the Apache httpd parent, such as piped
4215 <p>Process limits control the number of processes per user.</p>
4217 <div class="note"><h3>Note</h3>
4218 <p>If CGI processes are <strong>not</strong> running
4219 under user ids other than the web server user id, this directive
4220 will limit the number of processes that the server itself can
4221 create. Evidence of this situation will be indicated by
4222 <strong><code>cannot fork</code></strong> messages in the
4223 <code>error_log</code>.</p>
4228 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
4229 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
4232 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4233 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
4234 <table class="directive">
4235 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
4237 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
4238 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
4239 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4240 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4241 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4242 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4243 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only.</td></tr>
4245 <p>This directive is used to control how Apache httpd finds the
4246 interpreter used to run CGI scripts. The default setting is
4247 <code>Script</code>. This causes Apache httpd to use the interpreter pointed to
4248 by the shebang line (first line, starting with <code>#!</code>) in the
4249 script. On Win32 systems this line usually looks like:</p>
4251 <pre class="prettyprint lang-perl">#!C:/Perl/bin/perl.exe</pre>
4254 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
4256 <pre class="prettyprint lang-perl">#!perl</pre>
4259 <p>Setting <code>ScriptInterpreterSource Registry</code> will
4260 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
4261 searched using the script file extension (e.g., <code>.pl</code>) as a
4262 search key. The command defined by the registry subkey
4263 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
4264 <code>Shell\Open\Command</code> is used to open the script file. If the
4265 registry keys cannot be found, Apache httpd falls back to the behavior of the
4266 <code>Script</code> option.</p>
4268 <div class="warning"><h3>Security</h3>
4269 <p>Be careful when using <code>ScriptInterpreterSource
4270 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
4271 Apache httpd will try to execute <strong>every</strong> file within this
4272 directory. The <code>Registry</code> setting may cause undesired
4273 program calls on files which are typically not executed. For
4274 example, the default open command on <code>.htm</code> files on
4275 most Windows systems will execute Microsoft Internet Explorer, so
4276 any HTTP request for an <code>.htm</code> file existing within the
4277 script directory would start the browser in the background on the
4278 server. This is a good way to crash your system within a minute or
4282 <p>The option <code>Registry-Strict</code> which is new in Apache HTTP Server
4283 2.0 does the same thing as <code>Registry</code> but uses only the
4284 subkey <code>Shell\ExecCGI\Command</code>. The
4285 <code>ExecCGI</code> key is not a common one. It must be
4286 configured manually in the windows registry and hence prevents
4287 accidental program calls on your system.</p>
4290 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4291 <div class="directive-section"><h2><a name="SeeRequestTail" id="SeeRequestTail">SeeRequestTail</a> <a name="seerequesttail" id="seerequesttail">Directive</a></h2>
4292 <table class="directive">
4293 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine if mod_status displays the first 63 characters
4294 of a request or the last 63, assuming the request itself is greater than
4296 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SeeRequestTail On|Off</code></td></tr>
4297 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SeeRequestTail Off</code></td></tr>
4298 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4299 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4300 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4302 <p>mod_status with <code>ExtendedStatus On</code>
4303 displays the actual request being handled.
4304 For historical purposes, only 63 characters of the request
4305 are actually stored for display purposes. This directive
4306 controls whether the 1st 63 characters are stored (the previous
4307 behavior and the default) or if the last 63 characters are. This
4308 is only applicable, of course, if the length of the request is
4309 64 characters or greater.</p>
4311 <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:
4314 <table class="bordered">
4316 <th>Off (default)</th>
4317 <td>GET /disk1/storage/apache/htdocs/images/imagestore1/food/apples</td>
4321 <td>orage/apache/htdocs/images/imagestore1/food/apples.jpg HTTP/1.1</td>
4327 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4328 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
4329 <table class="directive">
4330 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
4331 messages sent to the client</td></tr>
4332 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
4333 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4334 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4335 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4337 <p>The <code class="directive">ServerAdmin</code> sets the contact address
4338 that the server includes in any error messages it returns to the
4339 client. If the <code>httpd</code> doesn't recognize the supplied argument
4341 assumes, that it's an <var>email-address</var> and prepends it with
4342 <code>mailto:</code> in hyperlink targets. However, it's recommended to
4343 actually use an email address, since there are a lot of CGI scripts that
4344 make that assumption. If you want to use an URL, it should point to another
4345 server under your control. Otherwise users may not be able to contact you in
4348 <p>It may be worth setting up a dedicated address for this, e.g.</p>
4350 <pre class="prettyprint lang-config">ServerAdmin www-admin@foo.example.com</pre>
4352 <p>as users do not always mention that they are talking about the
4356 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4357 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
4358 <table class="directive">
4359 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
4360 to name-virtual hosts</td></tr>
4361 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
4362 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
4363 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4364 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4366 <p>The <code class="directive">ServerAlias</code> directive sets the
4367 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
4368 <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
4370 <pre class="prettyprint lang-config"><VirtualHost *:80>
4371 ServerName server.example.com
4372 ServerAlias server server2.example.com server2
4373 ServerAlias *.example.com
4374 UseCanonicalName Off
4376 </VirtualHost></pre>
4379 <p>Name-based virtual hosts for the best-matching set of <code class="directive"><a href="#virtualhost"><virtualhost></a></code>s are processed
4380 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
4381 (nor for ServerName vs. ServerAlias). </p>
4383 <p>The complete list of names in the <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
4384 directive are treated just like a (non wildcard)
4385 <code class="directive">ServerAlias</code>.</p>
4390 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4391 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4394 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4395 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
4396 <table class="directive">
4397 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
4399 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerName [<var>scheme</var>://]<var>domain-name</var>|<var>ip-address</var>[:<var>port</var>]</code></td></tr>
4400 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4401 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4402 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4404 <p>The <code class="directive">ServerName</code> directive sets the
4405 request scheme, hostname and port that the server uses to identify itself.
4408 <p><code class="directive">ServerName</code> is used (possibly
4409 in conjunction with <code class="directive"><a href="#serveralias">ServerAlias</a></code>) to uniquely
4410 identify a virtual host, when using <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
4412 <p>Additionally, this is used when
4413 creating self-referential redirection URLs when
4414 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> is set to a non-default
4417 <p>For example, if the name of the
4418 machine hosting the web server is <code>simple.example.com</code>,
4419 but the machine also has the DNS alias <code>www.example.com</code>
4420 and you wish the web server to be so identified, the following
4421 directive should be used:</p>
4423 <pre class="prettyprint lang-config">ServerName www.example.com</pre>
4426 <p>The <code class="directive">ServerName</code> directive
4427 may appear anywhere within the definition of a server. However,
4428 each appearance overrides the previous appearance (within that
4431 <p>If no <code class="directive">ServerName</code> is specified, the
4432 server attempts to deduce the client visible hostname by first asking
4433 the operating system for the system hostname, and if that fails,
4434 performing a reverse lookup on an IP address present on the system.</p>
4436 <p>If no port is specified in the
4437 <code class="directive">ServerName</code>, then the server will use the
4438 port from the incoming request. For optimal reliability and
4439 predictability, you should specify an explicit hostname and port
4440 using the <code class="directive">ServerName</code> directive.</p>
4442 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
4443 the <code class="directive">ServerName</code> inside a
4444 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
4445 section specifies what hostname must appear in the request's
4446 <code>Host:</code> header to match this virtual host.</p>
4448 <p>Sometimes, the server runs behind a device that processes SSL,
4449 such as a reverse proxy, load balancer or SSL offload
4450 appliance. When this is the case, specify the
4451 <code>https://</code> scheme and the port number to which the
4452 clients connect in the <code class="directive">ServerName</code> directive
4453 to make sure that the server generates the correct
4454 self-referential URLs.
4457 <p>See the description of the
4458 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
4459 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
4460 settings which determine whether self-referential URLs (e.g., by the
4461 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
4462 specified port, or to the port number given in the client's request.
4465 <div class="warning">
4466 <p>Failure to set <code class="directive">ServerName</code> to a name that
4467 your server can resolve to an IP address will result in a startup
4468 warning. <code>httpd</code> will then use whatever hostname it can
4469 determine, using the system's <code>hostname</code> command. This
4470 will almost never be the hostname you actually want.</p>
4471 <div class="example"><p><code>
4472 httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName
4479 <li><a href="../dns-caveats.html">Issues Regarding DNS and
4480 Apache HTTP Server</a></li>
4481 <li><a href="../vhosts/">Apache HTTP Server virtual host
4482 documentation</a></li>
4483 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4484 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4485 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
4488 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4489 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
4490 <table class="directive">
4491 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
4492 is accessed by an incompatible browser</td></tr>
4493 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
4494 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
4495 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4496 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4498 <p>The <code class="directive">ServerPath</code> directive sets the legacy
4499 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
4503 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
4506 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4507 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
4508 <table class="directive">
4509 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
4510 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
4511 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
4512 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4513 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4514 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4516 <p>The <code class="directive">ServerRoot</code> directive sets the
4517 directory in which the server lives. Typically it will contain the
4518 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
4519 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
4520 relative to this directory.</p>
4522 <pre class="prettyprint lang-config">ServerRoot "/home/httpd"</pre>
4525 <p>The default location of <code class="directive">ServerRoot</code> may be
4526 modified by using the <code>--prefix</code> argument to
4527 <a href="../programs/configure.html"><code>configure</code></a>, and
4528 most third-party distributions of the server have a different
4529 default location from the one listed above.</p>
4534 <li><a href="../invoking.html">the <code>-d</code>
4535 option to <code>httpd</code></a></li>
4536 <li><a href="../misc/security_tips.html#serverroot">the
4537 security tips</a> for information on how to properly set
4538 permissions on the <code class="directive">ServerRoot</code></li>
4541 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4542 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
4543 <table class="directive">
4544 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
4545 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
4546 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
4547 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4548 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
4549 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4550 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4552 <p>The <code class="directive">ServerSignature</code> directive allows the
4553 configuration of a trailing footer line under server-generated
4554 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
4555 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
4556 would want to enable such a footer line is that in a chain of proxies,
4557 the user often has no possibility to tell which of the chained servers
4558 actually produced a returned error message.</p>
4560 <p>The <code>Off</code>
4561 setting, which is the default, suppresses the footer line (and is
4562 therefore compatible with the behavior of Apache-1.2 and
4563 below). The <code>On</code> setting simply adds a line with the
4564 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
4565 and the <code>EMail</code> setting additionally creates a
4566 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
4569 <p>After version 2.0.44, the details of the server version number
4570 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
4574 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
4577 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4578 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
4579 <table class="directive">
4580 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
4582 <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>
4583 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
4584 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4585 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4586 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4588 <p>This directive controls whether <code>Server</code> response
4589 header field which is sent back to clients includes a
4590 description of the generic OS-type of the server as well as
4591 information about compiled-in modules.</p>
4594 <dt><code>ServerTokens Full</code> (or not specified)</dt>
4596 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4597 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
4599 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
4601 <dd>Server sends (<em>e.g.</em>): <code>Server:
4604 <dt><code>ServerTokens Major</code></dt>
4606 <dd>Server sends (<em>e.g.</em>): <code>Server:
4607 Apache/2</code></dd>
4609 <dt><code>ServerTokens Minor</code></dt>
4611 <dd>Server sends (<em>e.g.</em>): <code>Server:
4612 Apache/2.4</code></dd>
4614 <dt><code>ServerTokens Min[imal]</code></dt>
4616 <dd>Server sends (<em>e.g.</em>): <code>Server:
4617 Apache/2.4.2</code></dd>
4619 <dt><code>ServerTokens OS</code></dt>
4621 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.4.2
4626 <p>This setting applies to the entire server, and cannot be
4627 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
4629 <p>After version 2.0.44, this directive also controls the
4630 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
4632 <div class="note">Setting <code class="directive">ServerTokens</code> to less than
4633 <code>minimal</code> is not recommended because it makes it more
4634 difficult to debug interoperational problems. Also note that
4635 disabling the Server: header does nothing at all to make your
4636 server more secure. The idea of "security through obscurity"
4637 is a myth and leads to a false sense of safety.</div>
4641 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
4644 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4645 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
4646 <table class="directive">
4647 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
4649 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|none|<var>expression</var></code></td></tr>
4650 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4651 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4652 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4653 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4654 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5 and later</td></tr>
4656 <p>When placed into an <code>.htaccess</code> file or a
4657 <code class="directive"><a href="#directory"><Directory></a></code> or
4658 <code class="directive"><a href="#location"><Location></a></code>
4659 section, this directive forces all matching files to be parsed
4660 through the <a href="../handler.html">handler</a> given by
4661 <var>handler-name</var>. For example, if you had a directory you
4662 wanted to be parsed entirely as imagemap rule files, regardless
4663 of extension, you might put the following into an
4664 <code>.htaccess</code> file in that directory:</p>
4666 <pre class="prettyprint lang-config">SetHandler imap-file</pre>
4669 <p>Another example: if you wanted to have the server display a
4670 status report whenever a URL of
4671 <code>http://servername/status</code> was called, you might put
4672 the following into <code>httpd.conf</code>:</p>
4674 <pre class="prettyprint lang-config"><Location "/status">
4675 SetHandler server-status
4676 </Location></pre>
4679 <p>You could also use this directive to configure a particular
4680 handler for files with a particular file extension. For example:</p>
4682 <pre class="prettyprint lang-config"><FilesMatch "\.php$">
4683 SetHandler application/x-httpd-php
4684 </FilesMatch></pre>
4687 <p>String-valued expressions can be used to reference per-request
4688 variables, including backreferences to named regular expressions:</p>
4690 <pre class="prettyprint lang-config"><LocationMatch ^/app/(?<sub>[^/]+)/>
4691 SetHandler "proxy:unix:/var/run/app_%{env:MATCH_sub}.sock|fcgi://localhost:8080"
4692 </LocationMatch></pre>
4695 <p>You can override an earlier defined <code class="directive">SetHandler</code>
4696 directive by using the value <code>None</code>.</p>
4698 <div class="note"><h3>Note</h3>
4699 <p>Because <code class="directive">SetHandler</code> overrides default handlers,
4700 normal behavior such as handling of URLs ending in a slash (/) as
4701 directories or index files is suppressed.</p></div>
4705 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
4708 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4709 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
4710 <table class="directive">
4711 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
4713 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4714 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4715 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4716 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4717 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4719 <p>The <code class="directive">SetInputFilter</code> directive sets the
4720 filter or filters which will process client requests and POST
4721 input when they are received by the server. This is in addition to
4722 any filters defined elsewhere, including the
4723 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
4726 <p>If more than one filter is specified, they must be separated
4727 by semicolons in the order in which they should process the
4732 <li><a href="../filter.html">Filters</a> documentation</li>
4735 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4736 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
4737 <table class="directive">
4738 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
4740 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
4741 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4742 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
4743 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4744 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4746 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
4747 which will process responses from the server before they are
4748 sent to the client. This is in addition to any filters defined
4749 elsewhere, including the
4750 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
4753 <p>For example, the following configuration will process all files
4754 in the <code>/www/data/</code> directory for server-side
4757 <pre class="prettyprint lang-config"><Directory "/www/data/">
4758 SetOutputFilter INCLUDES
4759 </Directory></pre>
4762 <p>If more than one filter is specified, they must be separated
4763 by semicolons in the order in which they should process the
4768 <li><a href="../filter.html">Filters</a> documentation</li>
4771 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4772 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
4773 <table class="directive">
4774 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
4775 certain events before failing a request</td></tr>
4776 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
4777 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 60</code></td></tr>
4778 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4779 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4780 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4782 <p>The <code class="directive">TimeOut</code> directive defines the length
4783 of time Apache httpd will wait for I/O in various circumstances:</p>
4786 <li><p>When reading data from the client, the length of time to
4787 wait for a TCP packet to arrive if the read buffer is
4789 <p> For initial data on a new connection, this directive doesn't
4790 take effect until after any configured <code class="directive"><a href="#acceptfilter">
4791 AcceptFilter</a></code> has passed the new connection to the server.</p>
4794 <li>When writing data to the client, the length of time to wait
4795 for an acknowledgement of a packet if the send buffer is
4798 <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code> and <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code>,
4799 the length of time to wait for any individual block of output
4800 from a CGI script.</li>
4802 <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
4803 wait for output from a filtering process.</li>
4805 <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
4806 <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
4812 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4813 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
4814 <table class="directive">
4815 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behavior on <code>TRACE</code> requests</td></tr>
4816 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
4817 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
4818 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4819 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4820 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4822 <p>This directive overrides the behavior of <code>TRACE</code> for both
4823 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
4824 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
4825 RFC 2616, which disallows any request body to accompany the request.
4826 <code>TraceEnable off</code> causes the core server and
4827 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
4828 allowed) error to the client.</p>
4830 <p>Finally, for testing and diagnostic purposes only, request
4831 bodies may be allowed using the non-compliant <code>TraceEnable
4832 extended</code> directive. The core (as an origin server) will
4833 restrict the request body to 64Kb (plus 8Kb for chunk headers if
4834 <code>Transfer-Encoding: chunked</code> is used). The core will
4835 reflect the full headers and all chunk headers with the response
4836 body. As a proxy server, the request body is not restricted to 64Kb.</p>
4838 <div class="note"><h3>Note</h3>
4840 <p>Despite claims to the contrary, enabling the <code>TRACE</code>
4841 method does not expose any security vulnerability in Apache httpd.
4842 The <code>TRACE</code> method is defined by the HTTP/1.1
4843 specification and implementations are expected to support it.</p>
4848 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4849 <div class="directive-section"><h2><a name="UnDefine" id="UnDefine">UnDefine</a> <a name="undefine" id="undefine">Directive</a></h2>
4850 <table class="directive">
4851 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine the existence of a variable</td></tr>
4852 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UnDefine <var>parameter-name</var></code></td></tr>
4853 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
4854 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4855 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4857 <p>Undoes the effect of a <code class="directive"><a href="#define">Define</a></code> or
4858 of passing a <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
4859 <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
4860 <code>-D</code> arguments in any startup scripts.</p>
4861 <p>While this directive is supported in virtual host context,
4862 the changes it makes are visible to any later configuration
4863 directives, beyond any enclosing virtual host.</p>
4867 <li><code class="directive"><a href="#define">Define</a></code></li>
4868 <li><code class="directive"><a href="#ifdefine">IfDefine</a></code></li>
4871 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4872 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
4873 <table class="directive">
4874 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
4876 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
4877 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
4878 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4879 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4880 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4882 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4883 URL -- that is, a URL that refers back to the same server. With
4884 <code>UseCanonicalName On</code> Apache httpd will use the hostname and port
4885 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
4886 directive to construct the canonical name for the server. This name
4887 is used in all self-referential URLs, and for the values of
4888 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
4890 <p>With <code>UseCanonicalName Off</code> Apache httpd will form
4891 self-referential URLs using the hostname and port supplied by
4892 the client if any are supplied (otherwise it will use the
4893 canonical name, as defined above). These values are the same
4894 that are used to implement <a href="../vhosts/name-based.html">name-based virtual hosts</a>
4895 and are available with the same clients. The CGI variables
4896 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
4897 constructed from the client supplied values as well.</p>
4899 <p>An example where this may be useful is on an intranet server
4900 where you have users connecting to the machine using short
4901 names such as <code>www</code>. You'll notice that if the users
4902 type a shortname and a URL which is a directory, such as
4903 <code>http://www/splat</code>, <em>without the trailing
4904 slash</em>, then Apache httpd will redirect them to
4905 <code>http://www.example.com/splat/</code>. If you have
4906 authentication enabled, this will cause the user to have to
4907 authenticate twice (once for <code>www</code> and once again
4908 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">
4909 the FAQ on this subject for more information</a>). But if
4910 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
4911 Apache httpd will redirect to <code>http://www/splat/</code>.</p>
4913 <p>There is a third option, <code>UseCanonicalName DNS</code>,
4914 which is intended for use with mass IP-based virtual hosting to
4915 support ancient clients that do not provide a
4916 <code>Host:</code> header. With this option, Apache httpd does a
4917 reverse DNS lookup on the server IP address that the client
4918 connected to in order to work out self-referential URLs.</p>
4920 <div class="warning"><h3>Warning</h3>
4921 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>,
4922 they may be broken by this option. The client is essentially free
4923 to give whatever value they want as a hostname. But if the CGI is
4924 only using <code>SERVER_NAME</code> to construct self-referential URLs,
4925 then it should be just fine.</p>
4930 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
4931 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4932 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4935 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4936 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
4937 <table class="directive">
4938 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own port</td></tr>
4939 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
4940 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
4941 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
4942 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
4943 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
4945 <p>In many situations Apache httpd must construct a <em>self-referential</em>
4946 URL -- that is, a URL that refers back to the same server. With
4947 <code>UseCanonicalPhysicalPort On</code>, Apache httpd will, when
4948 constructing the canonical port for the server to honor
4949 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
4950 provide the actual physical port number being used by this request
4951 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>,
4952 Apache httpd will not ever use the actual physical port number, instead
4953 relying on all configured information to construct a valid port number.</p>
4955 <div class="note"><h3>Note</h3>
4956 <p>The ordering of the lookup when the physical port is used is as
4959 <dt><code>UseCanonicalName On</code></dt>
4962 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4963 <li>Physical port</li>
4964 <li>Default port</li>
4967 <dt><code>UseCanonicalName Off | DNS</code></dt>
4970 <li>Parsed port from <code>Host:</code> header</li>
4971 <li>Physical port</li>
4972 <li>Port provided in <code class="directive"><a href="#servername">Servername</a></code></li>
4973 <li>Default port</li>
4978 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
4979 physical ports are removed from the ordering.</p>
4985 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
4986 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
4987 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
4990 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
4991 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
4992 <table class="directive">
4993 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
4994 hostname or IP address</td></tr>
4995 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
4996 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
4997 ...> ... </VirtualHost></code></td></tr>
4998 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
4999 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
5000 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
5002 <p><code class="directive"><VirtualHost></code> and
5003 <code></VirtualHost></code> are used to enclose a group of
5004 directives that will apply only to a particular virtual host. Any
5005 directive that is allowed in a virtual host context may be
5006 used. When the server receives a request for a document on a
5007 particular virtual host, it uses the configuration directives
5008 enclosed in the <code class="directive"><VirtualHost></code>
5009 section. <var>Addr</var> can be any of the following, optionally followed by
5010 a colon and a port number (or *):</p>
5013 <li>The IP address of the virtual host;</li>
5015 <li>A fully qualified domain name for the IP address of the
5016 virtual host (not recommended);</li>
5018 <li>The character <code>*</code>, which acts as a wildcard and matches
5019 any IP address.</li>
5021 <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
5025 <pre class="prettyprint lang-config"><VirtualHost 10.1.2.3:80>
5026 ServerAdmin webmaster@host.example.com
5027 DocumentRoot "/www/docs/host.example.com"
5028 ServerName host.example.com
5029 ErrorLog "logs/host.example.com-error_log"
5030 TransferLog "logs/host.example.com-access_log"
5031 </VirtualHost></pre>
5035 <p>IPv6 addresses must be specified in square brackets because
5036 the optional port number could not be determined otherwise. An
5037 IPv6 example is shown below:</p>
5039 <pre class="prettyprint lang-config"><VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
5040 ServerAdmin webmaster@host.example.com
5041 DocumentRoot "/www/docs/host.example.com"
5042 ServerName host.example.com
5043 ErrorLog "logs/host.example.com-error_log"
5044 TransferLog "logs/host.example.com-access_log"
5045 </VirtualHost></pre>
5048 <p>Each Virtual Host must correspond to a different IP address,
5049 different port number, or a different host name for the server,
5050 in the former case the server machine must be configured to
5051 accept IP packets for multiple addresses. (If the machine does
5052 not have multiple network interfaces, then this can be
5053 accomplished with the <code>ifconfig alias</code> command -- if
5054 your OS supports it).</p>
5056 <div class="note"><h3>Note</h3>
5057 <p>The use of <code class="directive"><VirtualHost></code> does
5058 <strong>not</strong> affect what addresses Apache httpd listens on. You
5059 may need to ensure that Apache httpd is listening on the correct addresses
5060 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
5063 <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
5064 specified inside each <code class="directive"><VirtualHost></code> block. If it is absent, the
5065 <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
5066 server configuration will be inherited.</p>
5068 <p>When a request is received, the server first maps it to the best matching
5069 <code class="directive"><VirtualHost></code> based on the local
5070 IP address and port combination only. Non-wildcards have a higher
5071 precedence. If no match based on IP and port occurs at all, the
5072 "main" server configuration is used.</p>
5074 <p>If multiple virtual hosts contain the best matching IP address and port,
5075 the server selects from these virtual hosts the best match based on the
5076 requested hostname. If no matching name-based virtual host is found,
5077 then the first listed virtual host that matched the IP address will be
5078 used. As a consequence, the first listed virtual host for a given IP address
5079 and port combination is the default virtual host for that IP and port
5082 <div class="warning"><h3>Security</h3>
5083 <p>See the <a href="../misc/security_tips.html">security tips</a>
5084 document for details on why your security could be compromised if the
5085 directory where log files are stored is writable by anyone other
5086 than the user that starts the server.</p>
5091 <li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
5092 <li><a href="../dns-caveats.html">Issues Regarding DNS and
5093 Apache HTTP Server</a></li>
5094 <li><a href="../bind.html">Setting
5095 which addresses and ports Apache HTTP Server uses</a></li>
5096 <li><a href="../sections.html">How <Directory>, <Location>
5097 and <Files> sections work</a> for an explanation of how these
5098 different sections are combined when a request is received</li>
5101 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
5102 <div class="directive-section"><h2><a name="Warning" id="Warning">Warning</a> <a name="warning" id="warning">Directive</a></h2>
5103 <table class="directive">
5104 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Warn from configuration parsing with a custom message</td></tr>
5105 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Warning <var>message</var></code></td></tr>
5106 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
5107 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
5108 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
5109 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5 and later</td></tr>
5111 <p>If an issue can be detected from within the configuration, this
5112 directive can be used to generate a custom warning message. The
5113 configuration parsing is not halted. The typical use is to check
5114 whether some user define options are set, and warn if not.</p>
5116 <pre class="prettyprint lang-config"># Example
5117 # tell when ReverseProxy is not set
5118 <IfDefine !ReverseProxy>
5119 Warning "reverse proxy is not started, hope this is okay!"
5122 <IfDefine ReverseProxy>
5123 # define custom proxy configuration
5124 </IfDefine></pre>
5130 <div class="bottomlang">
5131 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
5132 <a href="../en/mod/core.html" title="English"> en </a> |
5133 <a href="../es/mod/core.html" hreflang="es" rel="alternate" title="Español"> es </a> |
5134 <a href="../fr/mod/core.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
5135 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
5136 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
5137 </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>
5138 <script type="text/javascript"><!--//--><![CDATA[//><!--
5139 var comments_shortname = 'httpd';
5140 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/core.html';
5142 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
5143 d.write('<div id="comments_thread"><\/div>');
5144 var s = d.createElement('script');
5145 s.type = 'text/javascript';
5147 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
5148 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
5151 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
5153 })(window, document);
5154 //--><!]]></script></div><div id="footer">
5155 <p class="apache">Copyright 2017 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>
5156 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.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[//><!--
5157 if (typeof(prettyPrint) !== 'undefined') {