1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>core - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Core Features</h1>
24 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
25 <a href="../en/mod/core.html" title="English"> en </a> |
26 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
27 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
31 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
33 <div id="quickview"><h3 class="directives">Directives</h3>
35 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
36 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
37 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilterbytype">AddOutputFilterByType</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#define">Define</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#directory"><Directory></a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#if"><If></a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
100 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
101 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
102 <table class="directive">
103 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
104 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
105 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
106 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
107 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
108 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1.5 and later</td></tr>
110 <p>This directive enables operating system specific optimizations for a
111 listening socket by the Protocol type. The basic premise is for the
112 kernel to not send a socket to the server process until either data
113 is received or an entire HTTP Request is buffered. Only
114 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
115 FreeBSD's Accept Filters</a> and Linux's more primitive
116 <code>TCP_DEFER_ACCEPT</code> are currently supported.</p>
118 <p>The default values on FreeBSD are:</p>
119 <div class="example"><p><code>
120 AcceptFilter http httpready <br />
121 AcceptFilter https dataready
124 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
125 the kernel level. Once an entire request is received, the kernel then
126 sends it to the server. See the
127 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
128 accf_http(9)</a> man page for more details. Since HTTPS requests are
129 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
130 accf_data(9)</a> filter is used.</p>
132 <p>The default values on Linux are:</p>
133 <div class="example"><p><code>
134 AcceptFilter http data <br />
135 AcceptFilter https data
138 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
139 requests. Any value besides <code>none</code> will enable
140 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
142 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
143 tcp(7)</a> man page.</p>
145 <p>Using <code>none</code> for an argument will disable any accept filters
146 for that protocol. This is useful for protocols that require a server
147 send data first, such as <code>nntp</code>:</p>
148 <div class="example"><p><code>AcceptFilter nntp none</code></p></div>
152 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
153 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
154 <table class="directive">
155 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
156 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
157 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
158 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
159 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
160 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
161 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
162 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.30 and later</td></tr>
165 <p>This directive controls whether requests that contain trailing
166 pathname information that follows an actual filename (or
167 non-existent file in an existing directory) will be accepted or
168 rejected. The trailing pathname information can be made
169 available to scripts in the <code>PATH_INFO</code> environment
172 <p>For example, assume the location <code>/test/</code> points to
173 a directory that contains only the single file
174 <code>here.html</code>. Then requests for
175 <code>/test/here.html/more</code> and
176 <code>/test/nothere.html/more</code> both collect
177 <code>/more</code> as <code>PATH_INFO</code>.</p>
179 <p>The three possible arguments for the
180 <code class="directive">AcceptPathInfo</code> directive are:</p>
182 <dt><code>Off</code></dt><dd>A request will only be accepted if it
183 maps to a literal path that exists. Therefore a request with
184 trailing pathname information after the true filename such as
185 <code>/test/here.html/more</code> in the above example will return
186 a 404 NOT FOUND error.</dd>
188 <dt><code>On</code></dt><dd>A request will be accepted if a
189 leading path component maps to a file that exists. The above
190 example <code>/test/here.html/more</code> will be accepted if
191 <code>/test/here.html</code> maps to a valid file.</dd>
193 <dt><code>Default</code></dt><dd>The treatment of requests with
194 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
195 The core handler for normal files defaults to rejecting
196 <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
197 <code>PATH_INFO</code> by default.</dd>
200 <p>The primary purpose of the <code>AcceptPathInfo</code>
201 directive is to allow you to override the handler's choice of
202 accepting or rejecting <code>PATH_INFO</code>. This override is required,
203 for example, when you use a <a href="../filter.html">filter</a>, such
204 as <a href="mod_include.html">INCLUDES</a>, to generate content
205 based on <code>PATH_INFO</code>. The core handler would usually reject
206 the request, so you can use the following configuration to enable
209 <div class="example"><p><code>
210 <Files "mypaths.shtml"><br />
211 <span class="indent">
212 Options +Includes<br />
213 SetOutputFilter INCLUDES<br />
214 AcceptPathInfo On<br />
221 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
222 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
223 <table class="directive">
224 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
225 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
226 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
227 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
228 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
229 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
231 <p>While processing a request the server looks for
232 the first existing configuration file from this list of names in
233 every directory of the path to the document, if distributed
234 configuration files are <a href="#allowoverride">enabled for that
235 directory</a>. For example:</p>
237 <div class="example"><p><code>
241 <p>before returning the document
242 <code>/usr/local/web/index.html</code>, the server will read
243 <code>/.acl</code>, <code>/usr/.acl</code>,
244 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
245 for directives, unless they have been disabled with</p>
247 <div class="example"><p><code>
248 <Directory /><br />
249 <span class="indent">
250 AllowOverride None<br />
257 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
258 <li><a href="../configuring.html">Configuration Files</a></li>
259 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
262 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
263 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
264 <table class="directive">
265 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
266 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
267 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
268 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
269 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
270 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
271 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
272 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
274 <p>This directive specifies a default value for the media type
275 charset parameter (the name of a character encoding) to be added
276 to a response if and only if the response's content-type is either
277 <code>text/plain</code> or <code>text/html</code>. This should override
278 any charset specified in the body of the response via a <code>META</code>
279 element, though the exact behavior is often dependent on the user's client
280 configuration. A setting of <code>AddDefaultCharset Off</code>
281 disables this functionality. <code>AddDefaultCharset On</code> enables
282 a default charset of <code>iso-8859-1</code>. Any other value is assumed
283 to be the <var>charset</var> to be used, which should be one of the
284 <a href="http://www.iana.org/assignments/character-sets">IANA registered
285 charset values</a> for use in Internet media types (MIME types).
288 <div class="example"><p><code>
289 AddDefaultCharset utf-8
292 <p><code class="directive">AddDefaultCharset</code> should only be used when all
293 of the text resources to which it applies are known to be in that
294 character encoding and it is too inconvenient to label their charset
295 individually. One such example is to add the charset parameter
296 to resources containing generated content, such as legacy CGI
297 scripts, that might be vulnerable to cross-site scripting attacks
298 due to user-provided data being included in the output. Note, however,
299 that a better solution is to just fix (or delete) those scripts, since
300 setting a default charset does not protect users that have enabled
301 the "auto-detect character encoding" feature on their browser.</p>
305 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
308 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
309 <div class="directive-section"><h2><a name="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2>
310 <table class="directive">
311 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular media-type</td></tr>
312 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
313 <var>media-type</var> [<var>media-type</var>] ...</code></td></tr>
314 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
315 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
316 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
317 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
318 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.33 and later; deprecated in Apache 2.1 and later</td></tr>
320 <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the
321 response <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a>. Because of certain
322 problems discussed below, this directive is deprecated. The same
323 functionality is available using <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>.</p>
325 <p>The following example uses the <code>DEFLATE</code> filter, which
326 is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all
327 output (either static or dynamic) which is labeled as
328 <code>text/html</code> or <code>text/plain</code> before it is sent
331 <div class="example"><p><code>
332 AddOutputFilterByType DEFLATE text/html text/plain
335 <p>If you want the content to be processed by more than one filter, their
336 names have to be separated by semicolons. It's also possible to use one
337 <code class="directive">AddOutputFilterByType</code> directive for each of
340 <p>The configuration below causes all script output labeled as
341 <code>text/html</code> to be processed at first by the
342 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
345 <div class="example"><p><code>
346 <Location /cgi-bin/><br />
347 <span class="indent">
348 Options Includes<br />
349 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
354 <div class="warning"><h3>Note</h3>
355 <p>Enabling filters with <code class="directive">AddOutputFilterByType</code>
356 may fail partially or completely in some cases. For example, no
357 filters are applied if the <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a> could not
358 be determined. If you want to make sure that the filters will be
359 applied, assign the content type to a resource explicitly; for
360 example, with <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> or
361 <code class="directive"><a href="#forcetype">ForceType</a></code>. Setting the
362 content type within a (non-nph) CGI script is also safe.</p>
368 <li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li>
369 <li><code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code></li>
370 <li><a href="../filter.html">filters</a></li>
373 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
374 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
375 <table class="directive">
376 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
377 be passed through</td></tr>
378 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off</code></td></tr>
379 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
380 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
381 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
382 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
383 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.46 and later</td></tr>
385 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
386 which contain encoded path separators (<code>%2F</code> for <code>/</code>
387 and additionally <code>%5C</code> for <code>\</code> on according systems)
388 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
390 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
391 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
393 <div class="note"><h3>Note</h3>
394 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
395 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
396 according systems) will be left as such in the otherwise decoded URL
402 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
405 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
406 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
407 <table class="directive">
408 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
409 <code>.htaccess</code> files</td></tr>
410 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
411 [<var>directive-type</var>] ...</code></td></tr>
412 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride All</code></td></tr>
413 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
414 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
415 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
417 <p>When the server finds an <code>.htaccess</code> file (as
418 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
419 it needs to know which directives declared in that file can override
420 earlier configuration directives.</p>
422 <div class="note"><h3>Only available in <Directory> sections</h3>
423 <code class="directive">AllowOverride</code> is valid only in
424 <code class="directive"><a href="#directory"><Directory></a></code>
425 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
426 <code class="directive"><a href="#files"><Files></a></code> sections.
429 <p>When this directive is set to <code>None</code>, then
430 <a href="#accessfilename">.htaccess</a> files are completely ignored.
431 In this case, the server will not even attempt to read
432 <code>.htaccess</code> files in the filesystem.</p>
434 <p>When this directive is set to <code>All</code>, then any
435 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
436 <code>.htaccess</code> files.</p>
438 <p>The <var>directive-type</var> can be one of the following
439 groupings of directives.</p>
446 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
447 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
448 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
449 <code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code>,
450 <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>
455 Allow use of the directives controlling document types
456 (<code class="directive"><a href="#errordocument">ErrorDocument</a></code>,
457 <code class="directive"><a href="#forcetype">ForceType</a></code>,
458 <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
459 <code class="directive"><a href="#sethandler">SetHandler</a></code>,
460 <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>,
461 <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
462 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove* directives),
463 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>),
464 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> directives <code class="directive"><a href="../mod/mod_rewrite.html#rewriteengine">RewriteEngine</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriteoptions">RewriteOptions</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>, <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>) and
465 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
466 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
472 Allow use of the directives controlling directory indexing
473 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
474 <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>,
475 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
476 <code class="directive"><a href="../mod/mod_autoindex.html#defaulticon">DefaultIcon</a></code>, <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#fancyindexing">FancyIndexing</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#headername">HeaderName</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexignore">IndexIgnore</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#indexoptions">IndexOptions</a></code>, <code class="directive"><a href="../mod/mod_autoindex.html#readmename">ReadmeName</a></code>,
482 Allow use of the directives controlling host access (<code class="directive"><a href="../mod/mod_authz_host.html#allow">Allow</a></code>, <code class="directive"><a href="../mod/mod_authz_host.html#deny">Deny</a></code> and <code class="directive"><a href="../mod/mod_authz_host.html#order">Order</a></code>).</dd>
484 <dt>Options[=<var>Option</var>,...]</dt>
487 Allow use of the directives controlling specific directory
488 features (<code class="directive"><a href="#options">Options</a></code> and
489 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
490 An equal sign may be given followed by a comma (but no spaces)
491 separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.</dd>
496 <div class="example"><p><code>
497 AllowOverride AuthConfig Indexes
500 <p>In the example above all directives that are neither in the group
501 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
504 <div class="note"><p>For security and performance reasons, do not set
505 <code>AllowOverride</code> to anything other than <code>None</code>
506 in your <code><Directory /></code> block. Instead, find (or
507 create) the <code><Directory></code> block that refers to the
508 directory where you're actually planning to place a
509 <code>.htaccess</code> file.</p>
514 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
515 <li><a href="../configuring.html">Configuration Files</a></li>
516 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
519 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
520 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
521 <table class="directive">
522 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
524 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
525 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
526 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
527 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
528 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
529 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
531 <p>This directive is used to control how Apache finds the
532 interpreter used to run CGI scripts. For example, setting
533 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
534 cause all CGI script files with a <code>.foo</code> extension to
535 be passed to the FOO interpreter.</p>
538 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
539 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
540 <table class="directive">
541 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
543 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
544 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
545 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
546 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
547 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
548 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
550 <p>This directive enables the generation of
551 <code>Content-MD5</code> headers as defined in RFC1864
552 respectively RFC2616.</p>
554 <p>MD5 is an algorithm for computing a "message digest"
555 (sometimes called "fingerprint") of arbitrary-length data, with
556 a high degree of confidence that any alterations in the data
557 will be reflected in alterations in the message digest.</p>
559 <p>The <code>Content-MD5</code> header provides an end-to-end
560 message integrity check (MIC) of the entity-body. A proxy or
561 client may check this header for detecting accidental
562 modification of the entity-body in transit. Example header:</p>
564 <div class="example"><p><code>
565 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
568 <p>Note that this can cause performance problems on your server
569 since the message digest is computed on every request (the
570 values are not cached).</p>
572 <p><code>Content-MD5</code> is only sent for documents served
573 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
574 SSI documents, output from CGI scripts, and byte range responses
575 do not have this header.</p>
578 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
579 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
580 <table class="directive">
581 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>This directive has no effect other than to emit warnings
582 if the value is not <code>none</code>. In prior versions, DefaultType
583 would specify a default media type to assign to response content for
584 which no other media type configuration could be found.
586 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>media-type|none</var></code></td></tr>
587 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType none</code></td></tr>
588 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
589 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
590 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
591 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
592 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The argument <code>none</code> is available in Apache 2.2.7 and later. All other choices are DISABLED for 2.3.x and later.</td></tr>
594 <p>This directive has been disabled. For backwards compatibility
595 of configuration files, it may be specified with the value
596 <code>none</code>, meaning no default media type. For example:</p>
598 <div class="example"><p><code>
602 <p><code>DefaultType None</code> is only available in
603 httpd-2.2.7 and later.</p>
605 <p>Use the mime.types configuration file and the
606 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> to configure media
607 type assignments via file extensions, or the
608 <code class="directive"><a href="#forcetype">ForceType</a></code> directive to configure
609 the media type for specific resources. Otherwise, the server will
610 send the response without a Content-Type header field and the
611 recipient may attempt to guess the media type.</p>
614 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
615 <div class="directive-section"><h2><a name="Define" id="Define">Define</a> <a name="define" id="define">Directive</a></h2>
616 <table class="directive">
617 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define the existence of a variable</td></tr>
618 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Define <var>parameter-name</var></code></td></tr>
619 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
620 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
621 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
623 <p>Equivalent to passing the <code>-D</code> argument to <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</p>
624 <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
625 <code>-D</code> arguments in any startup scripts.</p>
628 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
629 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
630 <table class="directive">
631 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
632 named file-system directory and sub-directories</td></tr>
633 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
634 ... </Directory></code></td></tr>
635 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
636 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
637 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
639 <p><code class="directive"><Directory></code> and
640 <code></Directory></code> are used to enclose a group of
641 directives that will apply only to the named directory and
642 sub-directories of that directory. Any directive that is allowed
643 in a directory context may be used. <var>Directory-path</var> is
644 either the full path to a directory, or a wild-card string using
645 Unix shell-style matching. In a wild-card string, <code>?</code> matches
646 any single character, and <code>*</code> matches any sequences of
647 characters. You may also use <code>[]</code> character ranges. None
648 of the wildcards match a `/' character, so <code><Directory
649 /*/public_html></code> will not match
650 <code>/home/user/public_html</code>, but <code><Directory
651 /home/*/public_html></code> will match. Example:</p>
653 <div class="example"><p><code>
654 <Directory /usr/local/httpd/htdocs><br />
655 <span class="indent">
656 Options Indexes FollowSymLinks<br />
662 <p>Be careful with the <var>directory-path</var> arguments:
663 They have to literally match the filesystem path which Apache uses
664 to access the files. Directives applied to a particular
665 <code><Directory></code> will not apply to files accessed from
666 that same directory via a different path, such as via different symbolic
670 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
671 expressions</a> can also be used, with the addition of the
672 <code>~</code> character. For example:</p>
674 <div class="example"><p><code>
675 <Directory ~ "^/www/.*/[0-9]{3}">
678 <p>would match directories in <code>/www/</code> that consisted of
681 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
682 match the directory (or one of its parents) containing a document,
683 then the directives are applied in the order of shortest match
684 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
687 <div class="example"><p><code>
688 <Directory /><br />
689 <span class="indent">
690 AllowOverride None<br />
692 </Directory><br />
694 <Directory /home/><br />
695 <span class="indent">
696 AllowOverride FileInfo<br />
701 <p>for access to the document <code>/home/web/dir/doc.html</code>
705 <li>Apply directive <code>AllowOverride None</code>
706 (disabling <code>.htaccess</code> files).</li>
708 <li>Apply directive <code>AllowOverride FileInfo</code> (for
709 directory <code>/home</code>).</li>
711 <li>Apply any <code>FileInfo</code> directives in
712 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
713 <code>/home/web/dir/.htaccess</code> in that order.</li>
716 <p>Regular expressions are not considered until after all of the
717 normal sections have been applied. Then all of the regular
718 expressions are tested in the order they appeared in the
719 configuration file. For example, with</p>
721 <div class="example"><p><code>
722 <Directory ~ abc$><br />
723 <span class="indent">
724 # ... directives here ...<br />
729 <p>the regular expression section won't be considered until after
730 all normal <code class="directive"><Directory></code>s and
731 <code>.htaccess</code> files have been applied. Then the regular
732 expression will match on <code>/home/abc/public_html/abc</code> and
733 the corresponding <code class="directive"><Directory></code> will
736 <p><strong>Note that the default Apache access for
737 <code><Directory /></code> is <code>Allow from All</code>.
738 This means that Apache will serve any file mapped from an URL. It is
739 recommended that you change this with a block such
742 <div class="example"><p><code>
743 <Directory /><br />
744 <span class="indent">
745 Order Deny,Allow<br />
751 <p><strong>and then override this for directories you
752 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
753 details.</strong></p>
755 <p>The directory sections occur in the <code>httpd.conf</code> file.
756 <code class="directive"><Directory></code> directives
757 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>
761 <li><a href="../sections.html">How <Directory>,
762 <Location> and <Files> sections work</a> for an
763 explanation of how these different sections are combined when a
764 request is received</li>
767 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
768 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
769 <table class="directive">
770 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
771 file-system directories matching a regular expression and their
772 subdirectories</td></tr>
773 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
774 ... </DirectoryMatch></code></td></tr>
775 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
776 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
777 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
779 <p><code class="directive"><DirectoryMatch></code> and
780 <code></DirectoryMatch></code> are used to enclose a group
781 of directives which will apply only to the named directory and
782 sub-directories of that directory, the same as <code class="directive"><a href="#directory"><Directory></a></code>. However, it
783 takes as an argument a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
784 expression</a>. For example:</p>
786 <div class="example"><p><code>
787 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
790 <p>would match directories in <code>/www/</code> that consisted of three
795 <li><code class="directive"><a href="#directory"><Directory></a></code> for
796 a description of how regular expressions are mixed in with normal
797 <code class="directive"><Directory></code>s</li>
798 <li><a href="../sections.html">How <Directory>, <Location> and
799 <Files> sections work</a> for an explanation of how these different
800 sections are combined when a request is received</li>
803 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
804 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
805 <table class="directive">
806 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
807 from the web</td></tr>
808 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
809 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
810 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
811 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
812 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
814 <p>This directive sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
815 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
816 path from the requested URL to the document root to make the
817 path to the document. Example:</p>
819 <div class="example"><p><code>
820 DocumentRoot /usr/web
824 <code>http://www.my.host.com/index.html</code> refers to
825 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
826 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
828 <p>The <code class="directive">DocumentRoot</code> should be specified without
829 a trailing slash.</p>
833 <li><a href="../urlmapping.html#documentroot">Mapping URLs to Filesystem
837 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
838 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
839 <table class="directive">
840 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
841 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
842 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
843 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
844 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
845 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
846 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
848 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
849 memory-mapping if it needs to read the contents of a file during
850 delivery. By default, when the handling of a request requires
851 access to the data within a file -- for example, when delivering a
852 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache
853 memory-maps the file if the OS supports it.</p>
855 <p>This memory-mapping sometimes yields a performance improvement.
856 But in some environments, it is better to disable the memory-mapping
857 to prevent operational problems:</p>
860 <li>On some multiprocessor systems, memory-mapping can reduce the
861 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
862 <li>With an NFS-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code>,
863 the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may crash due to a segmentation fault if a file
864 is deleted or truncated while the <code class="program"><a href="../programs/httpd.html">httpd</a></code> has it
868 <p>For server configurations that are vulnerable to these problems,
869 you should disable memory-mapping of delivered files by specifying:</p>
871 <div class="example"><p><code>
875 <p>For NFS mounted files, this feature may be disabled explicitly for
876 the offending files by specifying:</p>
878 <div class="example"><p><code>
879 <Directory "/path-to-nfs-files">
880 <span class="indent">
887 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
888 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
889 <table class="directive">
890 <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>
891 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
892 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile On</code></td></tr>
893 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
894 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
895 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
896 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
897 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later</td></tr>
899 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
900 sendfile support from the kernel to transmit file contents to the client.
901 By default, when the handling of a request requires no access
902 to the data within a file -- for example, when delivering a
903 static file -- Apache uses sendfile to deliver the file contents
904 without ever reading the file if the OS supports it.</p>
906 <p>This sendfile mechanism avoids separate read and send operations,
907 and buffer allocations. But on some platforms or within some
908 filesystems, it is better to disable this feature to avoid
909 operational problems:</p>
912 <li>Some platforms may have broken sendfile support that the build
913 system did not detect, especially if the binaries were built on
914 another box and moved to such a machine with broken sendfile
916 <li>On Linux the use of sendfile triggers TCP-checksum
917 offloading bugs on certain networking cards when using IPv6.</li>
918 <li>On Linux on Itanium, sendfile may be unable to handle files
919 over 2GB in size.</li>
920 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS or SMB),
921 the kernel may be unable to serve the network file through
925 <p>For server configurations that are vulnerable to these problems,
926 you should disable this feature by specifying:</p>
928 <div class="example"><p><code>
932 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
933 for the offending files by specifying:</p>
935 <div class="example"><p><code>
936 <Directory "/path-to-nfs-files">
937 <span class="indent">
942 <p>Please note that the per-directory and .htaccess configuration
943 of <code class="directive">EnableSendfile</code> is not supported by
944 <code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code>.
945 Only global definition of <code class="directive">EnableSendfile</code>
946 is taken into account by the module.
950 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
951 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
952 <table class="directive">
953 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
954 in case of an error</td></tr>
955 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
956 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
957 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
958 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
959 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
960 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Quoting syntax for text messages is different in Apache
963 <p>In the event of a problem or error, Apache can be configured
964 to do one of four things,</p>
967 <li>output a simple hardcoded error message</li>
969 <li>output a customized message</li>
971 <li>redirect to a local <var>URL-path</var> to handle the
974 <li>redirect to an external <var>URL</var> to handle the
978 <p>The first option is the default, while options 2-4 are
979 configured using the <code class="directive">ErrorDocument</code>
980 directive, which is followed by the HTTP response code and a URL
981 or a message. Apache will sometimes offer additional information
982 regarding the problem/error.</p>
984 <p>URLs can begin with a slash (/) for local web-paths (relative
985 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
986 full URL which the client can resolve. Alternatively, a message
987 can be provided to be displayed by the browser. Examples:</p>
989 <div class="example"><p><code>
990 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
991 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
992 ErrorDocument 401 /subscription_info.html<br />
993 ErrorDocument 403 "Sorry can't allow you access today"
996 <p>Additionally, the special value <code>default</code> can be used
997 to specify Apache's simple hardcoded message. While not required
998 under normal circumstances, <code>default</code> will restore
999 Apache's simple hardcoded message for configurations that would
1000 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1002 <div class="example"><p><code>
1003 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
1004 <Directory /web/docs><br />
1005 <span class="indent">
1006 ErrorDocument 404 default<br />
1011 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1012 that points to a remote URL (ie. anything with a method such as
1013 <code>http</code> in front of it), Apache will send a redirect to the
1014 client to tell it where to find the document, even if the
1015 document ends up being on the same server. This has several
1016 implications, the most important being that the client will not
1017 receive the original error status code, but instead will
1018 receive a redirect status code. This in turn can confuse web
1019 robots and other clients which try to determine if a URL is
1020 valid using the status code. In addition, if you use a remote
1021 URL in an <code>ErrorDocument 401</code>, the client will not
1022 know to prompt the user for a password since it will not
1023 receive the 401 status code. Therefore, <strong>if you use an
1024 <code>ErrorDocument 401</code> directive then it must refer to a local
1025 document.</strong></p>
1027 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1028 server-generated error messages when they are "too small" and substitute
1029 its own "friendly" error messages. The size threshold varies depending on
1030 the type of error, but in general, if you make your error document
1031 greater than 512 bytes, then MSIE will show the server-generated
1032 error rather than masking it. More information is available in
1033 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1035 <p>Although most error messages can be overriden, there are certain
1036 circumstances where the internal messages are used regardless of the
1037 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1038 particular, if a malformed request is detected, normal request processing
1039 will be immediately halted and the internal error message returned.
1040 This is necessary to guard against security problems caused by
1043 <p>Prior to version 2.0, messages were indicated by prefixing
1044 them with a single unmatched double quote character.</p>
1048 <li><a href="../custom-error.html">documentation of
1049 customizable responses</a></li>
1052 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1053 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1054 <table class="directive">
1055 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1056 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> ErrorLog <var>file-path</var>|syslog[:<var>facility</var>]</code></td></tr>
1057 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows)</code></td></tr>
1058 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1059 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1060 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1062 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1063 the file to which the server will log any errors it encounters. If
1064 the <var>file-path</var> is not absolute then it is assumed to be
1065 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1067 <div class="example"><h3>Example</h3><p><code>
1068 ErrorLog /var/log/httpd/error_log
1071 <p>If the <var>file-path</var>
1072 begins with a pipe (|) then it is assumed to be a command to spawn
1073 to handle the error log.</p>
1075 <div class="example"><h3>Example</h3><p><code>
1076 ErrorLog "|/usr/local/bin/httpd_errors"
1079 <p>Using <code>syslog</code> instead of a filename enables logging
1080 via syslogd(8) if the system supports it. The default is to use
1081 syslog facility <code>local7</code>, but you can override this by
1082 using the <code>syslog:<var>facility</var></code> syntax where
1083 <var>facility</var> can be one of the names usually documented in
1086 <div class="example"><h3>Example</h3><p><code>
1087 ErrorLog syslog:user
1090 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1091 document for details on why your security could be compromised
1092 if the directory where log files are stored is writable by
1093 anyone other than the user that starts the server.</p>
1094 <div class="warning"><h3>Note</h3>
1095 <p>When entering a file path on non-Unix platforms, care should be taken
1096 to make sure that only forward slashed are used even though the platform
1097 may allow the use of back slashes. In general it is a good idea to always
1098 use forward slashes throughout the configuration files.</p>
1103 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1104 <li><a href="../logs.html">Apache Log Files</a></li>
1107 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1108 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1109 <table class="directive">
1110 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1111 HTTP response header</td></tr>
1112 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1113 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag INode MTime Size</code></td></tr>
1114 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1115 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1116 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1117 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1120 The <code class="directive">FileETag</code> directive configures the file
1121 attributes that are used to create the <code>ETag</code> (entity
1122 tag) response header field when the document is based on a file.
1123 (The <code>ETag</code> value is used in cache management to save
1124 network bandwidth.) In Apache 1.3.22 and earlier, the
1125 <code>ETag</code> value was <em>always</em> formed
1126 from the file's inode, size, and last-modified time (mtime). The
1127 <code class="directive">FileETag</code> directive allows you to choose
1128 which of these -- if any -- should be used. The recognized keywords are:
1132 <dt><strong>INode</strong></dt>
1133 <dd>The file's i-node number will be included in the calculation</dd>
1134 <dt><strong>MTime</strong></dt>
1135 <dd>The date and time the file was last modified will be included</dd>
1136 <dt><strong>Size</strong></dt>
1137 <dd>The number of bytes in the file will be included</dd>
1138 <dt><strong>All</strong></dt>
1139 <dd>All available fields will be used. This is equivalent to:
1140 <div class="example"><p><code>FileETag INode MTime Size</code></p></div></dd>
1141 <dt><strong>None</strong></dt>
1142 <dd>If a document is file-based, no <code>ETag</code> field will be
1143 included in the response</dd>
1146 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1147 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1148 which allow changes to be made to the default setting inherited
1149 from a broader scope. Any keyword appearing without such a prefix
1150 immediately and completely cancels the inherited setting.</p>
1152 <p>If a directory's configuration includes
1153 <code>FileETag INode MTime Size</code>, and a
1154 subdirectory's includes <code>FileETag -INode</code>,
1155 the setting for that subdirectory (which will be inherited by
1156 any sub-subdirectories that don't override it) will be equivalent to
1157 <code>FileETag MTime Size</code>.</p>
1158 <div class="warning"><h3>Warning</h3>
1159 Do not change the default for directories or locations that have WebDAV
1160 enabled and use <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> as a storage provider.
1161 <code class="module"><a href="../mod/mod_dav_fs.html">mod_dav_fs</a></code> uses <code>INode MTime Size</code>
1162 as a fixed format for <code>ETag</code> comparisons on conditional requests.
1163 These conditional requests will break if the <code>ETag</code> format is
1164 changed via <code class="directive">FileETag</code>.
1168 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1169 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1170 <table class="directive">
1171 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1173 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1174 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1175 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1176 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1177 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1179 <p>The <code class="directive"><Files></code> directive
1180 limits the scope of the enclosed directives by filename. It is comparable
1181 to the <code class="directive"><a href="#directory"><Directory></a></code>
1182 and <code class="directive"><a href="#location"><Location></a></code>
1183 directives. It should be matched with a <code></Files></code>
1184 directive. The directives given within this section will be applied to
1185 any object with a basename (last component of filename) matching the
1186 specified filename. <code class="directive"><Files></code>
1187 sections are processed in the order they appear in the
1188 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1189 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1190 that <code class="directive"><Files></code> can be nested
1191 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1192 portion of the filesystem they apply to.</p>
1194 <p>The <var>filename</var> argument should include a filename, or
1195 a wild-card string, where <code>?</code> matches any single character,
1196 and <code>*</code> matches any sequences of characters.
1197 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1198 can also be used, with the addition of the
1199 <code>~</code> character. For example:</p>
1201 <div class="example"><p><code>
1202 <Files ~ "\.(gif|jpe?g|png)$">
1205 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1208 <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
1209 <code>.htaccess</code> files. This allows users to control access to
1210 their own files, at a file-by-file level.</p>
1215 <li><a href="../sections.html">How <Directory>, <Location>
1216 and <Files> sections work</a> for an explanation of how these
1217 different sections are combined when a request is received</li>
1220 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1221 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1222 <table class="directive">
1223 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1225 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1226 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1227 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1228 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1229 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1231 <p>The <code class="directive"><FilesMatch></code> directive
1232 limits the scope of the enclosed directives by filename, just as the
1233 <code class="directive"><a href="#files"><Files></a></code> directive
1234 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1235 expression</a>. For example:</p>
1237 <div class="example"><p><code>
1238 <FilesMatch "\.(gif|jpe?g|png)$">
1241 <p>would match most common Internet graphics formats.</p>
1245 <li><a href="../sections.html">How <Directory>, <Location>
1246 and <Files> sections work</a> for an explanation of how these
1247 different sections are combined when a request is received</li>
1250 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1251 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1252 <table class="directive">
1253 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1254 media type in the HTTP Content-Type header field</td></tr>
1255 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>media-type</var>|None</code></td></tr>
1256 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1257 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1258 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1259 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1260 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache 2.0</td></tr>
1262 <p>When placed into an <code>.htaccess</code> file or a
1263 <code class="directive"><a href="#directory"><Directory></a></code>, or
1264 <code class="directive"><a href="#location"><Location></a></code> or
1265 <code class="directive"><a href="#files"><Files></a></code>
1266 section, this directive forces all matching files to be served
1267 with the content type identification given by
1268 <var>media-type</var>. For example, if you had a directory full of
1269 GIF files, but did not want to label them all with <code>.gif</code>,
1270 you might want to use:</p>
1272 <div class="example"><p><code>
1276 <p>Note that this directive overrides other indirect media type
1277 associations defined in mime.types or via the
1278 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>.</p>
1280 <p>You can also override more general
1281 <code class="directive">ForceType</code> settings
1282 by using the value of <code>None</code>:</p>
1284 <div class="example"><p><code>
1285 # force all files to be image/gif:<br />
1286 <Location /images><br />
1287 <span class="indent">
1288 ForceType image/gif<br />
1290 </Location><br />
1292 # but normal mime-type associations here:<br />
1293 <Location /images/mixed><br />
1294 <span class="indent">
1295 ForceType None<br />
1301 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1302 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1303 <table class="directive">
1304 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1305 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1306 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1307 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1308 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1309 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1311 <p>This directive enables DNS lookups so that host names can be
1312 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1313 The value <code>Double</code> refers to doing double-reverse
1314 DNS lookup. That is, after a reverse lookup is performed, a forward
1315 lookup is then performed on that result. At least one of the IP
1316 addresses in the forward lookup must match the original
1317 address. (In "tcpwrappers" terminology this is called
1318 <code>PARANOID</code>.)</p>
1320 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1321 used for controlling access by hostname, a double reverse lookup
1322 will be performed. This is necessary for security. Note that the
1323 result of this double-reverse isn't generally available unless you
1324 set <code>HostnameLookups Double</code>. For example, if only
1325 <code>HostnameLookups On</code> and a request is made to an object
1326 that is protected by hostname restrictions, regardless of whether
1327 the double-reverse fails or not, CGIs will still be passed the
1328 single-reverse result in <code>REMOTE_HOST</code>.</p>
1330 <p>The default is <code>Off</code> in order to save the network
1331 traffic for those sites that don't truly need the reverse
1332 lookups done. It is also better for the end users because they
1333 don't have to suffer the extra latency that a lookup entails.
1334 Heavily loaded sites should leave this directive
1335 <code>Off</code>, since DNS lookups can take considerable
1336 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1337 default to the <code>bin</code> subdirectory of your installation
1338 directory, can be used to look up host names from logged IP addresses
1342 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1343 <div class="directive-section"><h2><a name="If" id="If"><If></a> <a name="if" id="if">Directive</a></h2>
1344 <table class="directive">
1345 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only if a condition is
1346 satisfied by a request at runtime</td></tr>
1347 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><If <var>expression</var>> ... </If></code></td></tr>
1348 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1349 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1350 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1351 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1353 <p>The <code class="directive"><If></code> directive
1354 evaluates an expression at runtime, and applies the enclosed
1355 directives if and only if the expression evaluates to true.
1358 <div class="example"><p><code>
1359 <If "$req{Host} = ''">
1362 <p>would match HTTP/1.0 requests without a <var>Host:</var> header.</p>
1366 <li><a href="../sections.html">How <Directory>, <Location>,
1367 <Files> sections work</a> for an explanation of how these
1368 different sections are combined when a request is received.
1369 <code class="directive"><If></code> has the same precedence
1370 and usage as <code class="directive"><Files></code></li>
1373 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1374 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1375 <table class="directive">
1376 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1377 if a test is true at startup</td></tr>
1378 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
1379 </IfDefine></code></td></tr>
1380 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1381 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1382 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1383 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1385 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1386 </code> section is used to mark directives that are conditional. The
1387 directives within an <code class="directive"><IfDefine></code>
1388 section are only processed if the <var>test</var> is true. If <var>
1389 test</var> is false, everything between the start and end markers is
1392 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
1395 <li><var>parameter-name</var></li>
1397 <li><code>!</code><var>parameter-name</var></li>
1400 <p>In the former case, the directives between the start and end
1401 markers are only processed if the parameter named
1402 <var>parameter-name</var> is defined. The second format reverses
1403 the test, and only processes the directives if
1404 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1406 <p>The <var>parameter-name</var> argument is a define as given on the
1407 <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter</var>
1408 </code> at the time the server was started or by the <code class="directive"><a href="#define">Define</a></code> directive.</p>
1410 <p><code class="directive"><IfDefine></code> sections are
1411 nest-able, which can be used to implement simple
1412 multiple-parameter tests. Example:</p>
1414 <div class="example"><p><code>
1415 httpd -DReverseProxy -DUseCache -DMemCache ...<br />
1418 <IfDefine ReverseProxy><br />
1419 <span class="indent">
1420 LoadModule proxy_module modules/mod_proxy.so<br />
1421 LoadModule proxy_http_module modules/mod_proxy_http.so<br />
1422 <IfDefine UseCache><br />
1423 <span class="indent">
1424 LoadModule cache_module modules/mod_cache.so<br />
1425 <IfDefine MemCache><br />
1426 <span class="indent">
1427 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
1429 </IfDefine><br />
1430 <IfDefine !MemCache><br />
1431 <span class="indent">
1432 LoadModule disk_cache_module modules/mod_disk_cache.so<br />
1442 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1443 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
1444 <table class="directive">
1445 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
1446 presence or absence of a specific module</td></tr>
1447 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1448 </IfModule></code></td></tr>
1449 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1450 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1451 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1452 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1453 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Module identifiers are available in version 2.1 and
1456 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1457 section is used to mark directives that are conditional on the presence of
1458 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
1459 is true. If <var>test</var> is false, everything between the start and
1460 end markers is ignored.</p>
1462 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
1465 <li><var>module</var></li>
1467 <li>!<var>module</var></li>
1470 <p>In the former case, the directives between the start and end
1471 markers are only processed if the module named <var>module</var>
1472 is included in Apache -- either compiled in or
1473 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
1474 and only processes the directives if <var>module</var> is
1475 <strong>not</strong> included.</p>
1477 <p>The <var>module</var> argument can be either the module identifier or
1478 the file name of the module, at the time it was compiled. For example,
1479 <code>rewrite_module</code> is the identifier and
1480 <code>mod_rewrite.c</code> is the file name. If a module consists of
1481 several source files, use the name of the file containing the string
1482 <code>STANDARD20_MODULE_STUFF</code>.</p>
1484 <p><code class="directive"><IfModule></code> sections are
1485 nest-able, which can be used to implement simple multiple-module
1488 <div class="note">This section should only be used if you need to have one
1489 configuration file that works whether or not a specific module
1490 is available. In normal operation, directives need not be
1491 placed in <code class="directive"><IfModule></code>
1495 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1496 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
1497 <table class="directive">
1498 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
1499 the server configuration files</td></tr>
1500 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Include <var>file-path</var>|<var>directory-path</var></code></td></tr>
1501 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1502 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1503 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1504 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later</td></tr>
1506 <p>This directive allows inclusion of other configuration files
1507 from within the server configuration files.</p>
1509 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1510 include several files at once, in alphabetical order. In
1511 addition, if <code class="directive">Include</code> points to a directory,
1512 rather than a file, Apache will read all files in that directory
1513 and any subdirectory. However, including entire directories is not
1514 recommended, because it is easy to accidentally leave temporary
1515 files in a directory that can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1516 fail. Instead, we encourage you to use the wildcard syntax shown
1517 below, to include files that match a particular pattern, such as
1518 *.conf, for example.</p>
1520 <p>The file path specified may be an absolute path, or may be relative
1521 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
1525 <div class="example"><p><code>
1526 Include /usr/local/apache2/conf/ssl.conf<br />
1527 Include /usr/local/apache2/conf/vhosts/*.conf
1530 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
1532 <div class="example"><p><code>
1533 Include conf/ssl.conf<br />
1534 Include conf/vhosts/*.conf
1539 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
1542 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1543 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
1544 <table class="directive">
1545 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
1546 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
1547 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
1548 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1549 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1550 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1552 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1553 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1554 which allow multiple requests to be sent over the same TCP
1555 connection. In some cases this has been shown to result in an
1556 almost 50% speedup in latency times for HTML documents with
1557 many images. To enable Keep-Alive connections, set
1558 <code>KeepAlive On</code>.</p>
1560 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1561 used if they are specifically requested by a client. In
1562 addition, a Keep-Alive connection with an HTTP/1.0 client can
1563 only be used when the length of the content is known in
1564 advance. This implies that dynamic content such as CGI output,
1565 SSI pages, and server-generated directory listings will
1566 generally not use Keep-Alive connections to HTTP/1.0 clients.
1567 For HTTP/1.1 clients, persistent connections are the default
1568 unless otherwise specified. If the client requests it, chunked
1569 encoding will be used in order to send content of unknown
1570 length over persistent connections.</p>
1572 <p>When a client uses a Keep-Alive connection it will be counted
1573 as a single "request" for the <code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code> directive, regardless
1574 of how many requests are sent using the connection.</p>
1578 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
1581 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1582 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
1583 <table class="directive">
1584 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
1585 requests on a persistent connection</td></tr>
1586 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>num</var>[ms]</code></td></tr>
1587 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
1588 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1589 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1590 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1591 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Specifying a value in milliseconds is available in
1592 Apache 2.3.2 and later</td></tr>
1594 <p>The number of seconds Apache will wait for a subsequent
1595 request before closing the connection. By adding a postfix of ms the
1596 timeout can be also set in milliseconds. Once a request has been
1597 received, the timeout value specified by the
1598 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
1600 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
1601 may cause performance problems in heavily loaded servers. The
1602 higher the timeout, the more server processes will be kept
1603 occupied waiting on connections with idle clients.</p>
1605 <p>In a name-based virtual host context, the value of the first
1606 defined virtual host (the default host) in a set of <code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code> will be used.
1607 The other values will be ignored.</p>
1610 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1611 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
1612 <table class="directive">
1613 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
1615 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
1616 </Limit></code></td></tr>
1617 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1618 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
1619 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1620 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1622 <p>Access controls are normally effective for
1623 <strong>all</strong> access methods, and this is the usual
1624 desired behavior. <strong>In the general case, access control
1625 directives should not be placed within a
1626 <code class="directive"><Limit></code> section.</strong></p>
1628 <p>The purpose of the <code class="directive"><Limit></code>
1629 directive is to restrict the effect of the access controls to the
1630 nominated HTTP methods. For all other methods, the access
1631 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
1632 effect</strong>. The following example applies the access control
1633 only to the methods <code>POST</code>, <code>PUT</code>, and
1634 <code>DELETE</code>, leaving all other methods unprotected:</p>
1636 <div class="example"><p><code>
1637 <Limit POST PUT DELETE><br />
1638 <span class="indent">
1639 Require valid-user<br />
1644 <p>The method names listed can be one or more of: <code>GET</code>,
1645 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1646 <code>CONNECT</code>, <code>OPTIONS</code>,
1647 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1648 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1649 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1650 case-sensitive.</strong> If <code>GET</code> is used it will also
1651 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1652 cannot be limited (see <code class="directive"><a href="#traceenable">TraceEnable</a></code>).</p>
1654 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
1655 used in preference to a <code class="directive"><Limit></code>
1656 section when restricting access, since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
1657 against arbitrary methods.</div>
1659 <p>The <code class="directive"><Limit></code> and
1660 <code class="directive"><a href="#limitexcept"><LimitExcept></a></code>
1661 directives may be nested. In this case, each successive level of
1662 <code class="directive"><Limit></code> or <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> directives must
1663 further restrict the set of methods to which access controls apply.</p>
1665 <div class="warning">When using
1666 <code class="directive"><Limit></code> or
1667 <code class="directive"><LimitExcept></code> directives with
1668 the <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive,
1669 note that the first <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code>
1670 to succeed authorizes the request, regardless of the presence of other
1671 <code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directives.</div>
1673 <p>For example, given the following configuration, all users will
1674 be authorized for <code>POST</code> requests, and the
1675 <code>Require group editors</code> directive will be ignored
1678 <div class="example"><p><code>
1679 <LimitExcept GET>
1680 <span class="indent">
1683 </LimitExcept><br />
1685 <span class="indent">
1686 Require group editors
1692 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1693 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
1694 <table class="directive">
1695 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
1696 except the named ones</td></tr>
1697 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1698 </LimitExcept></code></td></tr>
1699 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1700 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig, Limit</td></tr>
1701 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1702 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1704 <p><code class="directive"><LimitExcept></code> and
1705 <code></LimitExcept></code> are used to enclose
1706 a group of access control directives which will then apply to any
1707 HTTP access method <strong>not</strong> listed in the arguments;
1708 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
1709 both standard and nonstandard/unrecognized methods. See the
1710 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
1714 <div class="example"><p><code>
1715 <LimitExcept POST GET><br />
1716 <span class="indent">
1717 Require valid-user<br />
1719 </LimitExcept>
1724 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1725 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
1726 <table class="directive">
1727 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
1728 subrequests</td></tr>
1729 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
1730 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
1731 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1732 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1733 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1734 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.47 and later</td></tr>
1736 <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
1737 redirects the original request to a CGI script. A subrequest is Apache's
1738 mechanism to find out what would happen for some URI if it were requested.
1739 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
1740 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
1743 <p><code class="directive">LimitInternalRecursion</code> prevents the server
1744 from crashing when entering an infinite loop of internal redirects or
1745 subrequests. Such loops are usually caused by misconfigurations.</p>
1747 <p>The directive stores two different limits, which are evaluated on
1748 per-request basis. The first <var>number</var> is the maximum number of
1749 internal redirects, that may follow each other. The second <var>number</var>
1750 determines, how deep subrequests may be nested. If you specify only one
1751 <var>number</var>, it will be assigned to both limits.</p>
1753 <div class="example"><h3>Example</h3><p><code>
1754 LimitInternalRecursion 5
1758 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1759 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
1760 <table class="directive">
1761 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
1762 from the client</td></tr>
1763 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
1764 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
1765 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1766 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1767 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1768 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1770 <p>This directive specifies the number of <var>bytes</var> from 0
1771 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1774 <p>The <code class="directive">LimitRequestBody</code> directive allows
1775 the user to set a limit on the allowed size of an HTTP request
1776 message body within the context in which the directive is given
1777 (server, per-directory, per-file or per-location). If the client
1778 request exceeds that limit, the server will return an error
1779 response instead of servicing the request. The size of a normal
1780 request message body will vary greatly depending on the nature of
1781 the resource and the methods allowed on that resource. CGI scripts
1782 typically use the message body for retrieving form information.
1783 Implementations of the <code>PUT</code> method will require
1784 a value at least as large as any representation that the server
1785 wishes to accept for that resource.</p>
1787 <p>This directive gives the server administrator greater
1788 control over abnormal client request behavior, which may be
1789 useful for avoiding some forms of denial-of-service
1792 <p>If, for example, you are permitting file upload to a particular
1793 location, and wish to limit the size of the uploaded file to 100K,
1794 you might use the following directive:</p>
1796 <div class="example"><p><code>
1797 LimitRequestBody 102400
1802 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1803 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
1804 <table class="directive">
1805 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
1806 will be accepted from the client</td></tr>
1807 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
1808 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
1809 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1810 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1811 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1813 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1814 32767. The default value is defined by the compile-time
1815 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1818 <p>The <code class="directive">LimitRequestFields</code> directive allows
1819 the server administrator to modify the limit on the number of
1820 request header fields allowed in an HTTP request. A server needs
1821 this value to be larger than the number of fields that a normal
1822 client request might include. The number of request header fields
1823 used by a client rarely exceeds 20, but this may vary among
1824 different client implementations, often depending upon the extent
1825 to which a user has configured their browser to support detailed
1826 content negotiation. Optional HTTP extensions are often expressed
1827 using request header fields.</p>
1829 <p>This directive gives the server administrator greater
1830 control over abnormal client request behavior, which may be
1831 useful for avoiding some forms of denial-of-service attacks.
1832 The value should be increased if normal clients see an error
1833 response from the server that indicates too many fields were
1834 sent in the request.</p>
1838 <div class="example"><p><code>
1839 LimitRequestFields 50
1844 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1845 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
1846 <table class="directive">
1847 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
1849 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldSize <var>bytes</var></code></td></tr>
1850 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldSize 8190</code></td></tr>
1851 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1852 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1853 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1855 <p>This directive specifies the number of <var>bytes</var>
1856 that will be allowed in an HTTP request header.</p>
1858 <p>The <code class="directive">LimitRequestFieldSize</code> directive
1859 allows the server administrator to reduce or increase the limit
1860 on the allowed size of an HTTP request header field. A server
1861 needs this value to be large enough to hold any one header field
1862 from a normal client request. The size of a normal request header
1863 field will vary greatly among different client implementations,
1864 often depending upon the extent to which a user has configured
1865 their browser to support detailed content negotiation. SPNEGO
1866 authentication headers can be up to 12392 bytes.</p>
1868 <p>This directive gives the server administrator greater
1869 control over abnormal client request behavior, which may be
1870 useful for avoiding some forms of denial-of-service attacks.</p>
1874 <div class="example"><p><code>
1875 LimitRequestFieldSize 4094
1878 <div class="note">Under normal conditions, the value should not be changed from
1883 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1884 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
1885 <table class="directive">
1886 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
1887 from the client</td></tr>
1888 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
1889 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
1890 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1891 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1892 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1894 <p>This directive sets the number of <var>bytes</var> that will be
1895 allowed on the HTTP request-line.</p>
1897 <p>The <code class="directive">LimitRequestLine</code> directive allows
1898 the server administrator to reduce or increase the limit on the allowed size
1899 of a client's HTTP request-line. Since the request-line consists of the
1900 HTTP method, URI, and protocol version, the
1901 <code class="directive">LimitRequestLine</code> directive places a
1902 restriction on the length of a request-URI allowed for a request
1903 on the server. A server needs this value to be large enough to
1904 hold any of its resource names, including any information that
1905 might be passed in the query part of a <code>GET</code> request.</p>
1907 <p>This directive gives the server administrator greater
1908 control over abnormal client request behavior, which may be
1909 useful for avoiding some forms of denial-of-service attacks.</p>
1913 <div class="example"><p><code>
1914 LimitRequestLine 4094
1917 <div class="note">Under normal conditions, the value should not be changed from
1921 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1922 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
1923 <table class="directive">
1924 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
1925 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
1926 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
1927 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1928 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1929 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1930 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1932 <p>Limit (in bytes) on maximum size of an XML-based request
1933 body. A value of <code>0</code> will disable any checking.</p>
1937 <div class="example"><p><code>
1938 LimitXMLRequestBody 0
1943 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1944 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
1945 <table class="directive">
1946 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
1948 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
1949 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
1950 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1951 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1952 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1954 <p>The <code class="directive"><Location></code> directive
1955 limits the scope of the enclosed directives by URL. It is similar to the
1956 <code class="directive"><a href="#directory"><Directory></a></code>
1957 directive, and starts a subsection which is terminated with a
1958 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
1959 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1960 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
1962 <p><code class="directive"><Location></code> sections operate
1963 completely outside the filesystem. This has several consequences.
1964 Most importantly, <code class="directive"><Location></code>
1965 directives should not be used to control access to filesystem
1966 locations. Since several different URLs may map to the same
1967 filesystem location, such access controls may by circumvented.</p>
1969 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
1971 <p>Use <code class="directive"><Location></code> to apply
1972 directives to content that lives outside the filesystem. For
1973 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
1974 <code><Location /></code>, which is an easy way to
1975 apply a configuration to the entire server.</p>
1978 <p>For all origin (non-proxy) requests, the URL to be matched is a
1979 URL-path of the form <code>/path/</code>. <em>No scheme, hostname,
1980 port, or query string may be included.</em> For proxy requests, the
1981 URL to be matched is of the form
1982 <code>scheme://servername/path</code>, and you must include the
1985 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1986 any single character, and <code>*</code> matches any sequences of
1987 characters. Neither wildcard character matches a / in the URL-path.</p>
1989 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1990 can also be used, with the addition of the
1991 <code>~</code> character. For example:</p>
1993 <div class="example"><p><code>
1994 <Location ~ "/(extra|special)/data">
1997 <p>would match URLs that contained the substring <code>/extra/data</code>
1998 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
1999 identical to the regex version of <code class="directive"><Location></code>.</p>
2001 <p>The <code class="directive"><Location></code>
2002 functionality is especially useful when combined with the
2003 <code class="directive"><a href="#sethandler">SetHandler</a></code>
2004 directive. For example, to enable status requests, but allow them
2005 only from browsers at <code>example.com</code>, you might use:</p>
2007 <div class="example"><p><code>
2008 <Location /status><br />
2009 <span class="indent">
2010 SetHandler server-status<br />
2011 Order Deny,Allow<br />
2013 Allow from .example.com<br />
2018 <div class="note"><h3>Note about / (slash)</h3>
2019 <p>The slash character has special meaning depending on where in a
2020 URL it appears. People may be used to its behavior in the filesystem
2021 where multiple adjacent slashes are frequently collapsed to a single
2022 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
2023 <code>/home/foo</code>). In URL-space this is not necessarily true.
2024 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
2025 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
2026 slashes if that is your intention.</p>
2028 <p>For example, <code><LocationMatch ^/abc></code> would match
2029 the request URL <code>/abc</code> but not the request URL <code>
2030 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
2031 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
2032 implicitly match multiple slashes with a single slash. For example,
2033 if you specify <code><Location /abc/def></code> and the
2034 request is to <code>/abc//def</code> then it will match.</p>
2039 <li><a href="../sections.html">How <Directory>, <Location>
2040 and <Files> sections work</a> for an explanation of how these
2041 different sections are combined when a request is received</li>
2044 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2045 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
2046 <table class="directive">
2047 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
2048 matching URLs</td></tr>
2049 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
2050 <var>regex</var>> ... </LocationMatch></code></td></tr>
2051 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2052 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2053 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2055 <p>The <code class="directive"><LocationMatch></code> directive
2056 limits the scope of the enclosed directives by URL, in an identical manner
2057 to <code class="directive"><a href="#location"><Location></a></code>. However,
2058 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2059 as an argument instead of a simple string. For example:</p>
2061 <div class="example"><p><code>
2062 <LocationMatch "/(extra|special)/data">
2065 <p>would match URLs that contained the substring <code>/extra/data</code>
2066 or <code>/special/data</code>.</p>
2070 <li><a href="../sections.html">How <Directory>, <Location>
2071 and <Files> sections work</a> for an explanation of how these
2072 different sections are combined when a request is received</li>
2075 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2076 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2077 <table class="directive">
2078 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2079 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>level</var></code></td></tr>
2080 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2081 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2082 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2083 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2085 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2086 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2087 <var>level</var>s are available, in order of decreasing
2090 <table class="bordered">
2093 <th><strong>Level</strong> </th>
2095 <th><strong>Description</strong> </th>
2097 <th><strong>Example</strong> </th>
2101 <td><code>emerg</code> </td>
2103 <td>Emergencies - system is unusable.</td>
2105 <td>"Child cannot open lock file. Exiting"</td>
2109 <td><code>alert</code> </td>
2111 <td>Action must be taken immediately.</td>
2113 <td>"getpwuid: couldn't determine user name from uid"</td>
2117 <td><code>crit</code> </td>
2119 <td>Critical Conditions.</td>
2121 <td>"socket: Failed to get a socket, exiting child"</td>
2125 <td><code>error</code> </td>
2127 <td>Error conditions.</td>
2129 <td>"Premature end of script headers"</td>
2133 <td><code>warn</code> </td>
2135 <td>Warning conditions.</td>
2137 <td>"child process 1234 did not exit, sending another
2142 <td><code>notice</code> </td>
2144 <td>Normal but significant condition.</td>
2146 <td>"httpd: caught SIGBUS, attempting to dump core in
2151 <td><code>info</code> </td>
2153 <td>Informational.</td>
2155 <td>"Server seems busy, (you may need to increase
2156 StartServers, or Min/MaxSpareServers)..."</td>
2160 <td><code>debug</code> </td>
2162 <td>Debug-level messages</td>
2164 <td>"Opening config file ..."</td>
2168 <p>When a particular level is specified, messages from all
2169 other levels of higher significance will be reported as well.
2170 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2171 then messages with log levels of <code>notice</code> and
2172 <code>warn</code> will also be posted.</p>
2174 <p>Using a level of at least <code>crit</code> is
2179 <div class="example"><p><code>
2183 <div class="note"><h3>Note</h3>
2184 <p>When logging to a regular file messages of the level
2185 <code>notice</code> cannot be suppressed and thus are always
2186 logged. However, this doesn't apply when logging is done
2187 using <code>syslog</code>.</p>
2191 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2192 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
2193 <table class="directive">
2194 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
2195 connection</td></tr>
2196 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
2197 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
2198 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2199 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2200 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2202 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
2203 limits the number of requests allowed per connection when
2204 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
2205 set to <code>0</code>, unlimited requests will be allowed. We
2206 recommend that this setting be kept to a high value for maximum
2207 server performance.</p>
2211 <div class="example"><p><code>
2212 MaxKeepAliveRequests 500
2216 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2217 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
2218 <table class="directive">
2219 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Designates an IP address for name-virtual
2221 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
2222 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2223 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2224 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2226 <p>The <code class="directive">NameVirtualHost</code> directive is a
2227 required directive if you want to configure <a href="../vhosts/">name-based virtual hosts</a>.</p>
2229 <p>Although <var>addr</var> can be hostname it is recommended
2230 that you always use an IP address, e.g.</p>
2232 <div class="example"><p><code>
2233 NameVirtualHost 111.22.33.44
2236 <p>With the <code class="directive">NameVirtualHost</code> directive you
2237 specify the IP address on which the server will receive requests
2238 for the name-based virtual hosts. This will usually be the address
2239 to which your name-based virtual host names resolve. In cases
2240 where a firewall or other proxy receives the requests and forwards
2241 them on a different IP address to the server, you must specify the
2242 IP address of the physical interface on the machine which will be
2243 servicing the requests. If you have multiple name-based hosts on
2244 multiple addresses, repeat the directive for each address.</p>
2246 <div class="note"><h3>Note</h3>
2247 <p>Note, that the "main server" and any <code>_default_</code> servers
2248 will <strong>never</strong> be served for a request to a
2249 <code class="directive">NameVirtualHost</code> IP address (unless for some
2250 reason you specify <code class="directive">NameVirtualHost</code> but then
2251 don't define any <code class="directive">VirtualHost</code>s for that
2255 <p>Optionally you can specify a port number on which the
2256 name-based virtual hosts should be used, e.g.</p>
2258 <div class="example"><p><code>
2259 NameVirtualHost 111.22.33.44:8080
2262 <p>IPv6 addresses must be enclosed in square brackets, as shown
2263 in the following example:</p>
2265 <div class="example"><p><code>
2266 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2269 <p>To receive requests on all interfaces, you can use an argument of
2272 <div class="example"><p><code>
2276 <div class="note"><h3>Argument to <code class="directive"><VirtualHost></code>
2278 <p>Note that the argument to the <code class="directive"><VirtualHost></code> directive must
2279 exactly match the argument to the <code class="directive">NameVirtualHost</code> directive.</p>
2281 <div class="example"><p><code>
2282 NameVirtualHost 1.2.3.4<br />
2283 <VirtualHost 1.2.3.4><br />
2285 </VirtualHost><br />
2291 <li><a href="../vhosts/">Virtual Hosts
2292 documentation</a></li>
2295 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2296 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
2297 <table class="directive">
2298 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
2300 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
2301 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
2302 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options All</code></td></tr>
2303 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2304 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
2305 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2306 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2308 <p>The <code class="directive">Options</code> directive controls which
2309 server features are available in a particular directory.</p>
2311 <p><var>option</var> can be set to <code>None</code>, in which
2312 case none of the extra features are enabled, or one or more of
2316 <dt><code>All</code></dt>
2318 <dd>All options except for <code>MultiViews</code>. This is the default
2321 <dt><code>ExecCGI</code></dt>
2324 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
2327 <dt><code>FollowSymLinks</code></dt>
2331 The server will follow symbolic links in this directory.
2333 <p>Even though the server follows the symlink it does <em>not</em>
2334 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
2335 <p>Note also, that this option <strong>gets ignored</strong> if set
2336 inside a <code class="directive"><a href="#location"><Location></a></code>
2338 <p>Omitting this option should not be considered a security restriction,
2339 since symlink testing is subject to race conditions that make it
2343 <dt><code>Includes</code></dt>
2346 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
2349 <dt><code>IncludesNOEXEC</code></dt>
2353 Server-side includes are permitted, but the <code>#exec
2354 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2355 possible to <code>#include virtual</code> CGI scripts from
2356 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
2359 <dt><code>Indexes</code></dt>
2362 If a URL which maps to a directory is requested, and there
2363 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2364 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2365 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
2366 of the directory.</dd>
2368 <dt><code>MultiViews</code></dt>
2371 <a href="../content-negotiation.html">Content negotiated</a>
2372 "MultiViews" are allowed using
2373 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.</dd>
2375 <dt><code>SymLinksIfOwnerMatch</code></dt>
2377 <dd>The server will only follow symbolic links for which the
2378 target file or directory is owned by the same user id as the
2381 <div class="note"><h3>Note</h3> <p>This option gets ignored if
2382 set inside a <code class="directive"><a href="#location"><Location></a></code> section.</p>
2383 <p>This option should not be considered a security restriction,
2384 since symlink testing is subject to race conditions that make it
2385 circumventable.</p></div>
2389 <p>Normally, if multiple <code class="directive">Options</code> could
2390 apply to a directory, then the most specific one is used and
2391 others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
2392 However if <em>all</em> the options on the
2393 <code class="directive">Options</code> directive are preceded by a
2394 <code>+</code> or <code>-</code> symbol, the options are
2395 merged. Any options preceded by a <code>+</code> are added to the
2396 options currently in force, and any options preceded by a
2397 <code>-</code> are removed from the options currently in
2400 <div class="warning"><h3>Warning</h3>
2401 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
2402 <code>-</code> with those without is not valid syntax, and is likely
2403 to cause unexpected results.</p>
2406 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2408 <div class="example"><p><code>
2409 <Directory /web/docs><br />
2410 <span class="indent">
2411 Options Indexes FollowSymLinks<br />
2413 </Directory><br />
2415 <Directory /web/docs/spec><br />
2416 <span class="indent">
2417 Options Includes<br />
2422 <p>then only <code>Includes</code> will be set for the
2423 <code>/web/docs/spec</code> directory. However if the second
2424 <code class="directive">Options</code> directive uses the <code>+</code> and
2425 <code>-</code> symbols:</p>
2427 <div class="example"><p><code>
2428 <Directory /web/docs><br />
2429 <span class="indent">
2430 Options Indexes FollowSymLinks<br />
2432 </Directory><br />
2434 <Directory /web/docs/spec><br />
2435 <span class="indent">
2436 Options +Includes -Indexes<br />
2441 <p>then the options <code>FollowSymLinks</code> and
2442 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2445 <div class="note"><h3>Note</h3>
2446 <p>Using <code>-IncludesNOEXEC</code> or
2447 <code>-Includes</code> disables server-side includes completely
2448 regardless of the previous setting.</p>
2451 <p>The default in the absence of any other settings is
2452 <code>All</code>.</p>
2455 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2456 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
2457 <table class="directive">
2458 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
2459 by Apache children</td></tr>
2460 <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>
2461 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2462 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2463 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2464 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2465 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2467 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2468 resource limit for all processes and the second parameter sets
2469 the maximum resource limit. Either parameter can be a number,
2470 or <code>max</code> to indicate to the server that the limit should
2471 be set to the maximum allowed by the operating system
2472 configuration. Raising the maximum resource limit requires that
2473 the server is running as <code>root</code>, or in the initial startup
2476 <p>This applies to processes forked off from Apache children
2477 servicing requests, not the Apache children themselves. This
2478 includes CGI scripts and SSI exec commands, but not any
2479 processes forked off from the Apache parent such as piped
2482 <p>CPU resource limits are expressed in seconds per
2487 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2488 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2491 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2492 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
2493 <table class="directive">
2494 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
2495 by Apache children</td></tr>
2496 <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>
2497 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2498 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2499 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2500 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2501 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2503 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2504 resource limit for all processes and the second parameter sets
2505 the maximum resource limit. Either parameter can be a number,
2506 or <code>max</code> to indicate to the server that the limit should
2507 be set to the maximum allowed by the operating system
2508 configuration. Raising the maximum resource limit requires that
2509 the server is running as <code>root</code>, or in the initial startup
2512 <p>This applies to processes forked off from Apache children
2513 servicing requests, not the Apache children themselves. This
2514 includes CGI scripts and SSI exec commands, but not any
2515 processes forked off from the Apache parent such as piped
2518 <p>Memory resource limits are expressed in bytes per
2523 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2524 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2527 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2528 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
2529 <table class="directive">
2530 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
2531 processes launched by Apache children</td></tr>
2532 <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>
2533 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2534 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2535 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2536 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2537 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2539 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2540 resource limit for all processes and the second parameter sets
2541 the maximum resource limit. Either parameter can be a number,
2542 or <code>max</code> to indicate to the server that the limit
2543 should be set to the maximum allowed by the operating system
2544 configuration. Raising the maximum resource limit requires that
2545 the server is running as <code>root</code>, or in the initial startup
2548 <p>This applies to processes forked off from Apache children
2549 servicing requests, not the Apache children themselves. This
2550 includes CGI scripts and SSI exec commands, but not any
2551 processes forked off from the Apache parent such as piped
2554 <p>Process limits control the number of processes per user.</p>
2556 <div class="note"><h3>Note</h3>
2557 <p>If CGI processes are <strong>not</strong> running
2558 under user ids other than the web server user id, this directive
2559 will limit the number of processes that the server itself can
2560 create. Evidence of this situation will be indicated by
2561 <strong><code>cannot fork</code></strong> messages in the
2562 <code>error_log</code>.</p>
2567 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2568 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2571 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2572 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
2573 <table class="directive">
2574 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
2576 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
2577 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
2578 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2579 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2580 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2581 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2582 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only;
2583 option <code>Registry-Strict</code> is available in Apache 2.0 and
2586 <p>This directive is used to control how Apache finds the
2587 interpreter used to run CGI scripts. The default setting is
2588 <code>Script</code>. This causes Apache to use the interpreter pointed to
2589 by the shebang line (first line, starting with <code>#!</code>) in the
2590 script. On Win32 systems this line usually looks like:</p>
2592 <div class="example"><p><code>
2593 #!C:/Perl/bin/perl.exe
2596 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2598 <div class="example"><p><code>
2602 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2603 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2604 searched using the script file extension (e.g., <code>.pl</code>) as a
2605 search key. The command defined by the registry subkey
2606 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2607 <code>Shell\Open\Command</code> is used to open the script file. If the
2608 registry keys cannot be found, Apache falls back to the behavior of the
2609 <code>Script</code> option.</p>
2611 <div class="warning"><h3>Security</h3>
2612 <p>Be careful when using <code>ScriptInterpreterSource
2613 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
2614 Apache will try to execute <strong>every</strong> file within this
2615 directory. The <code>Registry</code> setting may cause undesired
2616 program calls on files which are typically not executed. For
2617 example, the default open command on <code>.htm</code> files on
2618 most Windows systems will execute Microsoft Internet Explorer, so
2619 any HTTP request for an <code>.htm</code> file existing within the
2620 script directory would start the browser in the background on the
2621 server. This is a good way to crash your system within a minute or
2625 <p>The option <code>Registry-Strict</code> which is new in Apache
2626 2.0 does the same thing as <code>Registry</code> but uses only the
2627 subkey <code>Shell\ExecCGI\Command</code>. The
2628 <code>ExecCGI</code> key is not a common one. It must be
2629 configured manually in the windows registry and hence prevents
2630 accidental program calls on your system.</p>
2633 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2634 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
2635 <table class="directive">
2636 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
2637 messages sent to the client</td></tr>
2638 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
2639 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2640 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2641 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2643 <p>The <code class="directive">ServerAdmin</code> sets the contact address
2644 that the server includes in any error messages it returns to the
2645 client. If the <code>httpd</code> doesn't recognize the supplied argument
2647 assumes, that it's an <var>email-address</var> and prepends it with
2648 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2649 actually use an email address, since there are a lot of CGI scripts that
2650 make that assumption. If you want to use an URL, it should point to another
2651 server under your control. Otherwise users may not be able to contact you in
2654 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2656 <div class="example"><p><code>
2657 ServerAdmin www-admin@foo.example.com
2659 <p>as users do not always mention that they are talking about the
2663 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2664 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
2665 <table class="directive">
2666 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
2667 to name-virtual hosts</td></tr>
2668 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
2669 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2670 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2671 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2673 <p>The <code class="directive">ServerAlias</code> directive sets the
2674 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>. The
2675 <code class="directive">ServerAlias</code> may include wildcards, if appropriate.</p>
2677 <div class="example"><p><code>
2678 <VirtualHost *:80><br />
2679 ServerName server.domain.com<br />
2680 ServerAlias server server2.domain.com server2<br />
2681 ServerAlias *.example.com<br />
2683 </VirtualHost>
2688 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2691 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2692 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
2693 <table class="directive">
2694 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
2696 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerName [<var>scheme</var>://]<var>fully-qualified-domain-name</var>[:<var>port</var>]</code></td></tr>
2697 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2698 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2699 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2700 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>In version 2.0, this
2701 directive supersedes the functionality of the <code class="directive">Port</code>
2702 directive from version 1.3.</td></tr>
2704 <p>The <code class="directive">ServerName</code> directive sets the
2705 request scheme, hostname and
2706 port that the server uses to identify itself. This is used when
2707 creating redirection URLs. For example, if the name of the
2708 machine hosting the web server is <code>simple.example.com</code>,
2709 but the machine also has the DNS alias <code>www.example.com</code>
2710 and you wish the web server to be so identified, the following
2711 directive should be used:</p>
2713 <div class="example"><p><code>
2714 ServerName www.example.com:80
2717 <p>If no <code class="directive">ServerName</code> is specified, then the
2718 server attempts to deduce the hostname by performing a reverse
2719 lookup on the IP address. If no port is specified in the
2720 <code class="directive">ServerName</code>, then the server will use the
2721 port from the incoming request. For optimal reliability and
2722 predictability, you should specify an explicit hostname and port
2723 using the <code class="directive">ServerName</code> directive.</p>
2725 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
2726 the <code class="directive">ServerName</code> inside a
2727 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
2728 section specifies what hostname must appear in the request's
2729 <code>Host:</code> header to match this virtual host.</p>
2732 <p>Sometimes, the server runs behind a device that processes SSL,
2733 such as a reverse proxy, load balancer or SSL offload
2734 appliance. When this is the case, specify the
2735 <code>https://</code> scheme and the port number to which the
2736 clients connect in the <code class="directive">ServerName</code> directive
2737 to make sure that the server generates the correct
2738 self-referential URLs.
2741 <p>See the description of the
2742 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
2743 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code> directives for
2744 settings which determine whether self-referential URLs (e.g., by the
2745 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
2746 specified port, or to the port number given in the client's request.
2752 <li><a href="../dns-caveats.html">Issues Regarding DNS and
2754 <li><a href="../vhosts/">Apache virtual host
2755 documentation</a></li>
2756 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
2757 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
2758 <li><code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code></li>
2759 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
2762 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2763 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
2764 <table class="directive">
2765 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
2766 is accessed by an incompatible browser</td></tr>
2767 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
2768 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2769 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2770 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2772 <p>The <code class="directive">ServerPath</code> directive sets the legacy
2773 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
2777 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2780 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2781 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
2782 <table class="directive">
2783 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
2784 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
2785 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
2786 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2787 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2788 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2790 <p>The <code class="directive">ServerRoot</code> directive sets the
2791 directory in which the server lives. Typically it will contain the
2792 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2793 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
2794 relative to this directory.</p>
2796 <div class="example"><h3>Example</h3><p><code>
2797 ServerRoot /home/httpd
2803 <li><a href="../invoking.html">the <code>-d</code>
2804 option to <code>httpd</code></a></li>
2805 <li><a href="../misc/security_tips.html#serverroot">the
2806 security tips</a> for information on how to properly set
2807 permissions on the <code class="directive">ServerRoot</code></li>
2810 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2811 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
2812 <table class="directive">
2813 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
2814 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
2815 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
2816 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2817 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2818 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2819 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2821 <p>The <code class="directive">ServerSignature</code> directive allows the
2822 configuration of a trailing footer line under server-generated
2823 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
2824 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
2825 would want to enable such a footer line is that in a chain of proxies,
2826 the user often has no possibility to tell which of the chained servers
2827 actually produced a returned error message.</p>
2829 <p>The <code>Off</code>
2830 setting, which is the default, suppresses the footer line (and is
2831 therefore compatible with the behavior of Apache-1.2 and
2832 below). The <code>On</code> setting simply adds a line with the
2833 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
2834 and the <code>EMail</code> setting additionally creates a
2835 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
2838 <p>After version 2.0.44, the details of the server version number
2839 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
2843 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
2846 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2847 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
2848 <table class="directive">
2849 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
2851 <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>
2852 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
2853 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2854 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2855 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2857 <p>This directive controls whether <code>Server</code> response
2858 header field which is sent back to clients includes a
2859 description of the generic OS-type of the server as well as
2860 information about compiled-in modules.</p>
2863 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2865 <dd>Server sends (<em>e.g.</em>): <code>Server:
2868 <dt><code>ServerTokens Major</code></dt>
2870 <dd>Server sends (<em>e.g.</em>): <code>Server:
2871 Apache/2</code></dd>
2873 <dt><code>ServerTokens Minor</code></dt>
2875 <dd>Server sends (<em>e.g.</em>): <code>Server:
2876 Apache/2.0</code></dd>
2878 <dt><code>ServerTokens Min[imal]</code></dt>
2880 <dd>Server sends (<em>e.g.</em>): <code>Server:
2881 Apache/2.0.41</code></dd>
2883 <dt><code>ServerTokens OS</code></dt>
2885 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2888 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2890 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2891 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2894 <p>This setting applies to the entire server, and cannot be
2895 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2897 <p>After version 2.0.44, this directive also controls the
2898 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
2902 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
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="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
2907 <table class="directive">
2908 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
2910 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
2911 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2912 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</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>
2915 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache 2.0</td></tr>
2917 <p>When placed into an <code>.htaccess</code> file or a
2918 <code class="directive"><a href="#directory"><Directory></a></code> or
2919 <code class="directive"><a href="#location"><Location></a></code>
2920 section, this directive forces all matching files to be parsed
2921 through the <a href="../handler.html">handler</a> given by
2922 <var>handler-name</var>. For example, if you had a directory you
2923 wanted to be parsed entirely as imagemap rule files, regardless
2924 of extension, you might put the following into an
2925 <code>.htaccess</code> file in that directory:</p>
2927 <div class="example"><p><code>
2928 SetHandler imap-file
2931 <p>Another example: if you wanted to have the server display a
2932 status report whenever a URL of
2933 <code>http://servername/status</code> was called, you might put
2934 the following into <code>httpd.conf</code>:</p>
2936 <div class="example"><p><code>
2937 <Location /status><br />
2938 <span class="indent">
2939 SetHandler server-status<br />
2944 <p>You can override an earlier defined <code class="directive">SetHandler</code>
2945 directive by using the value <code>None</code>.</p>
2946 <p><strong>Note:</strong> because SetHandler overrides default handlers,
2947 normal behaviour such as handling of URLs ending in a slash (/) as
2948 directories or index files is suppressed.</p>
2952 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
2955 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2956 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
2957 <table class="directive">
2958 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
2960 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
2961 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2962 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2963 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2964 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2966 <p>The <code class="directive">SetInputFilter</code> directive sets the
2967 filter or filters which will process client requests and POST
2968 input when they are received by the server. This is in addition to
2969 any filters defined elsewhere, including the
2970 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
2973 <p>If more than one filter is specified, they must be separated
2974 by semicolons in the order in which they should process the
2979 <li><a href="../filter.html">Filters</a> documentation</li>
2982 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2983 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
2984 <table class="directive">
2985 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
2987 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
2988 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2989 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2990 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2991 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2993 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
2994 which will process responses from the server before they are
2995 sent to the client. This is in addition to any filters defined
2996 elsewhere, including the
2997 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
3000 <p>For example, the following configuration will process all files
3001 in the <code>/www/data/</code> directory for server-side
3004 <div class="example"><p><code>
3005 <Directory /www/data/><br />
3006 <span class="indent">
3007 SetOutputFilter INCLUDES<br />
3012 <p>If more than one filter is specified, they must be separated
3013 by semicolons in the order in which they should process the
3018 <li><a href="../filter.html">Filters</a> documentation</li>
3021 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3022 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
3023 <table class="directive">
3024 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
3025 certain events before failing a request</td></tr>
3026 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
3027 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 300</code></td></tr>
3028 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
3029 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3030 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3032 <p>The <code class="directive">TimeOut</code> directive defines the length
3033 of time Apache will wait for I/O in various circumstances:</p>
3036 <li>When reading data from the client, the length of time to
3037 wait for a TCP packet to arrive if the read buffer is
3040 <li>When writing data to the client, the length of time to wait
3041 for an acknowledgement of a packet if the send buffer is
3044 <li>In <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, the length of time to wait for
3045 output from a CGI script.</li>
3047 <li>In <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>, the length of time to
3048 wait for output from a filtering process.</li>
3050 <li>In <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>, the default timeout value if
3051 <code class="directive"><a href="../mod/mod_proxy.html#proxytimeout">ProxyTimeout</a></code> is not
3057 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3058 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
3059 <table class="directive">
3060 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behaviour on <code>TRACE</code>
3062 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
3063 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
3064 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3065 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3066 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3067 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 1.3.34, 2.0.55 and later</td></tr>
3069 <p>This directive overrides the behavior of <code>TRACE</code> for both
3070 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
3071 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3072 RFC 2616, which disallows any request body to accompany the request.
3073 <code>TraceEnable off</code> causes the core server and
3074 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
3075 allowed) error to the client.</p>
3077 <p>Finally, for testing and diagnostic purposes only, request
3078 bodies may be allowed using the non-compliant <code>TraceEnable
3079 extended</code> directive. The core (as an origin server) will
3080 restrict the request body to 64k (plus 8k for chunk headers if
3081 <code>Transfer-Encoding: chunked</code> is used). The core will
3082 reflect the full headers and all chunk headers with the response
3083 body. As a proxy server, the request body is not restricted to 64k.</p>
3086 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3087 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
3088 <table class="directive">
3089 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3091 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
3092 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
3093 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3094 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3095 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3097 <p>In many situations Apache must construct a <em>self-referential</em>
3098 URL -- that is, a URL that refers back to the same server. With
3099 <code>UseCanonicalName On</code> Apache will use the hostname and port
3100 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
3101 directive to construct the canonical name for the server. This name
3102 is used in all self-referential URLs, and for the values of
3103 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3105 <p>With <code>UseCanonicalName Off</code> Apache will form
3106 self-referential URLs using the hostname and port supplied by
3107 the client if any are supplied (otherwise it will use the
3108 canonical name, as defined above). These values are the same
3109 that are used to implement <a href="../vhosts/name-based.html">name based virtual hosts</a>,
3110 and are available with the same clients. The CGI variables
3111 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3112 constructed from the client supplied values as well.</p>
3114 <p>An example where this may be useful is on an intranet server
3115 where you have users connecting to the machine using short
3116 names such as <code>www</code>. You'll notice that if the users
3117 type a shortname, and a URL which is a directory, such as
3118 <code>http://www/splat</code>, <em>without the trailing
3119 slash</em> then Apache will redirect them to
3120 <code>http://www.domain.com/splat/</code>. If you have
3121 authentication enabled, this will cause the user to have to
3122 authenticate twice (once for <code>www</code> and once again
3123 for <code>www.domain.com</code> -- see <a href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3124 FAQ on this subject for more information</a>). But if
3125 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
3126 Apache will redirect to <code>http://www/splat/</code>.</p>
3128 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3129 which is intended for use with mass IP-based virtual hosting to
3130 support ancient clients that do not provide a
3131 <code>Host:</code> header. With this option Apache does a
3132 reverse DNS lookup on the server IP address that the client
3133 connected to in order to work out self-referential URLs.</p>
3135 <div class="warning"><h3>Warning</h3>
3136 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3137 they may be broken by this option. The client is essentially free
3138 to give whatever value they want as a hostname. But if the CGI is
3139 only using <code>SERVER_NAME</code> to construct self-referential URLs
3140 then it should be just fine.</p>
3145 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3146 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3147 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3150 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3151 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
3152 <table class="directive">
3153 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3155 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
3156 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
3157 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3158 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3159 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3161 <p>In many situations Apache must construct a <em>self-referential</em>
3162 URL -- that is, a URL that refers back to the same server. With
3163 <code>UseCanonicalPhysicalPort On</code> Apache will, when
3164 constructing the canonical port for the server to honor
3165 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
3166 provide the actual physical port number being used by this request
3167 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3168 Apache will not ever use the actual physical port number, instead
3169 relying on all configured information to construct a valid port number.</p>
3171 <div class="note"><h3>Note</h3>
3172 <p>The ordering of when the physical port is used is as follows:<br /><br />
3173 <code>UseCanonicalName On</code></p>
3175 <li>Port provided in <code>Servername</code></li>
3176 <li>Physical port</li>
3177 <li>Default port</li>
3179 <code>UseCanonicalName Off | DNS</code>
3181 <li>Parsed port from <code>Host:</code> header</li>
3182 <li>Physical port</li>
3183 <li>Port provided in <code>Servername</code></li>
3184 <li>Default port</li>
3187 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3188 physical ports are removed from the ordering.</p>
3194 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3195 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3196 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3199 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3200 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
3201 <table class="directive">
3202 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
3203 hostname or IP address</td></tr>
3204 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
3205 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3206 ...> ... </VirtualHost></code></td></tr>
3207 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3208 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3209 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3211 <p><code class="directive"><VirtualHost></code> and
3212 <code></VirtualHost></code> are used to enclose a group of
3213 directives that will apply only to a particular virtual host. Any
3214 directive that is allowed in a virtual host context may be
3215 used. When the server receives a request for a document on a
3216 particular virtual host, it uses the configuration directives
3217 enclosed in the <code class="directive"><VirtualHost></code>
3218 section. <var>Addr</var> can be:</p>
3221 <li>The IP address of the virtual host;</li>
3223 <li>A fully qualified domain name for the IP address of the
3224 virtual host (not recommended);</li>
3226 <li>The character <code>*</code>, which is used only in combination with
3227 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3229 <li>The string <code>_default_</code>, which is used only
3230 with IP virtual hosting to catch unmatched IP addresses.</li>
3233 <div class="example"><h3>Example</h3><p><code>
3234 <VirtualHost 10.1.2.3><br />
3235 <span class="indent">
3236 ServerAdmin webmaster@host.example.com<br />
3237 DocumentRoot /www/docs/host.example.com<br />
3238 ServerName host.example.com<br />
3239 ErrorLog logs/host.example.com-error_log<br />
3240 TransferLog logs/host.example.com-access_log<br />
3242 </VirtualHost>
3246 <p>IPv6 addresses must be specified in square brackets because
3247 the optional port number could not be determined otherwise. An
3248 IPv6 example is shown below:</p>
3250 <div class="example"><p><code>
3251 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3252 <span class="indent">
3253 ServerAdmin webmaster@host.example.com<br />
3254 DocumentRoot /www/docs/host.example.com<br />
3255 ServerName host.example.com<br />
3256 ErrorLog logs/host.example.com-error_log<br />
3257 TransferLog logs/host.example.com-access_log<br />
3259 </VirtualHost>
3262 <p>Each Virtual Host must correspond to a different IP address,
3263 different port number or a different host name for the server,
3264 in the former case the server machine must be configured to
3265 accept IP packets for multiple addresses. (If the machine does
3266 not have multiple network interfaces, then this can be
3267 accomplished with the <code>ifconfig alias</code> command -- if
3268 your OS supports it).</p>
3270 <div class="note"><h3>Note</h3>
3271 <p>The use of <code class="directive"><VirtualHost></code> does
3272 <strong>not</strong> affect what addresses Apache listens on. You
3273 may need to ensure that Apache is listening on the correct addresses
3274 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
3277 <p>When using IP-based virtual hosting, the special name
3278 <code>_default_</code> can be specified in
3279 which case this virtual host will match any IP address that is
3280 not explicitly listed in another virtual host. In the absence
3281 of any <code>_default_</code> virtual host the "main" server config,
3282 consisting of all those definitions outside any VirtualHost
3283 section, is used when no IP-match occurs. (But note that any IP
3284 address that matches a <code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code> directive will use neither
3285 the "main" server config nor the <code>_default_</code> virtual host.
3286 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
3287 documentation for further details.)</p>
3289 <p>You can specify a <code>:port</code> to change the port that is
3290 matched. If unspecified then it defaults to the same port as the
3291 most recent <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
3292 statement of the main server. You may also specify <code>:*</code>
3293 to match all ports on that address. (This is recommended when used
3294 with <code>_default_</code>.)</p>
3296 <p>A <code class="directive"><a href="#servername">ServerName</a></code> should be
3297 specified inside each <code class="directive"><VirtualHost></code> block. If it is absent, the
3298 <code class="directive"><a href="#servername">ServerName</a></code> from the "main"
3299 server configuration will be inherited.</p>
3301 <div class="warning"><h3>Security</h3>
3302 <p>See the <a href="../misc/security_tips.html">security tips</a>
3303 document for details on why your security could be compromised if the
3304 directory where log files are stored is writable by anyone other
3305 than the user that starts the server.</p>
3310 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
3311 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3313 <li><a href="../bind.html">Setting
3314 which addresses and ports Apache uses</a></li>
3315 <li><a href="../sections.html">How <Directory>, <Location>
3316 and <Files> sections work</a> for an explanation of how these
3317 different sections are combined when a request is received</li>
3321 <div class="bottomlang">
3322 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
3323 <a href="../en/mod/core.html" title="English"> en </a> |
3324 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
3325 <a href="../tr/mod/core.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
3326 </div><div id="footer">
3327 <p class="apache">Copyright 2009 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>
3328 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>