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-project/">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></p>
28 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
32 <div id="quickview"><h3 class="directives">Directives</h3>
34 <li><img alt="" src="../images/down.gif" /> <a href="#acceptfilter">AcceptFilter</a></li>
35 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
36 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
37 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilterbytype">AddOutputFilterByType</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#allowencodedslashes">AllowEncodedSlashes</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#authname">AuthName</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#authtype">AuthType</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#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="#ifdefine"><IfDefine></a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#limitinternalrecursion">LimitInternalRecursion</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#require">Require</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="#satisfy">Satisfy</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
101 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
102 <div class="directive-section"><h2><a name="AcceptFilter" id="AcceptFilter">AcceptFilter</a> <a name="acceptfilter" id="acceptfilter">Directive</a></h2>
103 <table class="directive">
104 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures optimizations for a Protocol's Listener Sockets</td></tr>
105 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptFilter <var>protocol</var> <var>accept_filter</var></code></td></tr>
106 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
107 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
108 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
109 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1.5 and later</td></tr>
111 <p>This directive enables operating system specific optimizations for a
112 listening socket by the Protocol type. The basic premise is for the
113 kernel to not send a socket to the server process until either data
114 is received or an entire HTTP Request is buffered. Only
115 <a href="http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9">
116 FreeBSD's Accept Filters</a> and Linux's more primitive
117 <code>TCP_DEFER_ACCEPT</code> are currently supported.</p>
119 <p>The default values on FreeBSD are:</p>
120 <div class="example"><p><code>
121 AcceptFilter http httpready <br />
122 AcceptFilter https dataready
125 <p>The <code>httpready</code> accept filter buffers entire HTTP requests at
126 the kernel level. Once an entire request is recieved, the kernel then
127 sends it to the server. See the
128 <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_http&sektion=9">
129 accf_http(9)</a> man page for more details. Since HTTPS requests are
130 encrypted only the <a href="http://www.freebsd.org/cgi/man.cgi?query=accf_data&sektion=9">
131 accf_data(9)</a> filter is used.</p>
133 <p>The default values on Linux are:</p>
134 <div class="example"><p><code>
135 AcceptFilter http data <br />
136 AcceptFilter https data
139 <p>Linux's <code>TCP_DEFER_ACCEPT</code> does not support buffering http
140 requests. Any value besides <code>none</code> will enable
141 <code>TCP_DEFER_ACCEPT</code> on that listener. For more details
143 <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man7/tcp.7.html">
144 tcp(7)</a> man page.</p>
146 <p>Using <code>none</code> for an argument will disable any accept filters
147 for that protocol. This is useful for protocols that require a server
148 send data first, such as <code>nntp</code>:</p>
149 <div class="example"><p><code>AcceptFilter nttp none</code></p></div>
153 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
154 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
155 <table class="directive">
156 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
157 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
158 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
159 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
160 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
161 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
162 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
163 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.30 and later</td></tr>
166 <p>This directive controls whether requests that contain trailing
167 pathname information that follows an actual filename (or
168 non-existent file in an existing directory) will be accepted or
169 rejected. The trailing pathname information can be made
170 available to scripts in the <code>PATH_INFO</code> environment
173 <p>For example, assume the location <code>/test/</code> points to
174 a directory that contains only the single file
175 <code>here.html</code>. Then requests for
176 <code>/test/here.html/more</code> and
177 <code>/test/nothere.html/more</code> both collect
178 <code>/more</code> as <code>PATH_INFO</code>.</p>
180 <p>The three possible arguments for the
181 <code class="directive">AcceptPathInfo</code> directive are:</p>
183 <dt><code>Off</code></dt><dd>A request will only be accepted if it
184 maps to a literal path that exists. Therefore a request with
185 trailing pathname information after the true filename such as
186 <code>/test/here.html/more</code> in the above example will return
187 a 404 NOT FOUND error.</dd>
189 <dt><code>On</code></dt><dd>A request will be accepted if a
190 leading path component maps to a file that exists. The above
191 example <code>/test/here.html/more</code> will be accepted if
192 <code>/test/here.html</code> maps to a valid file.</dd>
194 <dt><code>Default</code></dt><dd>The treatment of requests with
195 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
196 The core handler for normal files defaults to rejecting
197 <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-isa</a>, generally accept
198 <code>PATH_INFO</code> by default.</dd>
201 <p>The primary purpose of the <code>AcceptPathInfo</code>
202 directive is to allow you to override the handler's choice of
203 accepting or rejecting <code>PATH_INFO</code>. This override is required,
204 for example, when you use a <a href="../filter.html">filter</a>, such
205 as <a href="mod_include.html">INCLUDES</a>, to generate content
206 based on <code>PATH_INFO</code>. The core handler would usually reject
207 the request, so you can use the following configuration to enable
210 <div class="example"><p><code>
211 <Files "mypaths.shtml"><br />
212 <span class="indent">
213 Options +Includes<br />
214 SetOutputFilter INCLUDES<br />
215 AcceptPathInfo On<br />
222 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
223 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
224 <table class="directive">
225 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
226 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
227 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
228 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
229 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
230 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
232 <p>While processing a request the server looks for
233 the first existing configuration file from this list of names in
234 every directory of the path to the document, if distributed
235 configuration files are <a href="#allowoverride">enabled for that
236 directory</a>. For example:</p>
238 <div class="example"><p><code>
242 <p>before returning the document
243 <code>/usr/local/web/index.html</code>, the server will read
244 <code>/.acl</code>, <code>/usr/.acl</code>,
245 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
246 for directives, unless they have been disabled with</p>
248 <div class="example"><p><code>
249 <Directory /><br />
250 <span class="indent">
251 AllowOverride None<br />
258 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
259 <li><a href="../configuring.html">Configuration Files</a></li>
260 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
263 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
264 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
265 <table class="directive">
266 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a response
267 content-type is <code>text/plain</code> or <code>text/html</code></td></tr>
268 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
269 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
270 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
271 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
272 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
273 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
275 <p>This directive specifies a default value for the media type
276 charset parameter (the name of a character encoding) to be added
277 to a response if and only if the response's content-type is either
278 <code>text/plain</code> or <code>text/html</code>. This should override
279 any charset specified in the body of the response via a <code>META</code>
280 element, though the exact behavior is often dependent on the user's client
281 configuration. A setting of <code>AddDefaultCharset Off</code>
282 disables this functionality. <code>AddDefaultCharset On</code> enables
283 a default charset of <code>iso-8859-1</code>. Any other value is assumed
284 to be the <var>charset</var> to be used, which should be one of the
285 <a href="http://www.iana.org/assignments/character-sets">IANA registered
286 charset values</a> for use in MIME media types.
289 <div class="example"><p><code>
290 AddDefaultCharset utf-8
293 <p><code class="directive">AddDefaultCharset</code> should only be used when all
294 of the text resources to which it applies are known to be in that
295 character encoding and it is too inconvenient to label their charset
296 individually. One such example is to add the charset parameter
297 to resources containing generated content, such as legacy CGI
298 scripts, that might be vulnerable to cross-site scripting attacks
299 due to user-provided data being included in the output. Note, however,
300 that a better solution is to just fix (or delete) those scripts, since
301 setting a default charset does not protect users that have enabled
302 the "auto-detect character encoding" feature on their browser.</p>
306 <li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</a></code></li>
309 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
310 <div class="directive-section"><h2><a name="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2>
311 <table class="directive">
312 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular MIME-type</td></tr>
313 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
314 <var>MIME-type</var> [<var>MIME-type</var>] ...</code></td></tr>
315 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
316 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
317 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
318 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
319 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.33 and later</td></tr>
321 <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the
322 response <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME-type</a>.</p>
324 <p>The following example uses the <code>DEFLATE</code> filter, which
325 is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all
326 output (either static or dynamic) which is labeled as
327 <code>text/html</code> or <code>text/plain</code> before it is sent
330 <div class="example"><p><code>
331 AddOutputFilterByType DEFLATE text/html text/plain
334 <p>If you want the content to be processed by more than one filter, their
335 names have to be separated by semicolons. It's also possible to use one
336 <code class="directive">AddOutputFilterByType</code> directive for each of
339 <p>The configuration below causes all script output labeled as
340 <code>text/html</code> to be processed at first by the
341 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
344 <div class="example"><p><code>
345 <Location /cgi-bin/><br />
346 <span class="indent">
347 Options Includes<br />
348 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
353 <div class="warning"><h3>Note</h3>
354 <p>Enabling filters with <code class="directive">AddOutputFilterByType</code>
355 may fail partially or completely in some cases. For example, no
356 filters are applied if the <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME-type</a> could not be determined and falls
357 back to the <code class="directive"><a href="#defaulttype">DefaultType</a></code> setting,
358 even if the <code class="directive"><a href="#defaulttype">DefaultType</a></code> is the
361 <p>However, if you want to make sure, that the filters will be
362 applied, assign the content type to a resource explicitly, for
363 example with <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> or
364 <code class="directive"><a href="#forcetype">ForceType</a></code>. Setting the
365 content type within a (non-nph) CGI script is also safe.</p>
367 <p>The by-type output filters are never applied on proxy requests.</p>
372 <li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li>
373 <li><code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code></li>
374 <li><a href="../filter.html">filters</a></li>
377 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
378 <div class="directive-section"><h2><a name="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2>
379 <table class="directive">
380 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed to
381 be passed through</td></tr>
382 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off</code></td></tr>
383 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr>
384 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
385 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
386 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
387 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.46 and later</td></tr>
389 <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs
390 which contain encoded path separators (<code>%2F</code> for <code>/</code>
391 and additionally <code>%5C</code> for <code>\</code> on according systems)
392 to be used. Normally such URLs are refused with a 404 (Not found) error.</p>
394 <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is
395 mostly useful when used in conjunction with <code>PATH_INFO</code>.</p>
397 <div class="note"><h3>Note</h3>
398 <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>.
399 Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on
400 according systems) will be left as such in the otherwise decoded URL
406 <li><code class="directive"><a href="#acceptpathinfo">AcceptPathInfo</a></code></li>
409 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
410 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
411 <table class="directive">
412 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
413 <code>.htaccess</code> files</td></tr>
414 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
415 [<var>directive-type</var>] ...</code></td></tr>
416 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride All</code></td></tr>
417 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
418 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
419 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
421 <p>When the server finds an <code>.htaccess</code> file (as
422 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
423 it needs to know which directives declared in that file can override
424 earlier configuration directives.</p>
426 <div class="note"><h3>Only available in <Directory> sections</h3>
427 <code class="directive">AllowOverride</code> is valid only in
428 <code class="directive"><a href="#directory"><Directory></a></code>
429 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
430 <code class="directive"><a href="#files"><Files></a></code> sections.
433 <p>When this directive is set to <code>None</code>, then
434 <a href="#accessfilename">.htaccess</a> files are completely ignored.
435 In this case, the server will not even attempt to read
436 <code>.htaccess</code> files in the filesystem.</p>
438 <p>When this directive is set to <code>All</code>, then any
439 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
440 <code>.htaccess</code> files.</p>
442 <p>The <var>directive-type</var> can be one of the following
443 groupings of directives.</p>
450 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
451 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
452 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
453 <code class="directive"><a href="#authname">AuthName</a></code>,
454 <code class="directive"><a href="#authtype">AuthType</a></code>, <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code>, <code class="directive"><a href="#require">Require</a></code>, <em>etc.</em>).</dd>
459 Allow use of the directives controlling document types (<code class="directive"><a href="#defaulttype">DefaultType</a></code>, <code class="directive"><a href="#errordocument">ErrorDocument</a></code>, <code class="directive"><a href="#forcetype">ForceType</a></code>, <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>,
460 <code class="directive"><a href="#sethandler">SetHandler</a></code>, <code class="directive"><a href="#setinputfilter">SetInputFilter</a></code>, <code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code>, and
461 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove*
462 directives, <em>etc.</em>), 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>),
463 <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
464 <code class="directive"><a href="../mod/mod_actions.html#action">Action</a></code> from
465 <code class="module"><a href="../mod/mod_actions.html">mod_actions</a></code>.
471 Allow use of the directives controlling directory indexing
472 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
473 <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>,
474 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
475 <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>,
481 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>
483 <dt>Options[=<var>Option</var>,...]</dt>
486 Allow use of the directives controlling specific directory
487 features (<code class="directive"><a href="#options">Options</a></code> and
488 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).
489 An equal sign may be given followed by a comma (but no spaces)
490 separated lists of options that may be set using the <code class="directive"><a href="#options">Options</a></code> command.</dd>
495 <div class="example"><p><code>
496 AllowOverride AuthConfig Indexes
499 <p>In the example above all directives that are neither in the group
500 <code>AuthConfig</code> nor <code>Indexes</code> cause an internal
505 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
506 <li><a href="../configuring.html">Configuration Files</a></li>
507 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
510 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
511 <div class="directive-section"><h2><a name="AuthName" id="AuthName">AuthName</a> <a name="authname" id="authname">Directive</a></h2>
512 <table class="directive">
513 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Authorization realm for use in HTTP
514 authentication</td></tr>
515 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthName <var>auth-domain</var></code></td></tr>
516 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
517 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
518 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
519 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
521 <p>This directive sets the name of the authorization realm for a
522 directory. This realm is given to the client so that the user
523 knows which username and password to send.
524 <code class="directive">AuthName</code> takes a single argument; if the
525 realm name contains spaces, it must be enclosed in quotation
526 marks. It must be accompanied by <code class="directive"><a href="#authtype">AuthType</a></code> and <code class="directive"><a href="#require">Require</a></code> directives, and directives such
527 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> and
528 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> to
533 <div class="example"><p><code>
534 AuthName "Top Secret"
537 <p>The string provided for the <code>AuthName</code> is what will
538 appear in the password dialog provided by most browsers.</p>
542 <li><a href="../howto/auth.html">Authentication, Authorization, and
543 Access Control</a></li>
546 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
547 <div class="directive-section"><h2><a name="AuthType" id="AuthType">AuthType</a> <a name="authtype" id="authtype">Directive</a></h2>
548 <table class="directive">
549 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Type of user authentication</td></tr>
550 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthType Basic|Digest</code></td></tr>
551 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
552 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
553 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
554 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
556 <p>This directive selects the type of user authentication for a
557 directory. Only <code>Basic</code> and <code>Digest</code> are
558 currently implemented.
560 It must be accompanied by <code class="directive"><a href="#authname">AuthName</a></code> and <code class="directive"><a href="#require">Require</a></code> directives, and directives such
561 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> and
562 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> to
567 <li><a href="../howto/auth.html">Authentication, Authorization,
568 and Access Control</a></li>
571 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
572 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
573 <table class="directive">
574 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
576 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
577 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
578 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
579 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
580 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
581 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
583 <p>This directive is used to control how Apache finds the
584 interpreter used to run CGI scripts. For example, setting
585 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
586 cause all CGI script files with a <code>.foo</code> extension to
587 be passed to the FOO interpreter.</p>
590 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
591 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
592 <table class="directive">
593 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of <code>Content-MD5</code> HTTP Response
595 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
596 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
597 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
598 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
599 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
600 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
602 <p>This directive enables the generation of
603 <code>Content-MD5</code> headers as defined in RFC1864
604 respectively RFC2068.</p>
606 <p>MD5 is an algorithm for computing a "message digest"
607 (sometimes called "fingerprint") of arbitrary-length data, with
608 a high degree of confidence that any alterations in the data
609 will be reflected in alterations in the message digest.</p>
611 <p>The <code>Content-MD5</code> header provides an end-to-end
612 message integrity check (MIC) of the entity-body. A proxy or
613 client may check this header for detecting accidental
614 modification of the entity-body in transit. Example header:</p>
616 <div class="example"><p><code>
617 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
620 <p>Note that this can cause performance problems on your server
621 since the message digest is computed on every request (the
622 values are not cached).</p>
624 <p><code>Content-MD5</code> is only sent for documents served
625 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
626 SSI documents, output from CGI scripts, and byte range responses
627 do not have this header.</p>
630 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
631 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
632 <table class="directive">
633 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>MIME content-type that will be sent if the
634 server cannot determine a type in any other way</td></tr>
635 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>MIME-type</var></code></td></tr>
636 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType text/plain</code></td></tr>
637 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
638 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
639 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
640 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
642 <p>There will be times when the server is asked to provide a
643 document whose type cannot be determined by its <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME types</a> mappings.</p>
645 <p>The server must inform the client of the content-type of the
646 document, so in the event of an unknown type it uses the
647 <code>DefaultType</code>. For example:</p>
649 <div class="example"><p><code>
650 DefaultType image/gif
653 <p>would be appropriate for a directory which contained many GIF
654 images with filenames missing the <code>.gif</code> extension.</p>
656 <p>Note that unlike <code class="directive"><a href="#forcetype">ForceType</a></code>, this directive only
657 provides the default mime-type. All other mime-type definitions,
658 including filename extensions, that might identify the media type
659 will override this default.</p>
662 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
663 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
664 <table class="directive">
665 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
666 named file-system directory and sub-directories</td></tr>
667 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
668 ... </Directory></code></td></tr>
669 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
670 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
671 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
673 <p><code class="directive"><Directory></code> and
674 <code></Directory></code> are used to enclose a group of
675 directives that will apply only to the named directory and
676 sub-directories of that directory. Any directive that is allowed
677 in a directory context may be used. <var>Directory-path</var> is
678 either the full path to a directory, or a wild-card string using
679 Unix shell-style matching. In a wild-card string, <code>?</code> matches
680 any single character, and <code>*</code> matches any sequences of
681 characters. You may also use <code>[]</code> character ranges. None
682 of the wildcards match a `/' character, so <code><Directory
683 /*/public_html></code> will not match
684 <code>/home/user/public_html</code>, but <code><Directory
685 /home/*/public_html></code> will match. Example:</p>
687 <div class="example"><p><code>
688 <Directory /usr/local/httpd/htdocs><br />
689 <span class="indent">
690 Options Indexes FollowSymLinks<br />
696 <p>Be careful with the <var>directory-path</var> arguments:
697 They have to literally match the filesystem path which Apache uses
698 to access the files. Directives applied to a particular
699 <code><Directory></code> will not apply to files accessed from
700 that same directory via a different path, such as via different symbolic
704 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular
705 expressions</a> can also be used, with the addition of the
706 <code>~</code> character. For example:</p>
708 <div class="example"><p><code>
709 <Directory ~ "^/www/.*/[0-9]{3}">
712 <p>would match directories in <code>/www/</code> that consisted of
715 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
716 match the directory (or one of its parents) containing a document,
717 then the directives are applied in the order of shortest match
718 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
721 <div class="example"><p><code>
722 <Directory /><br />
723 <span class="indent">
724 AllowOverride None<br />
726 </Directory><br />
728 <Directory /home/><br />
729 <span class="indent">
730 AllowOverride FileInfo<br />
735 <p>for access to the document <code>/home/web/dir/doc.html</code>
739 <li>Apply directive <code>AllowOverride None</code>
740 (disabling <code>.htaccess</code> files).</li>
742 <li>Apply directive <code>AllowOverride FileInfo</code> (for
743 directory <code>/home</code>).</li>
745 <li>Apply any <code>FileInfo</code> directives in
746 <code>/home/.htaccess</code>, <code>/home/web/.htaccess</code> and
747 <code>/home/web/dir/.htaccess</code> in that order.</li>
750 <p>Regular expressions are not considered until after all of the
751 normal sections have been applied. Then all of the regular
752 expressions are tested in the order they appeared in the
753 configuration file. For example, with</p>
755 <div class="example"><p><code>
756 <Directory ~ abc$><br />
757 <span class="indent">
758 # ... directives here ...<br />
763 <p>the regular expression section won't be considered until after
764 all normal <code class="directive"><Directory></code>s and
765 <code>.htaccess</code> files have been applied. Then the regular
766 expression will match on <code>/home/abc/public_html/abc</code> and
767 the corresponding <code class="directive"><Directory></code> will
770 <p><strong>Note that the default Apache access for
771 <code><Directory /></code> is <code>Allow from All</code>.
772 This means that Apache will serve any file mapped from an URL. It is
773 recommended that you change this with a block such
776 <div class="example"><p><code>
777 <Directory /><br />
778 <span class="indent">
779 Order Deny,Allow<br />
785 <p><strong>and then override this for directories you
786 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
787 details.</strong></p>
789 <p>The directory sections occur in the <code>httpd.conf</code> file.
790 <code class="directive"><Directory></code> directives
791 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>
795 <li><a href="../sections.html">How <Directory>,
796 <Location> and <Files> sections work</a> for an
797 explanation of how these different sections are combined when a
798 request is received</li>
801 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
802 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
803 <table class="directive">
804 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
805 file-system directories matching a regular expression and their
806 subdirectories</td></tr>
807 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
808 ... </DirectoryMatch></code></td></tr>
809 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
810 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
811 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
813 <p><code class="directive"><DirectoryMatch></code> and
814 <code></DirectoryMatch></code> are used to enclose a group
815 of directives which will apply only to the named directory and
816 sub-directories of that directory, the same as <code class="directive"><a href="#directory"><Directory></a></code>. However, it
817 takes as an argument a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
818 expression</a>. For example:</p>
820 <div class="example"><p><code>
821 <DirectoryMatch "^/www/(.+/)?[0-9]{3}">
824 <p>would match directories in <code>/www/</code> that consisted of three
829 <li><code class="directive"><a href="#directory"><Directory></a></code> for
830 a description of how regular expressions are mixed in with normal
831 <code class="directive"><Directory></code>s</li>
832 <li><a href="../sections.html">How <Directory>, <Location> and
833 <Files> sections work</a> for an explanation of how these different
834 sections are combined when a request is received</li>
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="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
839 <table class="directive">
840 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
841 from the web</td></tr>
842 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
843 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
844 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</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 sets the directory from which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
849 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
850 path from the requested URL to the document root to make the
851 path to the document. Example:</p>
853 <div class="example"><p><code>
854 DocumentRoot /usr/web
858 <code>http://www.my.host.com/index.html</code> refers to
859 <code>/usr/web/index.html</code>. If the <var>directory-path</var> is
860 not absolute then it is assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
862 <p>The <code class="directive">DocumentRoot</code> should be specified without
863 a trailing slash.</p>
867 <li><a href="../urlmapping.html">Mapping URLs to Filesystem
871 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
872 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
873 <table class="directive">
874 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
875 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
876 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
877 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
878 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
879 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
880 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
882 <p>This directive controls whether the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use
883 memory-mapping if it needs to read the contents of a file during
884 delivery. By default, when the handling of a request requires
885 access to the data within a file -- for example, when delivering a
886 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache
887 memory-maps the file if the OS supports it.</p>
889 <p>This memory-mapping sometimes yields a performance improvement.
890 But in some environments, it is better to disable the memory-mapping
891 to prevent operational problems:</p>
894 <li>On some multiprocessor systems, memory-mapping can reduce the
895 performance of the <code class="program"><a href="../programs/httpd.html">httpd</a></code>.</li>
896 <li>With an NFS-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code>,
897 the <code class="program"><a href="../programs/httpd.html">httpd</a></code> may crash due to a segmentation fault if a file
898 is deleted or truncated while the <code class="program"><a href="../programs/httpd.html">httpd</a></code> has it
902 <p>For server configurations that are vulnerable to these problems,
903 you should disable memory-mapping of delivered files by specifying:</p>
905 <div class="example"><p><code>
909 <p>For NFS mounted files, this feature may be disabled explicitly for
910 the offending files by specifying:</p>
912 <div class="example"><p><code>
913 <Directory "/path-to-nfs-files">
914 <span class="indent">
921 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
922 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
923 <table class="directive">
924 <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>
925 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
926 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile On</code></td></tr>
927 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
928 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
929 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
930 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
931 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later</td></tr>
933 <p>This directive controls whether <code class="program"><a href="../programs/httpd.html">httpd</a></code> may use the
934 sendfile support from the kernel to transmit file contents to the client.
935 By default, when the handling of a request requires no access
936 to the data within a file -- for example, when delivering a
937 static file -- Apache uses sendfile to deliver the file contents
938 without ever reading the file if the OS supports it.</p>
940 <p>This sendfile mechanism avoids separate read and send operations,
941 and buffer allocations. But on some platforms or within some
942 filesystems, it is better to disable this feature to avoid
943 operational problems:</p>
946 <li>Some platforms may have broken sendfile support that the build
947 system did not detect, especially if the binaries were built on
948 another box and moved to such a machine with broken sendfile
950 <li>On Linux the use of sendfile triggers TCP-checksum
951 offloading bugs on certain networking cards when using IPv6.</li>
952 <li>On Linux on Itanium, sendfile may be unable to handle files
953 over 2GB in size.</li>
954 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS or SMB),
955 the kernel may be unable to serve the network file through
959 <p>For server configurations that are vulnerable to these problems,
960 you should disable this feature by specifying:</p>
962 <div class="example"><p><code>
966 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
967 for the offending files by specifying:</p>
969 <div class="example"><p><code>
970 <Directory "/path-to-nfs-files">
971 <span class="indent">
978 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
979 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
980 <table class="directive">
981 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
982 in case of an error</td></tr>
983 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
984 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
985 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
986 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
987 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
988 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Quoting syntax for text messages is different in Apache
991 <p>In the event of a problem or error, Apache can be configured
992 to do one of four things,</p>
995 <li>output a simple hardcoded error message</li>
997 <li>output a customized message</li>
999 <li>redirect to a local <var>URL-path</var> to handle the
1002 <li>redirect to an external <var>URL</var> to handle the
1006 <p>The first option is the default, while options 2-4 are
1007 configured using the <code class="directive">ErrorDocument</code>
1008 directive, which is followed by the HTTP response code and a URL
1009 or a message. Apache will sometimes offer additional information
1010 regarding the problem/error.</p>
1012 <p>URLs can begin with a slash (/) for local web-paths (relative
1013 to the <code class="directive"><a href="#documentroot">DocumentRoot</a></code>), or be a
1014 full URL which the client can resolve. Alternatively, a message
1015 can be provided to be displayed by the browser. Examples:</p>
1017 <div class="example"><p><code>
1018 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
1019 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
1020 ErrorDocument 401 /subscription_info.html<br />
1021 ErrorDocument 403 "Sorry can't allow you access today"
1024 <p>Additionally, the special value <code>default</code> can be used
1025 to specify Apache's simple hardcoded message. While not required
1026 under normal circumstances, <code>default</code> will restore
1027 Apache's simple hardcoded message for configurations that would
1028 otherwise inherit an existing <code class="directive">ErrorDocument</code>.</p>
1030 <div class="example"><p><code>
1031 ErrorDocument 404 /cgi-bin/bad_urls.pl<br /><br />
1032 <Directory /web/docs><br />
1033 <span class="indent">
1034 ErrorDocument 404 default<br />
1039 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
1040 that points to a remote URL (ie. anything with a method such as
1041 <code>http</code> in front of it), Apache will send a redirect to the
1042 client to tell it where to find the document, even if the
1043 document ends up being on the same server. This has several
1044 implications, the most important being that the client will not
1045 receive the original error status code, but instead will
1046 receive a redirect status code. This in turn can confuse web
1047 robots and other clients which try to determine if a URL is
1048 valid using the status code. In addition, if you use a remote
1049 URL in an <code>ErrorDocument 401</code>, the client will not
1050 know to prompt the user for a password since it will not
1051 receive the 401 status code. Therefore, <strong>if you use an
1052 <code>ErrorDocument 401</code> directive then it must refer to a local
1053 document.</strong></p>
1055 <p>Microsoft Internet Explorer (MSIE) will by default ignore
1056 server-generated error messages when they are "too small" and substitute
1057 its own "friendly" error messages. The size threshold varies depending on
1058 the type of error, but in general, if you make your error document
1059 greater than 512 bytes, then MSIE will show the server-generated
1060 error rather than masking it. More information is available in
1061 Microsoft Knowledge Base article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
1063 <p>Although most error messages can be overriden, there are certain
1064 circumstances where the internal messages are used regardless of the
1065 setting of <code class="directive"><a href="#errordocument">ErrorDocument</a></code>. In
1066 particular, if a malformed request is detected, normal request processing
1067 will be immediately halted and the internal error message returned.
1068 This is necessary to guard against security problems caused by
1071 <p>Prior to version 2.0, messages were indicated by prefixing
1072 them with a single unmatched double quote character.</p>
1076 <li><a href="../custom-error.html">documentation of
1077 customizable responses</a></li>
1080 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1081 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
1082 <table class="directive">
1083 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
1084 <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>
1085 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ErrorLog logs/error_log (Unix) ErrorLog logs/error.log (Windows and OS/2)</code></td></tr>
1086 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1087 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1088 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1090 <p>The <code class="directive">ErrorLog</code> directive sets the name of
1091 the file to which the server will log any errors it encounters. If
1092 the <var>file-path</var> is not absolute then it is assumed to be
1093 relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
1095 <div class="example"><h3>Example</h3><p><code>
1096 ErrorLog /var/log/httpd/error_log
1099 <p>If the <var>file-path</var>
1100 begins with a pipe (|) then it is assumed to be a command to spawn
1101 to handle the error log.</p>
1103 <div class="example"><h3>Example</h3><p><code>
1104 ErrorLog "|/usr/local/bin/httpd_errors"
1107 <p>Using <code>syslog</code> instead of a filename enables logging
1108 via syslogd(8) if the system supports it. The default is to use
1109 syslog facility <code>local7</code>, but you can override this by
1110 using the <code>syslog:<var>facility</var></code> syntax where
1111 <var>facility</var> can be one of the names usually documented in
1114 <div class="example"><h3>Example</h3><p><code>
1115 ErrorLog syslog:user
1118 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
1119 document for details on why your security could be compromised
1120 if the directory where log files are stored is writable by
1121 anyone other than the user that starts the server.</p>
1122 <div class="warning"><h3>Note</h3>
1123 <p>When entering a file path on non-Unix platforms, care should be taken
1124 to make sure that only forward slashed are used even though the platform
1125 may allow the use of back slashes. In general it is a good idea to always
1126 use forward slashes throughout the configuration files.</p>
1131 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
1132 <li><a href="../logs.html">Apache Log Files</a></li>
1135 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1136 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
1137 <table class="directive">
1138 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
1139 HTTP response header</td></tr>
1140 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
1141 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag INode MTime Size</code></td></tr>
1142 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1143 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1144 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1145 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1148 The <code class="directive">FileETag</code> directive configures the file
1149 attributes that are used to create the <code>ETag</code> (entity
1150 tag) response header field when the document is based on a file.
1151 (The <code>ETag</code> value is used in cache management to save
1152 network bandwidth.) In Apache 1.3.22 and earlier, the
1153 <code>ETag</code> value was <em>always</em> formed
1154 from the file's inode, size, and last-modified time (mtime). The
1155 <code class="directive">FileETag</code> directive allows you to choose
1156 which of these -- if any -- should be used. The recognized keywords are:
1160 <dt><strong>INode</strong></dt>
1161 <dd>The file's i-node number will be included in the calculation</dd>
1162 <dt><strong>MTime</strong></dt>
1163 <dd>The date and time the file was last modified will be included</dd>
1164 <dt><strong>Size</strong></dt>
1165 <dd>The number of bytes in the file will be included</dd>
1166 <dt><strong>All</strong></dt>
1167 <dd>All available fields will be used. This is equivalent to:
1168 <div class="example"><p><code>FileETag INode MTime Size</code></p></div></dd>
1169 <dt><strong>None</strong></dt>
1170 <dd>If a document is file-based, no <code>ETag</code> field will be
1171 included in the response</dd>
1174 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1175 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1176 which allow changes to be made to the default setting inherited
1177 from a broader scope. Any keyword appearing without such a prefix
1178 immediately and completely cancels the inherited setting.</p>
1180 <p>If a directory's configuration includes
1181 <code>FileETag INode MTime Size</code>, and a
1182 subdirectory's includes <code>FileETag -INode</code>,
1183 the setting for that subdirectory (which will be inherited by
1184 any sub-subdirectories that don't override it) will be equivalent to
1185 <code>FileETag MTime Size</code>.</p>
1188 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1189 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1190 <table class="directive">
1191 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1193 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1194 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1195 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1196 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1197 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1199 <p>The <code class="directive"><Files></code> directive
1200 limits the scope of the enclosed directives by filename. It is comparable
1201 to the <code class="directive"><a href="#directory"><Directory></a></code>
1202 and <code class="directive"><a href="#location"><Location></a></code>
1203 directives. It should be matched with a <code></Files></code>
1204 directive. The directives given within this section will be applied to
1205 any object with a basename (last component of filename) matching the
1206 specified filename. <code class="directive"><Files></code>
1207 sections are processed in the order they appear in the
1208 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1209 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1210 that <code class="directive"><Files></code> can be nested
1211 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1212 portion of the filesystem they apply to.</p>
1214 <p>The <var>filename</var> argument should include a filename, or
1215 a wild-card string, where <code>?</code> matches any single character,
1216 and <code>*</code> matches any sequences of characters.
1217 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1218 can also be used, with the addition of the
1219 <code>~</code> character. For example:</p>
1221 <div class="example"><p><code>
1222 <Files ~ "\.(gif|jpe?g|png)$">
1225 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1228 <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
1229 <code>.htaccess</code> files. This allows users to control access to
1230 their own files, at a file-by-file level.</p>
1235 <li><a href="../sections.html">How <Directory>, <Location>
1236 and <Files> sections work</a> for an explanation of how these
1237 different sections are combined when a request is received</li>
1240 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1241 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1242 <table class="directive">
1243 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1245 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1246 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1247 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1248 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1249 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1251 <p>The <code class="directive"><FilesMatch></code> directive
1252 limits the scope of the enclosed directives by filename, just as the
1253 <code class="directive"><a href="#files"><Files></a></code> directive
1254 does. However, it accepts a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
1255 expression</a>. For example:</p>
1257 <div class="example"><p><code>
1258 <FilesMatch "\.(gif|jpe?g|png)$">
1261 <p>would match most common Internet graphics formats.</p>
1265 <li><a href="../sections.html">How <Directory>, <Location>
1266 and <Files> sections work</a> for an explanation of how these
1267 different sections are combined when a request is received</li>
1270 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1271 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1272 <table class="directive">
1273 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1274 MIME content-type</td></tr>
1275 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>MIME-type</var>|None</code></td></tr>
1276 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1277 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1278 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1279 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1280 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache 2.0</td></tr>
1282 <p>When placed into an <code>.htaccess</code> file or a
1283 <code class="directive"><a href="#directory"><Directory></a></code>, or
1284 <code class="directive"><a href="#location"><Location></a></code> or
1285 <code class="directive"><a href="#files"><Files></a></code>
1286 section, this directive forces all matching files to be served
1287 with the content type identification given by
1288 <var>MIME-type</var>. For example, if you had a directory full of
1289 GIF files, but did not want to label them all with <code>.gif</code>,
1290 you might want to use:</p>
1292 <div class="example"><p><code>
1296 <p>Note that unlike <code class="directive"><a href="#defaulttype">DefaultType</a></code>,
1297 this directive overrides all mime-type associations, including
1298 filename extensions, that might identify the media type.</p>
1300 <p>You can override any <code class="directive">ForceType</code> setting
1301 by using the value of <code>None</code>:</p>
1303 <div class="example"><p><code>
1304 # force all files to be image/gif:<br />
1305 <Location /images><br />
1306 <span class="indent">
1307 ForceType image/gif<br />
1309 </Location><br />
1311 # but normal mime-type associations here:<br />
1312 <Location /images/mixed><br />
1313 <span class="indent">
1314 ForceType None<br />
1320 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1321 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1322 <table class="directive">
1323 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1324 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1325 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1326 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1327 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1328 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1330 <p>This directive enables DNS lookups so that host names can be
1331 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1332 The value <code>Double</code> refers to doing double-reverse
1333 DNS lookup. That is, after a reverse lookup is performed, a forward
1334 lookup is then performed on that result. At least one of the IP
1335 addresses in the forward lookup must match the original
1336 address. (In "tcpwrappers" terminology this is called
1337 <code>PARANOID</code>.)</p>
1339 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1340 used for controlling access by hostname, a double reverse lookup
1341 will be performed. This is necessary for security. Note that the
1342 result of this double-reverse isn't generally available unless you
1343 set <code>HostnameLookups Double</code>. For example, if only
1344 <code>HostnameLookups On</code> and a request is made to an object
1345 that is protected by hostname restrictions, regardless of whether
1346 the double-reverse fails or not, CGIs will still be passed the
1347 single-reverse result in <code>REMOTE_HOST</code>.</p>
1349 <p>The default is <code>Off</code> in order to save the network
1350 traffic for those sites that don't truly need the reverse
1351 lookups done. It is also better for the end users because they
1352 don't have to suffer the extra latency that a lookup entails.
1353 Heavily loaded sites should leave this directive
1354 <code>Off</code>, since DNS lookups can take considerable
1355 amounts of time. The utility <code class="program"><a href="../programs/logresolve.html">logresolve</a></code>, compiled by
1356 default to the <code>bin</code> subdirectory of your installation
1357 directory, can be used to look up host names from logged IP addresses
1361 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1362 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1363 <table class="directive">
1364 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1365 if a test is true at startup</td></tr>
1366 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
1367 </IfDefine></code></td></tr>
1368 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1369 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1370 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1371 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1373 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1374 </code> section is used to mark directives that are conditional. The
1375 directives within an <code class="directive"><IfDefine></code>
1376 section are only processed if the <var>test</var> is true. If <var>
1377 test</var> is false, everything between the start and end markers is
1380 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
1383 <li><var>parameter-name</var></li>
1385 <li><code>!</code><var>parameter-name</var></li>
1388 <p>In the former case, the directives between the start and end
1389 markers are only processed if the parameter named
1390 <var>parameter-name</var> is defined. The second format reverses
1391 the test, and only processes the directives if
1392 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1394 <p>The <var>parameter-name</var> argument is a define as given on
1395 the <code class="program"><a href="../programs/httpd.html">httpd</a></code> command line via <code>-D<var>parameter-</var>
1396 </code>, at the time the server was started.</p>
1398 <p><code class="directive"><IfDefine></code> sections are
1399 nest-able, which can be used to implement simple
1400 multiple-parameter tests. Example:</p>
1402 <div class="example"><p><code>
1403 httpd -DReverseProxy ...<br />
1406 <IfDefine ReverseProxy><br />
1407 <span class="indent">
1408 LoadModule rewrite_module modules/mod_rewrite.so<br />
1409 LoadModule proxy_module modules/libproxy.so<br />
1415 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1416 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
1417 <table class="directive">
1418 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
1419 presence or absence of a specific module</td></tr>
1420 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-file</var>|<var>module-identifier</var>> ...
1421 </IfModule></code></td></tr>
1422 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1423 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1424 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1425 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1426 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Module identifiers are available in version 2.1 and
1429 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1430 section is used to mark directives that are conditional on the presence of
1431 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
1432 is true. If <var>test</var> is false, everything between the start and
1433 end markers is ignored.</p>
1435 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
1438 <li><var>module</var></li>
1440 <li>!<var>module</var></li>
1443 <p>In the former case, the directives between the start and end
1444 markers are only processed if the module named <var>module</var>
1445 is included in Apache -- either compiled in or
1446 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
1447 and only processes the directives if <var>module</var> is
1448 <strong>not</strong> included.</p>
1450 <p>The <var>module</var> argument can be either the module identifier or
1451 the file name of the module, at the time it was compiled. For example,
1452 <code>rewrite_module</code> is the identifier and
1453 <code>mod_rewrite.c</code> is the file name. If a module consists of
1454 several source files, use the name of the file containing the string
1455 <code>STANDARD20_MODULE_STUFF</code>.</p>
1457 <p><code class="directive"><IfModule></code> sections are
1458 nest-able, which can be used to implement simple multiple-module
1461 <div class="note">This section should only be used if you need to have one
1462 configuration file that works whether or not a specific module
1463 is available. In normal operation, directives need not be
1464 placed in <code class="directive"><IfModule></code>
1468 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1469 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
1470 <table class="directive">
1471 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
1472 the server configuration files</td></tr>
1473 <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>
1474 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1475 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1476 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1477 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later</td></tr>
1479 <p>This directive allows inclusion of other configuration files
1480 from within the server configuration files.</p>
1482 <p>Shell-style (<code>fnmatch()</code>) wildcard characters can be used to
1483 include several files at once, in alphabetical order. In
1484 addition, if <code class="directive">Include</code> points to a directory,
1485 rather than a file, Apache will read all files in that directory
1486 and any subdirectory. But including entire directories is not
1487 recommended, because it is easy to accidentally leave temporary
1488 files in a directory that can cause <code class="program"><a href="../programs/httpd.html">httpd</a></code> to
1491 <p>The file path specified may be an absolute path, or may be relative
1492 to the <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
1496 <div class="example"><p><code>
1497 Include /usr/local/apache2/conf/ssl.conf<br />
1498 Include /usr/local/apache2/conf/vhosts/*.conf
1501 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
1503 <div class="example"><p><code>
1504 Include conf/ssl.conf<br />
1505 Include conf/vhosts/*.conf
1508 <p>Running <code>apachectl configtest</code> will give you a list
1509 of the files that are being processed during the configuration
1512 <div class="example"><p><code>
1513 root@host# apachectl configtest<br />
1514 Processing config file: /usr/local/apache2/conf/ssl.conf<br />
1515 Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf<br />
1516 Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf<br />
1522 <li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li>
1525 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1526 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
1527 <table class="directive">
1528 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
1529 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
1530 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
1531 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1532 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1533 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1535 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1536 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1537 which allow multiple requests to be sent over the same TCP
1538 connection. In some cases this has been shown to result in an
1539 almost 50% speedup in latency times for HTML documents with
1540 many images. To enable Keep-Alive connections, set
1541 <code>KeepAlive On</code>.</p>
1543 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1544 used if they are specifically requested by a client. In
1545 addition, a Keep-Alive connection with an HTTP/1.0 client can
1546 only be used when the length of the content is known in
1547 advance. This implies that dynamic content such as CGI output,
1548 SSI pages, and server-generated directory listings will
1549 generally not use Keep-Alive connections to HTTP/1.0 clients.
1550 For HTTP/1.1 clients, persistent connections are the default
1551 unless otherwise specified. If the client requests it, chunked
1552 encoding will be used in order to send content of unknown
1553 length over persistent connections.</p>
1557 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
1560 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1561 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
1562 <table class="directive">
1563 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
1564 requests on a persistent connection</td></tr>
1565 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>seconds</var></code></td></tr>
1566 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 5</code></td></tr>
1567 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1568 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1569 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1571 <p>The number of seconds Apache will wait for a subsequent
1572 request before closing the connection. Once a request has been
1573 received, the timeout value specified by the
1574 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
1576 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
1577 may cause performance problems in heavily loaded servers. The
1578 higher the timeout, the more server processes will be kept
1579 occupied waiting on connections with idle clients.</p>
1582 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1583 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
1584 <table class="directive">
1585 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
1587 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
1588 </Limit></code></td></tr>
1589 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1590 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1591 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1592 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1594 <p>Access controls are normally effective for
1595 <strong>all</strong> access methods, and this is the usual
1596 desired behavior. <strong>In the general case, access control
1597 directives should not be placed within a
1598 <code class="directive"><Limit></code> section.</strong></p>
1600 <p>The purpose of the <code class="directive"><Limit></code>
1601 directive is to restrict the effect of the access controls to the
1602 nominated HTTP methods. For all other methods, the access
1603 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
1604 effect</strong>. The following example applies the access control
1605 only to the methods <code>POST</code>, <code>PUT</code>, and
1606 <code>DELETE</code>, leaving all other methods unprotected:</p>
1608 <div class="example"><p><code>
1609 <Limit POST PUT DELETE><br />
1610 <span class="indent">
1611 Require valid-user<br />
1616 <p>The method names listed can be one or more of: <code>GET</code>,
1617 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1618 <code>CONNECT</code>, <code>OPTIONS</code>,
1619 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1620 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1621 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1622 case-sensitive.</strong> If <code>GET</code> is used it will also
1623 restrict <code>HEAD</code> requests. The <code>TRACE</code> method
1624 cannot be limited.</p>
1626 <div class="warning">A <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section should always be
1627 used in preference to a <code class="directive"><a href="#limit"><Limit></a></code> section when restricting access,
1628 since a <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> section provides protection
1629 against arbitrary methods.</div>
1633 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1634 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
1635 <table class="directive">
1636 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
1637 except the named ones</td></tr>
1638 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1639 </LimitExcept></code></td></tr>
1640 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1641 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1643 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1645 <p><code class="directive"><LimitExcept></code> and
1646 <code></LimitExcept></code> are used to enclose
1647 a group of access control directives which will then apply to any
1648 HTTP access method <strong>not</strong> listed in the arguments;
1649 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
1650 both standard and nonstandard/unrecognized methods. See the
1651 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
1655 <div class="example"><p><code>
1656 <LimitExcept POST GET><br />
1657 <span class="indent">
1658 Require valid-user<br />
1660 </LimitExcept>
1665 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1666 <div class="directive-section"><h2><a name="LimitInternalRecursion" id="LimitInternalRecursion">LimitInternalRecursion</a> <a name="limitinternalrecursion" id="limitinternalrecursion">Directive</a></h2>
1667 <table class="directive">
1668 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine maximum number of internal redirects and nested
1669 subrequests</td></tr>
1670 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitInternalRecursion <var>number</var> [<var>number</var>]</code></td></tr>
1671 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitInternalRecursion 10</code></td></tr>
1672 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1673 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1674 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1675 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.47 and later</td></tr>
1677 <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
1678 redirects the original request to a CGI script. A subrequest is Apache's
1679 mechanism to find out what would happen for some URI if it were requested.
1680 For example, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> uses subrequests to look for the
1681 files listed in the <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
1684 <p><code class="directive">LimitInternalRecursion</code> prevents the server
1685 from crashing when entering an infinite loop of internal redirects or
1686 subrequests. Such loops are usually caused by misconfigurations.</p>
1688 <p>The directive stores two different limits, which are evaluated on
1689 per-request basis. The first <var>number</var> is the maximum number of
1690 internal redirects, that may follow each other. The second <var>number</var>
1691 determines, how deep subrequests may be nested. If you specify only one
1692 <var>number</var>, it will be assigned to both limits.</p>
1694 <div class="example"><h3>Example</h3><p><code>
1695 LimitInternalRecursion 5
1699 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1700 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
1701 <table class="directive">
1702 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
1703 from the client</td></tr>
1704 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
1705 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
1706 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1707 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1708 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1709 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1711 <p>This directive specifies the number of <var>bytes</var> from 0
1712 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1715 <p>The <code class="directive">LimitRequestBody</code> directive allows
1716 the user to set a limit on the allowed size of an HTTP request
1717 message body within the context in which the directive is given
1718 (server, per-directory, per-file or per-location). If the client
1719 request exceeds that limit, the server will return an error
1720 response instead of servicing the request. The size of a normal
1721 request message body will vary greatly depending on the nature of
1722 the resource and the methods allowed on that resource. CGI scripts
1723 typically use the message body for retrieving form information.
1724 Implementations of the <code>PUT</code> method will require
1725 a value at least as large as any representation that the server
1726 wishes to accept for that resource.</p>
1728 <p>This directive gives the server administrator greater
1729 control over abnormal client request behavior, which may be
1730 useful for avoiding some forms of denial-of-service
1733 <p>If, for example, you are permitting file upload to a particular
1734 location, and wish to limit the size of the uploaded file to 100K,
1735 you might use the following directive:</p>
1737 <div class="example"><p><code>
1738 LimitRequestBody 102400
1743 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1744 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
1745 <table class="directive">
1746 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
1747 will be accepted from the client</td></tr>
1748 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
1749 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
1750 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1751 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1752 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1754 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1755 32767. The default value is defined by the compile-time
1756 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1759 <p>The <code class="directive">LimitRequestFields</code> directive allows
1760 the server administrator to modify the limit on the number of
1761 request header fields allowed in an HTTP request. A server needs
1762 this value to be larger than the number of fields that a normal
1763 client request might include. The number of request header fields
1764 used by a client rarely exceeds 20, but this may vary among
1765 different client implementations, often depending upon the extent
1766 to which a user has configured their browser to support detailed
1767 content negotiation. Optional HTTP extensions are often expressed
1768 using request header fields.</p>
1770 <p>This directive gives the server administrator greater
1771 control over abnormal client request behavior, which may be
1772 useful for avoiding some forms of denial-of-service attacks.
1773 The value should be increased if normal clients see an error
1774 response from the server that indicates too many fields were
1775 sent in the request.</p>
1779 <div class="example"><p><code>
1780 LimitRequestFields 50
1785 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1786 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
1787 <table class="directive">
1788 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
1790 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldsize <var>bytes</var></code></td></tr>
1791 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldsize 8190</code></td></tr>
1792 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1793 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1794 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1796 <p>This directive specifies the number of <var>bytes</var>
1797 that will be allowed in an HTTP request header.</p>
1799 <p>The <code class="directive">LimitRequestFieldSize</code> directive
1800 allows the server administrator to reduce or increase the limit
1801 on the allowed size of an HTTP request header field. A server
1802 needs this value to be large enough to hold any one header field
1803 from a normal client request. The size of a normal request header
1804 field will vary greatly among different client implementations,
1805 often depending upon the extent to which a user has configured
1806 their browser to support detailed content negotiation. SPNEGO
1807 authentication headers can be up to 12392 bytes.</p>
1809 <p>This directive gives the server administrator greater
1810 control over abnormal client request behavior, which may be
1811 useful for avoiding some forms of denial-of-service attacks.</p>
1815 <div class="example"><p><code>
1816 LimitRequestFieldSize 4094
1819 <div class="note">Under normal conditions, the value should not be changed from
1824 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1825 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
1826 <table class="directive">
1827 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
1828 from the client</td></tr>
1829 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
1830 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
1831 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1832 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1833 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1835 <p>This directive sets the number of <var>bytes</var> that will be
1836 allowed on the HTTP request-line.</p>
1838 <p>The <code class="directive">LimitRequestLine</code> directive allows
1839 the server administrator to reduce or increase the limit on the allowed size
1840 of a client's HTTP request-line. Since the request-line consists of the
1841 HTTP method, URI, and protocol version, the
1842 <code class="directive">LimitRequestLine</code> directive places a
1843 restriction on the length of a request-URI allowed for a request
1844 on the server. A server needs this value to be large enough to
1845 hold any of its resource names, including any information that
1846 might be passed in the query part of a <code>GET</code> request.</p>
1848 <p>This directive gives the server administrator greater
1849 control over abnormal client request behavior, which may be
1850 useful for avoiding some forms of denial-of-service attacks.</p>
1854 <div class="example"><p><code>
1855 LimitRequestLine 4094
1858 <div class="note">Under normal conditions, the value should not be changed from
1862 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1863 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
1864 <table class="directive">
1865 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
1866 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
1867 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
1868 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1869 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1870 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1871 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1873 <p>Limit (in bytes) on maximum size of an XML-based request
1874 body. A value of <code>0</code> will disable any checking.</p>
1878 <div class="example"><p><code>
1879 LimitXMLRequestBody 0
1884 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1885 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
1886 <table class="directive">
1887 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
1889 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
1890 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
1891 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1892 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1893 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1895 <p>The <code class="directive"><Location></code> directive
1896 limits the scope of the enclosed directives by URL. It is similar to the
1897 <code class="directive"><a href="#directory"><Directory></a></code>
1898 directive, and starts a subsection which is terminated with a
1899 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
1900 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1901 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
1903 <p><code class="directive"><Location></code> sections operate
1904 completely outside the filesystem. This has several consequences.
1905 Most importantly, <code class="directive"><Location></code>
1906 directives should not be used to control access to filesystem
1907 locations. Since several different URLs may map to the same
1908 filesystem location, such access controls may by circumvented.</p>
1910 <div class="note"><h3>When to use <code class="directive"><Location></code></h3>
1912 <p>Use <code class="directive"><Location></code> to apply
1913 directives to content that lives outside the filesystem. For
1914 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
1915 <code><Location /></code>, which is an easy way to
1916 apply a configuration to the entire server.</p>
1919 <p>For all origin (non-proxy) requests, the URL to be matched is a
1920 URL-path of the form <code>/path/</code>. No scheme, hostname,
1921 port, or query string may be included. For proxy requests, the
1922 URL to be matched is of the form
1923 <code>scheme://servername/path</code>, and you must include the
1926 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1927 any single character, and <code>*</code> matches any sequences of
1930 <p><a class="glossarylink" href="../glossary.html#regex" title="see glossary">Regular expressions</a>
1931 can also be used, with the addition of the
1932 <code>~</code> character. For example:</p>
1934 <div class="example"><p><code>
1935 <Location ~ "/(extra|special)/data">
1938 <p>would match URLs that contained the substring <code>/extra/data</code>
1939 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
1940 identical to the regex version of <code class="directive"><Location></code>.</p>
1942 <p>The <code class="directive"><Location></code>
1943 functionality is especially useful when combined with the
1944 <code class="directive"><a href="#sethandler">SetHandler</a></code>
1945 directive. For example, to enable status requests, but allow them
1946 only from browsers at <code>foo.com</code>, you might use:</p>
1948 <div class="example"><p><code>
1949 <Location /status><br />
1950 <span class="indent">
1951 SetHandler server-status<br />
1952 Order Deny,Allow<br />
1954 Allow from .foo.com<br />
1959 <div class="note"><h3>Note about / (slash)</h3>
1960 <p>The slash character has special meaning depending on where in a
1961 URL it appears. People may be used to its behavior in the filesystem
1962 where multiple adjacent slashes are frequently collapsed to a single
1963 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
1964 <code>/home/foo</code>). In URL-space this is not necessarily true.
1965 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
1966 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
1967 slashes if that is your intention.</p>
1969 <p>For example, <code><LocationMatch ^/abc></code> would match
1970 the request URL <code>/abc</code> but not the request URL <code>
1971 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
1972 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
1973 implicitly match multiple slashes with a single slash. For example,
1974 if you specify <code><Location /abc/def></code> and the
1975 request is to <code>/abc//def</code> then it will match.</p>
1980 <li><a href="../sections.html">How <Directory>, <Location>
1981 and <Files> sections work</a> for an explanation of how these
1982 different sections are combined when a request is received</li>
1985 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1986 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
1987 <table class="directive">
1988 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
1989 matching URLs</td></tr>
1990 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
1991 <var>regex</var>> ... </LocationMatch></code></td></tr>
1992 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1993 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1994 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1996 <p>The <code class="directive"><LocationMatch></code> directive
1997 limits the scope of the enclosed directives by URL, in an identical manner
1998 to <code class="directive"><a href="#location"><Location></a></code>. However,
1999 it takes a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
2000 as an argument instead of a simple string. For example:</p>
2002 <div class="example"><p><code>
2003 <LocationMatch "/(extra|special)/data">
2006 <p>would match URLs that contained the substring <code>/extra/data</code>
2007 or <code>/special/data</code>.</p>
2011 <li><a href="../sections.html">How <Directory>, <Location>
2012 and <Files> sections work</a> for an explanation of how these
2013 different sections are combined when a request is received</li>
2016 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2017 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
2018 <table class="directive">
2019 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
2020 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>level</var></code></td></tr>
2021 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
2022 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2023 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2024 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2026 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
2027 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
2028 <var>level</var>s are available, in order of decreasing
2031 <table class="bordered">
2034 <th><strong>Level</strong> </th>
2036 <th><strong>Description</strong> </th>
2038 <th><strong>Example</strong> </th>
2042 <td><code>emerg</code> </td>
2044 <td>Emergencies - system is unusable.</td>
2046 <td>"Child cannot open lock file. Exiting"</td>
2050 <td><code>alert</code> </td>
2052 <td>Action must be taken immediately.</td>
2054 <td>"getpwuid: couldn't determine user name from uid"</td>
2058 <td><code>crit</code> </td>
2060 <td>Critical Conditions.</td>
2062 <td>"socket: Failed to get a socket, exiting child"</td>
2066 <td><code>error</code> </td>
2068 <td>Error conditions.</td>
2070 <td>"Premature end of script headers"</td>
2074 <td><code>warn</code> </td>
2076 <td>Warning conditions.</td>
2078 <td>"child process 1234 did not exit, sending another
2083 <td><code>notice</code> </td>
2085 <td>Normal but significant condition.</td>
2087 <td>"httpd: caught SIGBUS, attempting to dump core in
2092 <td><code>info</code> </td>
2094 <td>Informational.</td>
2096 <td>"Server seems busy, (you may need to increase
2097 StartServers, or Min/MaxSpareServers)..."</td>
2101 <td><code>debug</code> </td>
2103 <td>Debug-level messages</td>
2105 <td>"Opening config file ..."</td>
2109 <p>When a particular level is specified, messages from all
2110 other levels of higher significance will be reported as well.
2111 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
2112 then messages with log levels of <code>notice</code> and
2113 <code>warn</code> will also be posted.</p>
2115 <p>Using a level of at least <code>crit</code> is
2120 <div class="example"><p><code>
2124 <div class="note"><h3>Note</h3>
2125 <p>When logging to a regular file messages of the level
2126 <code>notice</code> cannot be suppressed and thus are always
2127 logged. However, this doesn't apply when logging is done
2128 using <code>syslog</code>.</p>
2132 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2133 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
2134 <table class="directive">
2135 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
2136 connection</td></tr>
2137 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
2138 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
2139 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2140 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2141 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2143 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
2144 limits the number of requests allowed per connection when
2145 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
2146 set to <code>0</code>, unlimited requests will be allowed. We
2147 recommend that this setting be kept to a high value for maximum
2148 server performance.</p>
2152 <div class="example"><p><code>
2153 MaxKeepAliveRequests 500
2157 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2158 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
2159 <table class="directive">
2160 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Designates an IP address for name-virtual
2162 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
2163 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2164 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2165 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2167 <p>The <code class="directive">NameVirtualHost</code> directive is a
2168 required directive if you want to configure <a href="../vhosts/">name-based virtual hosts</a>.</p>
2170 <p>Although <var>addr</var> can be hostname it is recommended
2171 that you always use an IP address, e.g.</p>
2173 <div class="example"><p><code>
2174 NameVirtualHost 111.22.33.44
2177 <p>With the <code class="directive">NameVirtualHost</code> directive you
2178 specify the IP address on which the server will receive requests
2179 for the name-based virtual hosts. This will usually be the address
2180 to which your name-based virtual host names resolve. In cases
2181 where a firewall or other proxy receives the requests and forwards
2182 them on a different IP address to the server, you must specify the
2183 IP address of the physical interface on the machine which will be
2184 servicing the requests. If you have multiple name-based hosts on
2185 multiple addresses, repeat the directive for each address.</p>
2187 <div class="note"><h3>Note</h3>
2188 <p>Note, that the "main server" and any <code>_default_</code> servers
2189 will <strong>never</strong> be served for a request to a
2190 <code class="directive">NameVirtualHost</code> IP address (unless for some
2191 reason you specify <code class="directive">NameVirtualHost</code> but then
2192 don't define any <code class="directive">VirtualHost</code>s for that
2196 <p>Optionally you can specify a port number on which the
2197 name-based virtual hosts should be used, e.g.</p>
2199 <div class="example"><p><code>
2200 NameVirtualHost 111.22.33.44:8080
2203 <p>IPv6 addresses must be enclosed in square brackets, as shown
2204 in the following example:</p>
2206 <div class="example"><p><code>
2207 NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
2210 <p>To receive requests on all interfaces, you can use an argument of
2213 <div class="example"><p><code>
2217 <div class="note"><h3>Argument to <code class="directive"><VirtualHost></code>
2219 <p>Note that the argument to the <code class="directive"><VirtualHost></code> directive must
2220 exactly match the argument to the <code class="directive">NameVirtualHost</code> directive.</p>
2222 <div class="example"><p><code>
2223 NameVirtualHost 1.2.3.4<br />
2224 <VirtualHost 1.2.3.4><br />
2226 </VirtualHost><br />
2232 <li><a href="../vhosts/">Virtual Hosts
2233 documentation</a></li>
2236 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2237 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
2238 <table class="directive">
2239 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
2241 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
2242 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
2243 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options All</code></td></tr>
2244 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2245 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
2246 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2247 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2249 <p>The <code class="directive">Options</code> directive controls which
2250 server features are available in a particular directory.</p>
2252 <p><var>option</var> can be set to <code>None</code>, in which
2253 case none of the extra features are enabled, or one or more of
2257 <dt><code>All</code></dt>
2259 <dd>All options except for <code>MultiViews</code>. This is the default
2262 <dt><code>ExecCGI</code></dt>
2265 Execution of CGI scripts using <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>
2268 <dt><code>FollowSymLinks</code></dt>
2272 The server will follow symbolic links in this directory.
2274 <p>Even though the server follows the symlink it does <em>not</em>
2275 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
2276 <p>Note also, that this option <strong>gets ignored</strong> if set
2277 inside a <code class="directive"><a href="#location"><Location></a></code>
2281 <dt><code>Includes</code></dt>
2284 Server-side includes provided by <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>
2287 <dt><code>IncludesNOEXEC</code></dt>
2291 Server-side includes are permitted, but the <code>#exec
2292 cmd</code> and <code>#exec cgi</code> are disabled. It is still
2293 possible to <code>#include virtual</code> CGI scripts from
2294 <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>ed
2297 <dt><code>Indexes</code></dt>
2300 If a URL which maps to a directory is requested, and there
2301 is no <code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code>
2302 (<em>e.g.</em>, <code>index.html</code>) in that directory, then
2303 <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> will return a formatted listing
2304 of the directory.</dd>
2306 <dt><code>MultiViews</code></dt>
2309 <a href="../content-negotiation.html">Content negotiated</a>
2310 "MultiViews" are allowed using
2311 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>.</dd>
2313 <dt><code>SymLinksIfOwnerMatch</code></dt>
2315 <dd>The server will only follow symbolic links for which the
2316 target file or directory is owned by the same user id as the
2319 <div class="note"><h3>Note</h3> This option gets ignored if
2320 set inside a <code class="directive"><a href="#location"><Location></a></code> section.</div>
2324 <p>Normally, if multiple <code class="directive">Options</code> could
2325 apply to a directory, then the most specific one is used and
2326 others are ignored; the options are not merged. (See <a href="../sections.html#mergin">how sections are merged</a>.)
2327 However if <em>all</em> the options on the
2328 <code class="directive">Options</code> directive are preceded by a
2329 <code>+</code> or <code>-</code> symbol, the options are
2330 merged. Any options preceded by a <code>+</code> are added to the
2331 options currently in force, and any options preceded by a
2332 <code>-</code> are removed from the options currently in
2335 <div class="warning"><h3>Warning</h3>
2336 <p>Mixing <code class="directive">Options</code> with a <code>+</code> or
2337 <code>-</code> with those without is not valid syntax, and is likely
2338 to cause unexpected results.</p>
2341 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2343 <div class="example"><p><code>
2344 <Directory /web/docs><br />
2345 <span class="indent">
2346 Options Indexes FollowSymLinks<br />
2348 </Directory><br />
2350 <Directory /web/docs/spec><br />
2351 <span class="indent">
2352 Options Includes<br />
2357 <p>then only <code>Includes</code> will be set for the
2358 <code>/web/docs/spec</code> directory. However if the second
2359 <code class="directive">Options</code> directive uses the <code>+</code> and
2360 <code>-</code> symbols:</p>
2362 <div class="example"><p><code>
2363 <Directory /web/docs><br />
2364 <span class="indent">
2365 Options Indexes FollowSymLinks<br />
2367 </Directory><br />
2369 <Directory /web/docs/spec><br />
2370 <span class="indent">
2371 Options +Includes -Indexes<br />
2376 <p>then the options <code>FollowSymLinks</code> and
2377 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2380 <div class="note"><h3>Note</h3>
2381 <p>Using <code>-IncludesNOEXEC</code> or
2382 <code>-Includes</code> disables server-side includes completely
2383 regardless of the previous setting.</p>
2386 <p>The default in the absence of any other settings is
2387 <code>All</code>.</p>
2390 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2391 <div class="directive-section"><h2><a name="Require" id="Require">Require</a> <a name="require" id="require">Directive</a></h2>
2392 <table class="directive">
2393 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Selects which authenticated users can access
2394 a resource</td></tr>
2395 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Require <var>entity-name</var> [<var>entity-name</var>] ...</code></td></tr>
2396 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2397 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
2398 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2399 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2401 <p>This directive selects which authenticated users can access
2402 a resource. The allowed syntaxes are:</p>
2405 <dt><code>Require user <var>userid</var> [<var>userid</var>]
2407 <dd>Only the named users can access the resource.</dd>
2409 <dt><code>Require group <var>group-name</var> [<var>group-name</var>]
2411 <dd>Only users in the named groups can access the resource.</dd>
2413 <dt><code>Require valid-user</code></dt>
2414 <dd>All valid users can access the resource.</dd>
2417 <p><code class="directive">Require</code> must be accompanied by
2418 <code class="directive"><a href="#authname">AuthName</a></code> and <code class="directive"><a href="#authtype">AuthType</a></code> directives, and directives such
2419 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code>
2420 and <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> (to
2421 define users and groups) in order to work correctly. Example:</p>
2423 <div class="example"><p><code>
2424 AuthType Basic<br />
2425 AuthName "Restricted Resource"<br />
2426 AuthUserFile /web/users<br />
2427 AuthGroupFile /web/groups<br />
2431 <p>Access controls which are applied in this way are effective for
2432 <strong>all</strong> methods. <strong>This is what is normally
2433 desired.</strong> If you wish to apply access controls only to
2434 specific methods, while leaving other methods unprotected, then
2435 place the <code class="directive">Require</code> statement into a
2436 <code class="directive"><a href="#limit"><Limit></a></code>
2441 <li><code class="directive"><a href="#satisfy">Satisfy</a></code></li>
2442 <li><code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code></li>
2445 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2446 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
2447 <table class="directive">
2448 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
2449 by Apache children</td></tr>
2450 <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>
2451 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2452 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2453 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2454 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2455 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2457 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2458 resource limit for all processes and the second parameter sets
2459 the maximum resource limit. Either parameter can be a number,
2460 or <code>max</code> to indicate to the server that the limit should
2461 be set to the maximum allowed by the operating system
2462 configuration. Raising the maximum resource limit requires that
2463 the server is running as <code>root</code>, or in the initial startup
2466 <p>This applies to processes forked off from Apache children
2467 servicing requests, not the Apache children themselves. This
2468 includes CGI scripts and SSI exec commands, but not any
2469 processes forked off from the Apache parent such as piped
2472 <p>CPU resource limits are expressed in seconds per
2477 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2478 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2481 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2482 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
2483 <table class="directive">
2484 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
2485 by Apache children</td></tr>
2486 <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>
2487 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2488 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2489 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2490 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2491 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2493 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2494 resource limit for all processes and the second parameter sets
2495 the maximum resource limit. Either parameter can be a number,
2496 or <code>max</code> to indicate to the server that the limit should
2497 be set to the maximum allowed by the operating system
2498 configuration. Raising the maximum resource limit requires that
2499 the server is running as <code>root</code>, or in the initial startup
2502 <p>This applies to processes forked off from Apache children
2503 servicing requests, not the Apache children themselves. This
2504 includes CGI scripts and SSI exec commands, but not any
2505 processes forked off from the Apache parent such as piped
2508 <p>Memory resource limits are expressed in bytes per
2513 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2514 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2517 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2518 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
2519 <table class="directive">
2520 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
2521 processes launched by Apache children</td></tr>
2522 <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>
2523 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2524 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2525 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2526 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2527 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2529 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2530 resource limit for all processes and the second parameter sets
2531 the maximum resource limit. Either parameter can be a number,
2532 or <code>max</code> to indicate to the server that the limit
2533 should be set to the maximum allowed by the operating system
2534 configuration. Raising the maximum resource limit requires that
2535 the server is running as <code>root</code>, or in the initial startup
2538 <p>This applies to processes forked off from Apache children
2539 servicing requests, not the Apache children themselves. This
2540 includes CGI scripts and SSI exec commands, but not any
2541 processes forked off from the Apache parent such as piped
2544 <p>Process limits control the number of processes per user.</p>
2546 <div class="note"><h3>Note</h3>
2547 <p>If CGI processes are <strong>not</strong> running
2548 under user ids other than the web server user id, this directive
2549 will limit the number of processes that the server itself can
2550 create. Evidence of this situation will be indicated by
2551 <strong><code>cannot fork</code></strong> messages in the
2552 <code>error_log</code>.</p>
2557 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2558 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2561 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2562 <div class="directive-section"><h2><a name="Satisfy" id="Satisfy">Satisfy</a> <a name="satisfy" id="satisfy">Directive</a></h2>
2563 <table class="directive">
2564 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Interaction between host-level access control and
2565 user authentication</td></tr>
2566 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Satisfy Any|All</code></td></tr>
2567 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Satisfy All</code></td></tr>
2568 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2569 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
2570 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2571 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2572 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Influenced by <code class="directive"><a href="#limit"><Limit></a></code> and <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> in version 2.0.51 and
2575 <p>Access policy if both <code class="directive"><a href="../mod/mod_authz_host.html#allow">Allow</a></code> and <code class="directive"><a href="#require">Require</a></code> used. The parameter can be
2576 either <code>All</code> or <code>Any</code>. This directive is only
2577 useful if access to a particular area is being restricted by both
2578 username/password <em>and</em> client host address. In this case
2579 the default behavior (<code>All</code>) is to require that the client
2580 passes the address access restriction <em>and</em> enters a valid
2581 username and password. With the <code>Any</code> option the client will be
2582 granted access if they either pass the host restriction or enter a
2583 valid username and password. This can be used to password restrict
2584 an area, but to let clients from particular addresses in without
2585 prompting for a password.</p>
2587 <p>For example, if you wanted to let people on your network have
2588 unrestricted access to a portion of your website, but require that
2589 people outside of your network provide a password, you could use a
2590 configuration similar to the following:</p>
2592 <div class="example"><p><code>
2593 Require valid-user<br />
2594 Allow from 192.168.1<br />
2598 <p>Since version 2.0.51 <code class="directive">Satisfy</code> directives can
2599 be restricted to particular methods by <code class="directive"><a href="#limit"><Limit></a></code> and <code class="directive"><a href="#limitexcept"><LimitExcept></a></code> sections.</p>
2603 <li><code class="directive"><a href="../mod/mod_authz_host.html#allow">Allow</a></code></li>
2604 <li><code class="directive"><a href="#require">Require</a></code></li>
2607 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2608 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
2609 <table class="directive">
2610 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
2612 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
2613 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
2614 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2615 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2616 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2617 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2618 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only;
2619 option <code>Registry-Strict</code> is available in Apache 2.0 and
2622 <p>This directive is used to control how Apache finds the
2623 interpreter used to run CGI scripts. The default setting is
2624 <code>Script</code>. This causes Apache to use the interpreter pointed to
2625 by the shebang line (first line, starting with <code>#!</code>) in the
2626 script. On Win32 systems this line usually looks like:</p>
2628 <div class="example"><p><code>
2629 #!C:/Perl/bin/perl.exe
2632 <p>or, if <code>perl</code> is in the <code>PATH</code>, simply:</p>
2634 <div class="example"><p><code>
2638 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2639 cause the Windows Registry tree <code>HKEY_CLASSES_ROOT</code> to be
2640 searched using the script file extension (e.g., <code>.pl</code>) as a
2641 search key. The command defined by the registry subkey
2642 <code>Shell\ExecCGI\Command</code> or, if it does not exist, by the subkey
2643 <code>Shell\Open\Command</code> is used to open the script file. If the
2644 registry keys cannot be found, Apache falls back to the behavior of the
2645 <code>Script</code> option.</p>
2647 <div class="warning"><h3>Security</h3>
2648 <p>Be careful when using <code>ScriptInterpreterSource
2649 Registry</code> with <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>'ed directories, because
2650 Apache will try to execute <strong>every</strong> file within this
2651 directory. The <code>Registry</code> setting may cause undesired
2652 program calls on files which are typically not executed. For
2653 example, the default open command on <code>.htm</code> files on
2654 most Windows systems will execute Microsoft Internet Explorer, so
2655 any HTTP request for an <code>.htm</code> file existing within the
2656 script directory would start the browser in the background on the
2657 server. This is a good way to crash your system within a minute or
2661 <p>The option <code>Registry-Strict</code> which is new in Apache
2662 2.0 does the same thing as <code>Registry</code> but uses only the
2663 subkey <code>Shell\ExecCGI\Command</code>. The
2664 <code>ExecCGI</code> key is not a common one. It must be
2665 configured manually in the windows registry and hence prevents
2666 accidental program calls on your system.</p>
2669 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2670 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
2671 <table class="directive">
2672 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
2673 messages sent to the client</td></tr>
2674 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var>|<var>URL</var></code></td></tr>
2675 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2676 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2677 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2679 <p>The <code class="directive">ServerAdmin</code> sets the contact address
2680 that the server includes in any error messages it returns to the
2681 client. If the <code>httpd</code> doesn't recognize the supplied argument
2683 assumes, that it's an <var>email-address</var> and prepends it with
2684 <code>mailto:</code> in hyperlink targets. However, it's recommended to
2685 actually use an email address, since there are a lot of CGI scripts that
2686 make that assumption. If you want to use an URL, it should point to another
2687 server under your control. Otherwise users may not be able to contact you in
2690 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2692 <div class="example"><p><code>
2693 ServerAdmin www-admin@foo.example.com
2695 <p>as users do not always mention that they are talking about the
2699 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2700 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
2701 <table class="directive">
2702 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
2703 to name-virtual hosts</td></tr>
2704 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
2705 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2706 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2707 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2709 <p>The <code class="directive">ServerAlias</code> directive sets the
2710 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
2712 <div class="example"><p><code>
2713 <VirtualHost *><br />
2714 ServerName server.domain.com<br />
2715 ServerAlias server server2.domain.com server2<br />
2717 </VirtualHost>
2722 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2725 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2726 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
2727 <table class="directive">
2728 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
2730 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerName <var>fully-qualified-domain-name</var>[:<var>port</var>]</code></td></tr>
2731 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2732 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2733 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2734 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>In version 2.0, this
2735 directive supersedes the functionality of the <code class="directive">Port</code>
2736 directive from version 1.3.</td></tr>
2738 <p>The <code class="directive">ServerName</code> directive sets the hostname and
2739 port that the server uses to identify itself. This is used when
2740 creating redirection URLs. For example, if the name of the
2741 machine hosting the web server is <code>simple.example.com</code>,
2742 but the machine also has the DNS alias <code>www.example.com</code>
2743 and you wish the web server to be so identified, the following
2744 directive should be used:</p>
2746 <div class="example"><p><code>
2747 ServerName www.example.com:80
2750 <p>If no <code class="directive">ServerName</code> is specified, then the
2751 server attempts to deduce the hostname by performing a reverse
2752 lookup on the IP address. If no port is specified in the
2753 <code class="directive">ServerName</code>, then the server will use the port
2755 request. For optimal reliability and predictability, you should
2756 specify an explicit hostname and port using the
2757 <code class="directive">ServerName</code> directive.</p>
2759 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
2760 the <code class="directive">ServerName</code> inside a
2761 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
2762 section specifies what hostname must appear in the request's
2763 <code>Host:</code> header to match this virtual host.</p>
2765 <p>See the description of the
2766 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> and
2767 <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code>directives for
2768 settings which determine whether self-referential URL's (e.g., by the
2769 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
2770 specified port, or to the port number given in the client's request.
2775 <li><a href="../dns-caveats.html">Issues Regarding DNS and
2777 <li><a href="../vhosts/">Apache virtual host
2778 documentation</a></li>
2779 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
2780 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
2781 <li><code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code></li>
2782 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
2785 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2786 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
2787 <table class="directive">
2788 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
2789 is accessed by an incompatible browser</td></tr>
2790 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
2791 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2792 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2793 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2795 <p>The <code class="directive">ServerPath</code> directive sets the legacy
2796 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
2800 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2803 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2804 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
2805 <table class="directive">
2806 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
2807 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
2808 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
2809 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2810 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2811 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2813 <p>The <code class="directive">ServerRoot</code> directive sets the
2814 directory in which the server lives. Typically it will contain the
2815 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2816 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
2817 relative to this directory.</p>
2819 <div class="example"><h3>Example</h3><p><code>
2820 ServerRoot /home/httpd
2826 <li><a href="../invoking.html">the <code>-d</code>
2827 option to <code>httpd</code></a></li>
2828 <li><a href="../misc/security_tips.html#serverroot">the
2829 security tips</a> for information on how to properly set
2830 permissions on the <code class="directive">ServerRoot</code></li>
2833 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2834 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
2835 <table class="directive">
2836 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
2837 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
2838 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
2839 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2840 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2841 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2842 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2844 <p>The <code class="directive">ServerSignature</code> directive allows the
2845 configuration of a trailing footer line under server-generated
2846 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
2847 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
2848 would want to enable such a footer line is that in a chain of proxies,
2849 the user often has no possibility to tell which of the chained servers
2850 actually produced a returned error message.</p>
2852 <p>The <code>Off</code>
2853 setting, which is the default, suppresses the footer line (and is
2854 therefore compatible with the behavior of Apache-1.2 and
2855 below). The <code>On</code> setting simply adds a line with the
2856 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
2857 and the <code>EMail</code> setting additionally creates a
2858 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
2861 <p>After version 2.0.44, the details of the server version number
2862 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
2866 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
2869 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2870 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
2871 <table class="directive">
2872 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the <code>Server</code> HTTP response
2874 <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>
2875 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
2876 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2877 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2878 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2880 <p>This directive controls whether <code>Server</code> response
2881 header field which is sent back to clients includes a
2882 description of the generic OS-type of the server as well as
2883 information about compiled-in modules.</p>
2886 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2888 <dd>Server sends (<em>e.g.</em>): <code>Server:
2891 <dt><code>ServerTokens Major</code></dt>
2893 <dd>Server sends (<em>e.g.</em>): <code>Server:
2894 Apache/2</code></dd>
2896 <dt><code>ServerTokens Minor</code></dt>
2898 <dd>Server sends (<em>e.g.</em>): <code>Server:
2899 Apache/2.0</code></dd>
2901 <dt><code>ServerTokens Min[imal]</code></dt>
2903 <dd>Server sends (<em>e.g.</em>): <code>Server:
2904 Apache/2.0.41</code></dd>
2906 <dt><code>ServerTokens OS</code></dt>
2908 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2911 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2913 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2914 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2917 <p>This setting applies to the entire server, and cannot be
2918 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2920 <p>After version 2.0.44, this directive also controls the
2921 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
2925 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
2928 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2929 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
2930 <table class="directive">
2931 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
2933 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
2934 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2935 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2936 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2937 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2938 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache 2.0</td></tr>
2940 <p>When placed into an <code>.htaccess</code> file or a
2941 <code class="directive"><a href="#directory"><Directory></a></code> or
2942 <code class="directive"><a href="#location"><Location></a></code>
2943 section, this directive forces all matching files to be parsed
2944 through the <a href="../handler.html">handler</a> given by
2945 <var>handler-name</var>. For example, if you had a directory you
2946 wanted to be parsed entirely as imagemap rule files, regardless
2947 of extension, you might put the following into an
2948 <code>.htaccess</code> file in that directory:</p>
2950 <div class="example"><p><code>
2951 SetHandler imap-file
2954 <p>Another example: if you wanted to have the server display a
2955 status report whenever a URL of
2956 <code>http://servername/status</code> was called, you might put
2957 the following into <code>httpd.conf</code>:</p>
2959 <div class="example"><p><code>
2960 <Location /status><br />
2961 <span class="indent">
2962 SetHandler server-status<br />
2967 <p>You can override an earlier defined <code class="directive">SetHandler</code>
2968 directive by using the value <code>None</code>.</p>
2969 <p><strong>Note:</strong> because SetHandler overrides default handlers,
2970 normal behaviour such as handling of URLs ending in a slash (/) as
2971 directories or index files is suppressed.</p>
2975 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
2978 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2979 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
2980 <table class="directive">
2981 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
2983 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
2984 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2985 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2986 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2987 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2989 <p>The <code class="directive">SetInputFilter</code> directive sets the
2990 filter or filters which will process client requests and POST
2991 input when they are received by the server. This is in addition to
2992 any filters defined elsewhere, including the
2993 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
2996 <p>If more than one filter is specified, they must be separated
2997 by semicolons in the order in which they should process the
3002 <li><a href="../filter.html">Filters</a> documentation</li>
3005 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3006 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
3007 <table class="directive">
3008 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
3010 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
3011 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
3012 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
3013 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3014 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3016 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
3017 which will process responses from the server before they are
3018 sent to the client. This is in addition to any filters defined
3019 elsewhere, including the
3020 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
3023 <p>For example, the following configuration will process all files
3024 in the <code>/www/data/</code> directory for server-side
3027 <div class="example"><p><code>
3028 <Directory /www/data/><br />
3029 <span class="indent">
3030 SetOutputFilter INCLUDES<br />
3035 <p>If more than one filter is specified, they must be separated
3036 by semicolons in the order in which they should process the
3041 <li><a href="../filter.html">Filters</a> documentation</li>
3044 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3045 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
3046 <table class="directive">
3047 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
3048 certain events before failing a request</td></tr>
3049 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>seconds</var></code></td></tr>
3050 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 300</code></td></tr>
3051 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3052 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3053 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3055 <p>The <code class="directive">TimeOut</code> directive currently defines
3056 the amount of time Apache will wait for three things:</p>
3059 <li>The total amount of time it takes to receive a GET
3062 <li>The amount of time between receipt of TCP packets on a
3063 POST or PUT request.</li>
3065 <li>The amount of time between ACKs on transmissions of TCP
3066 packets in responses.</li>
3069 <p>We plan on making these separately configurable at some point
3070 down the road. The timer used to default to 1200 before 1.2,
3071 but has been lowered to 300 which is still far more than
3072 necessary in most situations. It is not set any lower by
3073 default because there may still be odd places in the code where
3074 the timer is not reset when a packet is sent. </p>
3077 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3078 <div class="directive-section"><h2><a name="TraceEnable" id="TraceEnable">TraceEnable</a> <a name="traceenable" id="traceenable">Directive</a></h2>
3079 <table class="directive">
3080 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines the behaviour on <code>TRACE</code>
3082 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TraceEnable <var>[on|off|extended]</var></code></td></tr>
3083 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TraceEnable on</code></td></tr>
3084 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3085 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3086 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3087 <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>
3089 <p>This directive overrides the behavior of <code>TRACE</code> for both
3090 the core server and <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. The default
3091 <code>TraceEnable on</code> permits <code>TRACE</code> requests per
3092 RFC 2616, which disallows any request body to accompany the request.
3093 <code>TraceEnable off</code> causes the core server and
3094 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> to return a <code>405</code> (Method not
3095 allowed) error to the client.</p>
3097 <p>Finally, for testing and diagnostic purposes only, request
3098 bodies may be allowed using the non-compliant <code>TraceEnable
3099 extended</code> directive. The core (as an origin server) will
3100 restrict the request body to 64k (plus 8k for chunk headers if
3101 <code>Transfer-Encoding: chunked</code> is used). The core will
3102 reflect the full headers and all chunk headers with the response
3103 body. As a proxy server, the request body is not restricted to 64k.</p>
3106 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3107 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
3108 <table class="directive">
3109 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3111 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
3112 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName Off</code></td></tr>
3113 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3114 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3115 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3117 <p>In many situations Apache must construct a <em>self-referential</em>
3118 URL -- that is, a URL that refers back to the same server. With
3119 <code>UseCanonicalName On</code> Apache will use the hostname and port
3120 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
3121 directive to construct the canonical name for the server. This name
3122 is used in all self-referential URLs, and for the values of
3123 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
3125 <p>With <code>UseCanonicalName Off</code> Apache will form
3126 self-referential URLs using the hostname and port supplied by
3127 the client if any are supplied (otherwise it will use the
3128 canonical name, as defined above). These values are the same
3129 that are used to implement <a href="../vhosts/name-based.html">name based virtual hosts</a>,
3130 and are available with the same clients. The CGI variables
3131 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
3132 constructed from the client supplied values as well.</p>
3134 <p>An example where this may be useful is on an intranet server
3135 where you have users connecting to the machine using short
3136 names such as <code>www</code>. You'll notice that if the users
3137 type a shortname, and a URL which is a directory, such as
3138 <code>http://www/splat</code>, <em>without the trailing
3139 slash</em> then Apache will redirect them to
3140 <code>http://www.domain.com/splat/</code>. If you have
3141 authentication enabled, this will cause the user to have to
3142 authenticate twice (once for <code>www</code> and once again
3143 for <code>www.domain.com</code> -- see <a href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
3144 FAQ on this subject for more information</a>). But if
3145 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
3146 Apache will redirect to <code>http://www/splat/</code>.</p>
3148 <p>There is a third option, <code>UseCanonicalName DNS</code>,
3149 which is intended for use with mass IP-based virtual hosting to
3150 support ancient clients that do not provide a
3151 <code>Host:</code> header. With this option Apache does a
3152 reverse DNS lookup on the server IP address that the client
3153 connected to in order to work out self-referential URLs.</p>
3155 <div class="warning"><h3>Warning</h3>
3156 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
3157 they may be broken by this option. The client is essentially free
3158 to give whatever value they want as a hostname. But if the CGI is
3159 only using <code>SERVER_NAME</code> to construct self-referential URLs
3160 then it should be just fine.</p>
3165 <li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
3166 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3167 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3170 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3171 <div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a> <a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
3172 <table class="directive">
3173 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
3175 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort On|Off</code></td></tr>
3176 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort Off</code></td></tr>
3177 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
3178 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3179 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3181 <p>In many situations Apache must construct a <em>self-referential</em>
3182 URL -- that is, a URL that refers back to the same server. With
3183 <code>UseCanonicalPhysicalPort On</code> Apache will, when
3184 constructing the canonical port for the server to honor
3185 the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive,
3186 provide the actual physical port number being used by this request
3187 as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
3188 Apache will not ever use the actual physical port number, instead
3189 relying on all configured information to construct a valid port number.</p>
3191 <div class="note"><h3>Note</h3>
3192 <p>The ordering of when the physical port is used is as follows:<br /><br />
3193 <code>UseCanonicalName On</code>
3195 <li>Port provided in <code>Servername</code></li>
3196 <li>Physical port</li>
3197 <li>Default port</li>
3199 <code>UseCanonicalName Off | DNS</code>
3201 <li>Parsed port from <code>Host:</code> header</li>
3202 <li>Physical port</li>
3203 <li>Port provided in <code>Servername</code></li>
3204 <li>Default port</li>
3208 <p>With <code>UseCanonicalPhysicalPort Off</code>, the
3209 physical ports are removed from the ordering.</p>
3215 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
3216 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
3217 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
3220 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
3221 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
3222 <table class="directive">
3223 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
3224 hostname or IP address</td></tr>
3225 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
3226 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
3227 ...> ... </VirtualHost></code></td></tr>
3228 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3229 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
3230 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
3232 <p><code class="directive"><VirtualHost></code> and
3233 <code></VirtualHost></code> are used to enclose a group of
3234 directives that will apply only to a particular virtual host. Any
3235 directive that is allowed in a virtual host context may be
3236 used. When the server receives a request for a document on a
3237 particular virtual host, it uses the configuration directives
3238 enclosed in the <code class="directive"><VirtualHost></code>
3239 section. <var>Addr</var> can be:</p>
3242 <li>The IP address of the virtual host;</li>
3244 <li>A fully qualified domain name for the IP address of the
3247 <li>The character <code>*</code>, which is used only in combination with
3248 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
3250 <li>The string <code>_default_</code>, which is used only
3251 with IP virtual hosting to catch unmatched IP addresses.</li>
3254 <div class="example"><h3>Example</h3><p><code>
3255 <VirtualHost 10.1.2.3><br />
3256 <span class="indent">
3257 ServerAdmin webmaster@host.foo.com<br />
3258 DocumentRoot /www/docs/host.foo.com<br />
3259 ServerName host.foo.com<br />
3260 ErrorLog logs/host.foo.com-error_log<br />
3261 TransferLog logs/host.foo.com-access_log<br />
3263 </VirtualHost>
3267 <p>IPv6 addresses must be specified in square brackets because
3268 the optional port number could not be determined otherwise. An
3269 IPv6 example is shown below:</p>
3271 <div class="example"><p><code>
3272 <VirtualHost [2001:db8::a00:20ff:fea7:ccea]><br />
3273 <span class="indent">
3274 ServerAdmin webmaster@host.example.com<br />
3275 DocumentRoot /www/docs/host.example.com<br />
3276 ServerName host.example.com<br />
3277 ErrorLog logs/host.example.com-error_log<br />
3278 TransferLog logs/host.example.com-access_log<br />
3280 </VirtualHost>
3283 <p>Each Virtual Host must correspond to a different IP address,
3284 different port number or a different host name for the server,
3285 in the former case the server machine must be configured to
3286 accept IP packets for multiple addresses. (If the machine does
3287 not have multiple network interfaces, then this can be
3288 accomplished with the <code>ifconfig alias</code> command -- if
3289 your OS supports it).</p>
3291 <div class="note"><h3>Note</h3>
3292 <p>The use of <code class="directive"><VirtualHost></code> does
3293 <strong>not</strong> affect what addresses Apache listens on. You
3294 may need to ensure that Apache is listening on the correct addresses
3295 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
3298 <p>When using IP-based virtual hosting, the special name
3299 <code>_default_</code> can be specified in
3300 which case this virtual host will match any IP address that is
3301 not explicitly listed in another virtual host. In the absence
3302 of any <code>_default_</code> virtual host the "main" server config,
3303 consisting of all those definitions outside any VirtualHost
3304 section, is used when no IP-match occurs. (But note that any IP
3305 address that matches a <code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code> directive will use neither
3306 the "main" server config nor the <code>_default_</code> virtual host.
3307 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
3308 documentation for further details.)</p>
3310 <p>You can specify a <code>:port</code> to change the port that is
3311 matched. If unspecified then it defaults to the same port as the
3312 most recent <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
3313 statement of the main server. You may also specify <code>:*</code>
3314 to match all ports on that address. (This is recommended when used
3315 with <code>_default_</code>.)</p>
3317 <div class="warning"><h3>Security</h3>
3318 <p>See the <a href="../misc/security_tips.html">security tips</a>
3319 document for details on why your security could be compromised if the
3320 directory where log files are stored is writable by anyone other
3321 than the user that starts the server.</p>
3326 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
3327 <li><a href="../dns-caveats.html">Issues Regarding DNS and
3329 <li><a href="../bind.html">Setting
3330 which addresses and ports Apache uses</a></li>
3331 <li><a href="../sections.html">How <Directory>, <Location>
3332 and <Files> sections work</a> for an explanation of how these
3333 different sections are combined when a request is received</li>
3337 <div class="bottomlang">
3338 <p><span>Available Languages: </span><a href="../de/mod/core.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
3339 <a href="../en/mod/core.html" title="English"> en </a> |
3340 <a href="../ja/mod/core.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
3341 </div><div id="footer">
3342 <p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
3343 <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>