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.1</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.1</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Core Features</h1>
23 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Core Apache HTTP Server features that are always
25 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Core</td></tr></table>
27 <div id="quickview"><h3 class="directives">Directives</h3>
29 <li><img alt="" src="../images/down.gif" /> <a href="#acceptpathinfo">AcceptPathInfo</a></li>
30 <li><img alt="" src="../images/down.gif" /> <a href="#accessfilename">AccessFileName</a></li>
31 <li><img alt="" src="../images/down.gif" /> <a href="#adddefaultcharset">AddDefaultCharset</a></li>
32 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilterbytype">AddOutputFilterByType</a></li>
33 <li><img alt="" src="../images/down.gif" /> <a href="#allowoverride">AllowOverride</a></li>
34 <li><img alt="" src="../images/down.gif" /> <a href="#authname">AuthName</a></li>
35 <li><img alt="" src="../images/down.gif" /> <a href="#authtype">AuthType</a></li>
36 <li><img alt="" src="../images/down.gif" /> <a href="#cgimapextension">CGIMapExtension</a></li>
37 <li><img alt="" src="../images/down.gif" /> <a href="#contentdigest">ContentDigest</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#defaulttype">DefaultType</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#directory"><Directory></a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#directorymatch"><DirectoryMatch></a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#enablemmap">EnableMMAP</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#enablesendfile">EnableSendfile</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#errordocument">ErrorDocument</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#errorlog">ErrorLog</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#fileetag">FileETag</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#files"><Files></a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#filesmatch"><FilesMatch></a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#forcetype">ForceType</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#hostnamelookups">HostnameLookups</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#identitycheck">IdentityCheck</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#ifdefine"><IfDefine></a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#ifmodule"><IfModule></a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#include">Include</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#keepalive">KeepAlive</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#keepalivetimeout">KeepAliveTimeout</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#limit"><Limit></a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#limitexcept"><LimitExcept></a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestbody">LimitRequestBody</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfields">LimitRequestFields</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestfieldsize">LimitRequestFieldSize</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#limitrequestline">LimitRequestLine</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#limitxmlrequestbody">LimitXMLRequestBody</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#location"><Location></a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#locationmatch"><LocationMatch></a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#loglevel">LogLevel</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#namevirtualhost">NameVirtualHost</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#require">Require</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitcpu">RLimitCPU</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitmem">RLimitMEM</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#rlimitnproc">RLimitNPROC</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#satisfy">Satisfy</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#scriptinterpretersource">ScriptInterpreterSource</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#serveradmin">ServerAdmin</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#serveralias">ServerAlias</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#servername">ServerName</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#serverpath">ServerPath</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#serverroot">ServerRoot</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#serversignature">ServerSignature</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#servertokens">ServerTokens</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#sethandler">SetHandler</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#setinputfilter">SetInputFilter</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#setoutputfilter">SetOutputFilter</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost"><VirtualHost></a></li>
92 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
93 <div class="directive-section"><h2><a name="AcceptPathInfo" id="AcceptPathInfo">AcceptPathInfo</a> <a name="acceptpathinfo" id="acceptpathinfo">Directive</a></h2>
94 <table class="directive">
95 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Resources accept trailing pathname information</td></tr>
96 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptPathInfo On|Off|Default</code></td></tr>
97 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptPathInfo Default</code></td></tr>
98 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
99 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
100 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
101 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
102 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.30 and later</td></tr>
105 <p>This directive controls whether requests that contain trailing
106 pathname information that follows an actual filename (or
107 non-existent file in an existing directory) will be accepted or
108 rejected. The trailing pathname information can be made
109 available to scripts in the <code>PATH_INFO</code> environment
112 <p>For example, assume the location <code>/test/</code> points to
113 a directory that contains only the single file
114 <code>here.html</code>. Then requests for
115 <code>/test/here.html/more</code> and
116 <code>/test/nothere.html/more</code> both collect
117 <code>/more</code> as <code>PATH_INFO</code>.</p>
119 <p>The three possible arguments for the
120 <code class="directive">AcceptPathInfo</code> directive are:</p>
122 <dt><code>Off</code></dt><dd>A request will only be accepted if it
123 maps to a literal path that exists. Therefore a request with
124 trailing pathname information after the true filename such as
125 <code>/test/here.html/more</code> in the above example will return
126 a 404 NOT FOUND error.</dd>
128 <dt><code>On</code></dt><dd>A request will be accepted if a
129 leading path component maps to a file that exists. The above
130 example <code>/test/here.html/more</code> will be accepted if
131 <code>/test/here.html</code> maps to a valid file.</dd>
133 <dt><code>Default</code></dt><dd>The treatment of requests with
134 trailing pathname information is determined by the <a href="../handler.html">handler</a> responsible for the request.
135 The core handler for normal files defaults to rejecting
136 <code>PATH_INFO</code>. 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
137 <code>PATH_INFO</code> by default.</dd>
140 <p>The primary purpose of the <code>AcceptPathInfo</code>
141 directive is to allow you to override the handler's choice of
142 accepting or rejecting <code>PATH_INFO</code>. This override is required,
143 for example, when you use a <a href="../filter.html">filter</a>, such
144 as <a href="mod_include.html">INCLUDES</a>, to generate content
145 based on <code>PATH_INFO</code>. The core handler would usually reject
146 the request, so you can use the following configuration to enable
149 <div class="example"><p><code>
150 <Files "mypaths.shtml"><br />
151 <span class="indent">
152 Options +Includes<br />
153 SetOutputFilter INCLUDES<br />
154 AcceptPathInfo on<br />
161 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
162 <div class="directive-section"><h2><a name="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2>
163 <table class="directive">
164 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr>
165 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr>
166 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr>
167 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
168 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
169 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
171 <p>While processing a request the server looks for
172 the first existing configuration file from this list of names in
173 every directory of the path to the document, if distributed
174 configuration files are enabled for that directory. For
177 <div class="example"><p><code>
181 <p>before returning the document
182 <code>/usr/local/web/index.html</code>, the server will read
183 <code>/.acl</code>, <code>/usr/.acl</code>,
184 <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code>
185 for directives, unless they have been disabled with</p>
187 <div class="example"><p><code>
188 <Directory /><br />
189 <span class="indent">
190 AllowOverride None<br />
197 <li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li>
198 <li><a href="../configuring.html">Configuration Files</a></li>
199 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
202 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
203 <div class="directive-section"><h2><a name="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2>
204 <table class="directive">
205 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default character set to be added for a
206 response without an explicit character set</td></tr>
207 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr>
208 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</code></td></tr>
209 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
210 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
211 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
212 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
214 <p>This directive specifies the name of the character set that
215 will be added to any response that does not have any parameter on
216 the content type in the HTTP headers. This will override any
217 character set specified in the body of the document via a
218 <code>META</code> tag. A setting of <code>AddDefaultCharset
219 Off</code> disables this
220 functionality. <code>AddDefaultCharset On</code> enables
221 Apache's internal default charset of <code>iso-8859-1</code> as
222 required by the directive. You can also specify an alternate
223 <var>charset</var> to be used. For example:</p>
225 <div class="example"><p><code>
226 AddDefaultCharset utf-8
230 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
231 <div class="directive-section"><h2><a name="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2>
232 <table class="directive">
233 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular MIME-type</td></tr>
234 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
235 <var>MIME-type</var> [<var>MIME-type</var>] ...</code></td></tr>
236 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
237 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
240 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.33 and later</td></tr>
242 <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the
243 response MIME-type.</p>
245 <p>The following example uses the <code>DEFLATE</code> filter, which
246 is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all
247 output (either static or dynamic) which is labeled as
248 <code>text/html</code> or <code>text/plain</code> before it is sent
251 <div class="example"><p><code>
252 AddOutputFilterByType DEFLATE text/html text/plain
255 <p>If you want the content to be processed by more than one filter, they
256 have to be separated by semicolons. It's also possible to use one
257 <code class="directive">AddOutputFilterByType</code> directive for each of
260 <p>The configuration below causes all script output labeled as
261 <code>text/html</code> to be processed at first by the
262 <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
265 <div class="example"><p><code>
266 <Location /cgi-bin/><br />
267 <span class="indent">
268 Options Includes<br />
269 AddOutputFilterByType INCLUDES;DEFLATE text/html<br />
274 <div class="warning"><h3>Note</h3>
275 <p>Enabling filters with <code class="directive">AddOutputFilterByType</code>
276 may fail partially or completely in some cases. For expample, no
277 filters are applied if the content type falls back to the <code class="directive"><a href="#defaulttype">DefaultType</a></code>, even if the <code class="directive"><a href="#defaulttype">DefaultType</a></code> is the same.</p>
279 <p>However, if you want to make sure, that the filters will be
280 applied, assign the content type to a resource explicitely, for
281 example with <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> or
282 <code class="directive"><a href="#forcetype">ForceType</a></code>. Setting the
283 content type within a (non-nph) CGI script is also safe.</p>
285 <p>The by-type output filters are never applied on proxy requests.</p>
290 <li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li>
291 <li><code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code></li>
292 <li><a href="../filter.html">filters</a></li>
295 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
296 <div class="directive-section"><h2><a name="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2>
297 <table class="directive">
298 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in
299 .htaccess files</td></tr>
300 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>
301 [<var>directive-type</var>] ...</code></td></tr>
302 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride All</code></td></tr>
303 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
304 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
305 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
307 <p>When the server finds an <code>.htaccess</code> file (as
308 specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>)
309 it needs to know which directives declared in that file can override
310 earlier access information.</p>
312 <div class="note"><h3>Only available in <Directory> sections</h3>
313 <code class="directive">AllowOverride</code> is valid only in
314 <code class="directive"><a href="#directory"><Directory></a></code>
315 sections, not in <code class="directive"><a href="#location"><Location></a></code> or <code class="directive"><a href="#files"><Files></a></code> sections.
318 <p>When this directive is set to <code>None</code>, then
319 <a href="#accessfilename">.htaccess</a> files are completely ignored.
320 In this case, the server will not even attempt to read
321 <code>.htaccess</code> files in the filesystem.</p>
323 <p>When this directive is set to <code>All</code>, then any
324 directive which has the .htaccess <a href="directive-dict.html#Context">Context</a> is allowed in
325 <code>.htaccess</code> files.</p>
327 <p>The <var>directive-type</var> can be one of the following
328 groupings of directives.</p>
335 Allow use of the authorization directives (<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmgroupfile">AuthDBMGroupFile</a></code>,
336 <code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>,
337 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code>,
338 <code class="directive"><a href="#authname">AuthName</a></code>,
339 <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>
344 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>,
345 <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
346 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> Add* and Remove*
347 directives, <em>etc.</em>).</dd>
352 Allow use of the directives controlling directory indexing
353 (<code class="directive"><a href="../mod/mod_autoindex.html#adddescription">AddDescription</a></code>,
354 <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>,
355 <code class="directive"><a href="../mod/mod_autoindex.html#addiconbytype">AddIconByType</a></code>,
356 <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>,
362 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>
367 Allow use of the directives controlling specific directory
368 features (<code class="directive"><a href="#options">Options</a></code> and
369 <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>).</dd>
374 <div class="example"><p><code>
375 AllowOverride AuthConfig Indexes
380 <li><code class="directive"><a href="#accessfilename">AccessFileName</a></code></li>
381 <li><a href="../configuring.html">Configuration Files</a></li>
382 <li><a href="../howto/htaccess.html">.htaccess Files</a></li>
385 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
386 <div class="directive-section"><h2><a name="AuthName" id="AuthName">AuthName</a> <a name="authname" id="authname">Directive</a></h2>
387 <table class="directive">
388 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Authorization realm for use in HTTP
389 authentication</td></tr>
390 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthName <var>auth-domain</var></code></td></tr>
391 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
392 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
393 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
394 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
396 <p>This directive sets the name of the authorization realm for a
397 directory. This realm is given to the client so that the user
398 knows which username and password to send.
399 <code class="directive">AuthName</code> takes a single argument; if the
400 realm name contains spaces, it must be enclosed in quotation
401 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
402 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> and
403 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> to
408 <div class="example"><p><code>
409 AuthName "Top Secret"
412 <p>The string provided for the <code>AuthName</code> is what will
413 appear in the password dialog provided by most browsers.</p>
417 <li><a href="../howto/auth.html">Authentication, Authorization, and
418 Access Control</a></li>
421 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
422 <div class="directive-section"><h2><a name="AuthType" id="AuthType">AuthType</a> <a name="authtype" id="authtype">Directive</a></h2>
423 <table class="directive">
424 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Type of user authentication</td></tr>
425 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthType Basic|Digest</code></td></tr>
426 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
427 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
428 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
429 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
431 <p>This directive selects the type of user authentication for a
432 directory. Only <code>Basic</code> and <code>Digest</code> are
433 currently implemented.
435 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
436 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> and
437 <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> to
442 <li><a href="../howto/auth.html">Authentication, Authorization,
443 and Access Control</a></li>
446 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
447 <div class="directive-section"><h2><a name="CGIMapExtension" id="CGIMapExtension">CGIMapExtension</a> <a name="cgimapextension" id="cgimapextension">Directive</a></h2>
448 <table class="directive">
449 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
451 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CGIMapExtension <var>cgi-path</var> <var>.extension</var></code></td></tr>
452 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>None</code></td></tr>
453 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
454 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
455 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
456 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
457 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>NetWare only</td></tr>
459 <p>This directive is used to control how Apache finds the
460 interpreter used to run CGI scripts. For example, setting
461 <code>CGIMapExtension sys:\foo.nlm .foo</code> will
462 cause all CGI script files with a <code>.foo</code> extension to
463 be passed to the FOO interpreter.</p>
466 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
467 <div class="directive-section"><h2><a name="ContentDigest" id="ContentDigest">ContentDigest</a> <a name="contentdigest" id="contentdigest">Directive</a></h2>
468 <table class="directive">
469 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables the generation of Content-MD5 HTTP Response
471 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ContentDigest On|Off</code></td></tr>
472 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ContentDigest Off</code></td></tr>
473 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
474 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
475 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
476 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
478 <p>This directive enables the generation of
479 <code>Content-MD5</code> headers as defined in RFC1864
480 respectively RFC2068.</p>
482 <p>MD5 is an algorithm for computing a "message digest"
483 (sometimes called "fingerprint") of arbitrary-length data, with
484 a high degree of confidence that any alterations in the data
485 will be reflected in alterations in the message digest.</p>
487 <p>The <code>Content-MD5</code> header provides an end-to-end
488 message integrity check (MIC) of the entity-body. A proxy or
489 client may check this header for detecting accidental
490 modification of the entity-body in transit. Example header:</p>
492 <div class="example"><p><code>
493 Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
496 <p>Note that this can cause performance problems on your server
497 since the message digest is computed on every request (the
498 values are not cached).</p>
500 <p><code>Content-MD5</code> is only sent for documents served
501 by the <code class="module"><a href="../mod/core.html">core</a></code>, and not by any module. For example,
502 SSI documents, output from CGI scripts, and byte range responses
503 do not have this header.</p>
506 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
507 <div class="directive-section"><h2><a name="DefaultType" id="DefaultType">DefaultType</a> <a name="defaulttype" id="defaulttype">Directive</a></h2>
508 <table class="directive">
509 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>MIME content-type that will be sent if the
510 server cannot determine a type in any other way</td></tr>
511 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultType <var>MIME-type</var></code></td></tr>
512 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DefaultType text/plain</code></td></tr>
513 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
514 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
515 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
516 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
518 <p>There will be times when the server is asked to provide a
519 document whose type cannot be determined by its MIME types
522 <p>The server must inform the client of the content-type of the
523 document, so in the event of an unknown type it uses the
524 <code>DefaultType</code>. For example:</p>
526 <div class="example"><p><code>
527 DefaultType image/gif
530 <p>would be appropriate for a directory which contained many gif
531 images with filenames missing the <code>.gif</code> extension.</p>
533 <p>Note that unlike <code class="directive"><a href="#forcetype">ForceType</a></code>, this directive is only
534 provides the default mime-type. All other mime-type definitions,
535 including filename extensions, that might identify the media type
536 will override this default.</p>
539 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
540 <div class="directive-section"><h2><a name="Directory" id="Directory"><Directory></a> <a name="directory" id="directory">Directive</a></h2>
541 <table class="directive">
542 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose a group of directives that apply only to the
543 named file-system directory and sub-directories</td></tr>
544 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Directory <var>directory-path</var>>
545 ... </Directory></code></td></tr>
546 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
547 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
548 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
550 <p><code class="directive"><Directory></code> and
551 <code></Directory></code> are used to enclose a group of
552 directives that will apply only to the named directory and
553 sub-directories of that directory. Any directive that is allowed
554 in a directory context may be used. <var>Directory-path</var> is
555 either the full path to a directory, or a wild-card string using
556 Unix shell-style matching. In a wild-card string, <code>?</code> matches
557 any single character, and <code>*</code> matches any sequences of
558 characters. You may also use <code>[]</code> character ranges. None
559 of the wildcards match a `/' character, so <code><Directory
560 /*/public_html></code> will not match
561 <code>/home/user/public_html</code>, but <code><Directory
562 /home/*/public_html></code> will match. Example:</p>
564 <div class="example"><p><code>
565 <Directory /usr/local/httpd/htdocs><br />
566 <span class="indent">
567 Options Indexes FollowSymLinks<br />
573 <p>Be careful with the <var>directory-path</var> arguments:
574 They have to literally match the filesystem path which Apache uses
575 to access the files. Directives applied to a particular
576 <code><Directory></code> will not apply to files accessed from
577 that same directory via a different path, such as via different symbolic
582 expressions can also be used, with the addition of the
583 <code>~</code> character. For example:</p>
585 <div class="example"><p><code>
586 <Directory ~ "^/www/.*/[0-9]{3}">
589 <p>would match directories in <code>/www/</code> that consisted of
592 <p>If multiple (non-regular expression) <code class="directive"><Directory></code> sections
593 match the directory (or its parents) containing a document,
594 then the directives are applied in the order of shortest match
595 first, interspersed with the directives from the <a href="#accessfilename">.htaccess</a> files. For example,
598 <div class="example"><p><code>
599 <Directory /><br />
600 <span class="indent">
601 AllowOverride None<br />
603 </Directory><br />
605 <Directory /home/><br />
606 <span class="indent">
607 AllowOverride FileInfo<br />
612 <p>for access to the document <code>/home/web/dir/doc.html</code>
616 <li>Apply directive <code>AllowOverride None</code>
617 (disabling <code>.htaccess</code> files).</li>
619 <li>Apply directive <code>AllowOverride FileInfo</code> (for
620 directory <code>/home/web</code>).</li>
622 <li>Apply any <code>FileInfo</code> directives in
623 <code>/home/web/.htaccess</code></li>
626 <p>Regular expressions are not considered until after all of the
627 normal sections have been applied. Then all of the regular
628 expressions are tested in the order they appeared in the
629 configuration file. For example, with</p>
631 <div class="example"><p><code>
632 <Directory ~ abc$><br />
633 <span class="indent">
634 # ... directives here ...<br />
639 <p>the regular expression section won't be considered until after
640 all normal <code><Directory></code>s and <code>.htaccess</code>
641 files have been applied. Then the regular expression will match on
642 <code>/home/abc/public_html/abc</code> and be applied.</p>
644 <p><strong>Note that the default Apache access for
645 <code><Directory /></code> is <code>Allow from All</code>.
646 This means that Apache will serve any file mapped from an URL. It is
647 recommended that you change this with a block such
650 <div class="example"><p><code>
651 <Directory /><br />
652 <span class="indent">
653 Order Deny,Allow<br />
659 <p><strong>and then override this for directories you
660 <em>want</em> accessible. See the <a href="../misc/security_tips.html">Security Tips</a> page for more
661 details.</strong></p>
663 <p>The directory sections occur in the <code>httpd.conf</code> file.
664 <code class="directive"><Directory></code> directives
665 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>
669 <li><a href="../sections.html">How <Directory>,
670 <Location> and <Files> sections work</a> for an
671 explanation of how these different sections are combined when a
672 request is received</li>
675 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
676 <div class="directive-section"><h2><a name="DirectoryMatch" id="DirectoryMatch"><DirectoryMatch></a> <a name="directorymatch" id="directorymatch">Directive</a></h2>
677 <table class="directive">
678 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enclose directives that apply to
679 file-system directories matching a regular expression and their
680 subdirectories</td></tr>
681 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><DirectoryMatch <var>regex</var>>
682 ... </DirectoryMatch></code></td></tr>
683 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
684 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
685 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
687 <p><code class="directive"><DirectoryMatch></code> and
688 <code></DirectoryMatch></code> are used to enclose a group
689 of directives which will apply only to the named directory and
690 sub-directories of that directory, the same as <code class="directive"><a href="#directory"><Directory></a></code>. However, it
691 takes as an argument a regular expression. For example:</p>
693 <div class="example"><p><code>
694 <DirectoryMatch "^/www/.*/[0-9]{3}">
697 <p>would match directories in <code>/www/</code> that consisted of three
702 <li><code class="directive"><a href="#directory"><Directory></a></code> for
703 a description of how regular expressions are mixed in with normal
704 <code class="directive"><Directory></code>s</li>
705 <li><a href="../sections.html">How <Directory>, <Location> and
706 <Files> sections work</a> for an explanation of how these different
707 sections are combined when a request is received</li>
710 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
711 <div class="directive-section"><h2><a name="DocumentRoot" id="DocumentRoot">DocumentRoot</a> <a name="documentroot" id="documentroot">Directive</a></h2>
712 <table class="directive">
713 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory that forms the main document tree visible
714 from the web</td></tr>
715 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DocumentRoot <var>directory-path</var></code></td></tr>
716 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DocumentRoot /usr/local/apache/htdocs</code></td></tr>
717 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
718 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
719 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
721 <p>This directive sets the directory from which <code>httpd</code>
722 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
723 path from the requested URL to the document root to make the
724 path to the document. Example:</p>
726 <div class="example"><p><code>
727 DocumentRoot /usr/web
731 <code>http://www.my.host.com/index.html</code> refers to
732 <code>/usr/web/index.html</code>.</p>
734 <p>The <code class="directive">DocumentRoot</code> should be specified without
735 a trailing slash.</p>
739 <li><a href="../urlmapping.html">Mapping URLs to Filesystem
743 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
744 <div class="directive-section"><h2><a name="EnableMMAP" id="EnableMMAP">EnableMMAP</a> <a name="enablemmap" id="enablemmap">Directive</a></h2>
745 <table class="directive">
746 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use memory-mapping to read files during delivery</td></tr>
747 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableMMAP On|Off</code></td></tr>
748 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableMMAP On</code></td></tr>
749 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
750 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
751 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
752 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
754 <p>This directive controls whether the <code>httpd</code> may use
755 memory-mapping if it needs to read the contents of a file during
756 delivery. By default, when the handling of a request requires
757 access to the data within a file -- for example, when delivering a
758 server-parsed file using <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> -- Apache
759 memory-maps the file if the OS supports it.</p>
761 <p>This memory-mapping sometimes yields a performance improvement.
762 But in some environments, it is better to disable the memory-mapping
763 to prevent operational problems:</p>
766 <li>On some multiprocessor systems, memory-mapping can reduce the
767 performance of the <code>httpd</code>.</li>
768 <li>With an NFS-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code>,
769 the <code>httpd</code> may crash due to a segmentation fault if a file
770 is deleted or truncated while the <code>httpd</code> has it
774 <p>For server configurations that are vulnerable to these problems,
775 you should disable memory-mapping of delivered files by specifying:</p>
777 <div class="example"><p><code>
781 <p>For NFS mounted files, this feature may be disabled explicitly for
782 the offending files by specifying:</p>
784 <div class="example"><p><code>
785 <Directory "/path-to-nfs-files">
786 <span class="indent">
793 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
794 <div class="directive-section"><h2><a name="EnableSendfile" id="EnableSendfile">EnableSendfile</a> <a name="enablesendfile" id="enablesendfile">Directive</a></h2>
795 <table class="directive">
796 <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>
797 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableSendfile On|Off</code></td></tr>
798 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableSendfile On</code></td></tr>
799 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
800 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
801 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
802 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
803 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.44 and later</td></tr>
805 <p>This directive controls whether <code>httpd</code> may use the sendfile
806 support from the kernel to transmit file contents to the client.
807 By default, when the handling of a request requires no access
808 to the data within a file -- for example, when delivering a
809 static file -- Apache uses sendfile to deliver the file contents
810 without ever reading the file if the OS supports it.</p>
812 <p>This sendfile mechanism avoids seperate read and send operations,
813 and buffer allocations. But on some platforms or within some
814 filesystems, it is better to disable this feature to avoid
815 operational problems:</p>
818 <li>Some platforms may have broken sendfile support that the build
819 system did not detect, especially if the binaries were built on
820 another box and moved to such a machine with broken sendfile
822 <li>With a network-mounted <code class="directive"><a href="#documentroot">DocumentRoot</a></code> (e.g., NFS or SMB),
823 the kernel may be unable to serve the network file through
827 <p>For server configurations that are vulnerable to these problems,
828 you should disable this feature by specifying:</p>
830 <div class="example"><p><code>
834 <p>For NFS or SMB mounted files, this feature may be disabled explicitly
835 for the offending files by specifying:</p>
837 <div class="example"><p><code>
838 <Directory "/path-to-nfs-files">
839 <span class="indent">
846 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
847 <div class="directive-section"><h2><a name="ErrorDocument" id="ErrorDocument">ErrorDocument</a> <a name="errordocument" id="errordocument">Directive</a></h2>
848 <table class="directive">
849 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>What the server will return to the client
850 in case of an error</td></tr>
851 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorDocument <var>error-code</var> <var>document</var></code></td></tr>
852 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
853 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
854 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
855 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
856 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Quoting syntax for text messages is different in Apache
859 <p>In the event of a problem or error, Apache can be configured
860 to do one of four things,</p>
863 <li>output a simple hardcoded error message</li>
865 <li>output a customized message</li>
867 <li>redirect to a local <var>URL-path</var> to handle the
870 <li>redirect to an external <var>URL</var> to handle the
874 <p>The first option is the default, while options 2-4 are
875 configured using the <code class="directive">ErrorDocument</code>
876 directive, which is followed by the HTTP response code and a URL
877 or a message. Apache will sometimes offer additional information
878 regarding the problem/error.</p>
880 <p>URLs can begin with a slash (/) for local URLs, or be a full
881 URL which the client can resolve. Alternatively, a message can
882 be provided to be displayed by the browser. Examples:</p>
884 <div class="example"><p><code>
885 ErrorDocument 500 http://foo.example.com/cgi-bin/tester<br />
886 ErrorDocument 404 /cgi-bin/bad_urls.pl<br />
887 ErrorDocument 401 /subscription_info.html<br />
888 ErrorDocument 403 "Sorry can't allow you access today"
891 <p>Note that when you specify an <code class="directive">ErrorDocument</code>
892 that points to a remote URL (ie. anything with a method such as
893 <code>http</code> in front of it), Apache will send a redirect to the
894 client to tell it where to find the document, even if the
895 document ends up being on the same server. This has several
896 implications, the most important being that the client will not
897 receive the original error status code, but instead will
898 receive a redirect status code. This in turn can confuse web
899 robots and other clients which try to determine if a URL is
900 valid using the status code. In addition, if you use a remote
901 URL in an <code>ErrorDocument 401</code>, the client will not
902 know to prompt the user for a password since it will not
903 receive the 401 status code. Therefore, <strong>if you use an
904 <code>ErrorDocument 401</code> directive then it must refer to a local
905 document.</strong></p>
907 <p>Microsoft Internet Explorer (MSIE) will by default ignore
908 server-generated error messages when they are "too small" and substitute
909 its own "friendly" error messages. The size threshold varies depending on
910 the type of error, but in general, if you make your error document
911 greater than 512 bytes, then MSIE will show the server-generated
912 error rather than masking it. More information is available in
913 Microsoft Knowledgebase article <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807">Q294807</a>.</p>
915 <p>Prior to version 2.0, messages were indicated by prefixing
916 them with a single unmatched double quote character.</p>
920 <li><a href="../custom-error.html">documentation of
921 customizable responses</a></li>
924 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
925 <div class="directive-section"><h2><a name="ErrorLog" id="ErrorLog">ErrorLog</a> <a name="errorlog" id="errorlog">Directive</a></h2>
926 <table class="directive">
927 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location where the server will log errors</td></tr>
928 <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>
929 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ErrorLog logs/error_log (Unix)<br />
930 ErrorLog logs/error.log (Windows and OS/2)</code></td></tr>
931 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
932 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
933 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
935 <p>The <code class="directive">ErrorLog</code> directive sets the name of
936 the file to which the server will log any errors it encounters. If
937 the <var>file-path</var> does not begin with a slash (/) then it is
938 assumed to be relative to the <code class="directive"><a href="#serverroot">ServerRoot</a></code>.</p>
940 <div class="example"><h3>Example</h3><p><code>
941 ErrorLog /var/log/httpd/error_log
944 <p>If the <var>file-path</var>
945 begins with a pipe (|) then it is assumed to be a command to spawn
946 to handle the error log.</p>
948 <div class="example"><h3>Example</h3><p><code>
949 ErrorLog "|/usr/local/bin/httpd_errors"
952 <p>Using <code>syslog</code> instead of a filename enables logging
953 via syslogd(8) if the system supports it. The default is to use
954 syslog facility <code>local7</code>, but you can override this by
955 using the <code>syslog:<var>facility</var></code> syntax where
956 <var>facility</var> can be one of the names usually documented in
959 <div class="example"><h3>Example</h3><p><code>
963 <p>SECURITY: See the <a href="../misc/security_tips.html#serverroot">security tips</a>
964 document for details on why your security could be compromised
965 if the directory where logfiles are stored is writable by
966 anyone other than the user that starts the server.</p>
970 <li><code class="directive"><a href="#loglevel">LogLevel</a></code></li>
971 <li><a href="../logs.html">Apache Log Files</a></li>
974 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
975 <div class="directive-section"><h2><a name="FileETag" id="FileETag">FileETag</a> <a name="fileetag" id="fileetag">Directive</a></h2>
976 <table class="directive">
977 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File attributes used to create the ETag
978 HTTP response header</td></tr>
979 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FileETag <var>component</var> ...</code></td></tr>
980 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FileETag INode MTime Size</code></td></tr>
981 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
982 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
983 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
984 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
987 The <code class="directive">FileETag</code> directive configures the file
988 attributes that are used to create the <code>ETag</code> (entity
989 tag) response header field when the document is based on a file.
990 (The <code>ETag</code> value is used in cache management to save
991 network bandwidth.) In Apache 1.3.22 and earlier, the
992 <code>ETag</code> value was <em>always</em> formed
993 from the file's inode, size, and last-modified time (mtime). The
994 <code class="directive">FileETag</code> directive allows you to choose
995 which of these -- if any -- should be used. The recognized keywords are:
999 <dt><strong>INode</strong></dt>
1000 <dd>The file's i-node number will be included in the calculation</dd>
1001 <dt><strong>MTime</strong></dt>
1002 <dd>The date and time the file was last modified will be included</dd>
1003 <dt><strong>Size</strong></dt>
1004 <dd>The number of bytes in the file will be included</dd>
1005 <dt><strong>All</strong></dt>
1006 <dd>All available fields will be used. This is equivalent to:
1007 <div class="example"><p><code>FileETag INode MTime Size</code></p></div></dd>
1008 <dt><strong>None</strong></dt>
1009 <dd>If a document is file-based, no <code>ETag</code> field will be
1010 included in the response</dd>
1013 <p>The <code>INode</code>, <code>MTime</code>, and <code>Size</code>
1014 keywords may be prefixed with either <code>+</code> or <code>-</code>,
1015 which allow changes to be made to the default setting inherited
1016 from a broader scope. Any keyword appearing without such a prefix
1017 immediately and completely cancels the inherited setting.</p>
1019 <p>If a directory's configuration includes
1020 <code>FileETag INode MTime Size</code>, and a
1021 subdirectory's includes <code>FileETag -INode</code>,
1022 the setting for that subdirectory (which will be inherited by
1023 any sub-subdirectories that don't override it) will be equivalent to
1024 <code>FileETag MTime Size</code>.</p>
1027 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1028 <div class="directive-section"><h2><a name="Files" id="Files"><Files></a> <a name="files" id="files">Directive</a></h2>
1029 <table class="directive">
1030 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to matched
1032 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Files <var>filename</var>> ... </Files></code></td></tr>
1033 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1034 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1035 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1036 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1038 <p>The <code class="directive"><Files></code> directive
1039 provides for access control by filename. It is comparable to the
1040 <code class="directive"><a href="#directory">Directory</a></code>
1041 directive and <code class="directive"><a href="#location">Location</a></code> directives. It should be
1042 matched with a <code></Files></code> directive. The
1043 directives given within this section will be applied to any object
1044 with a basename (last component of filename) matching the
1045 specified filename. <code class="directive"><Files></code>
1046 sections are processed in the order they appear in the
1047 configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1048 <code>.htaccess</code> files are read, but before <code class="directive"><a href="#location"><Location></a></code> sections. Note
1049 that <code class="directive"><Files></code> can be nested
1050 inside <code class="directive"><a href="#directory"><Directory></a></code> sections to restrict the
1051 portion of the filesystem they apply to.</p>
1053 <p>The <var>filename</var> argument should include a filename, or
1054 a wild-card string, where <code>?</code> matches any single character,
1055 and <code>*</code> matches any sequences of characters. Extended regular
1056 expressions can also be used, with the addition of the
1057 <code>~</code> character. For example:</p>
1059 <div class="example"><p><code>
1060 <Files ~ "\.(gif|jpe?g|png)$">
1063 <p>would match most common Internet graphics formats. <code class="directive"><a href="#filesmatch"><FilesMatch></a></code> is preferred,
1066 <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
1067 <code>.htaccess</code> files. This allows users to control access to
1068 their own files, at a file-by-file level.</p>
1073 <li><a href="../sections.html">How <Directory>, <Location>
1074 and <Files> sections work</a> for an explanation of how these
1075 different sections are combined when a request is received</li>
1078 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1079 <div class="directive-section"><h2><a name="FilesMatch" id="FilesMatch"><FilesMatch></a> <a name="filesmatch" id="filesmatch">Directive</a></h2>
1080 <table class="directive">
1081 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply to regular-expression matched
1083 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><FilesMatch <var>regex</var>> ... </FilesMatch></code></td></tr>
1084 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1085 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1086 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1087 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1089 <p>The <code class="directive"><FilesMatch></code> directive
1090 provides for access control by filename, just as the <code class="directive"><a href="#files"><Files></a></code> directive
1091 does. However, it accepts a regular expression. For example:</p>
1093 <div class="example"><p><code>
1094 <FilesMatch "\.(gif|jpe?g|png)$">
1097 <p>would match most common Internet graphics formats.</p>
1101 <li><a href="../sections.html">How <Directory>, <Location>
1102 and <Files> sections work</a> for an explanation of how these
1103 different sections are combined when a request is received</li>
1106 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1107 <div class="directive-section"><h2><a name="ForceType" id="ForceType">ForceType</a> <a name="forcetype" id="forcetype">Directive</a></h2>
1108 <table class="directive">
1109 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be served with the specified
1110 MIME content-type</td></tr>
1111 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceType <var>MIME-type</var>|none</code></td></tr>
1112 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1113 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
1114 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1115 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1116 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved to the core in Apache 2.0</td></tr>
1118 <p>When placed into an <code>.htaccess</code> file or a
1119 <code class="directive"><a href="#directory"><Directory></a></code>, or
1120 <code class="directive"><a href="#location"><Location></a></code> or
1121 <code class="directive"><a href="#files"><Files></a></code>
1122 section, this directive forces all matching files to be served
1123 with the content type identification given by
1124 <var>MIME-type</var>. For example, if you had a directory full of
1125 GIF files, but did not want to label them all with <code>.gif</code>,
1126 you might want to use:</p>
1128 <div class="example"><p><code>
1132 <p>Note that unlike <code class="directive"><a href="#defaulttype">DefaultType</a></code>,
1133 this directive overrides all mime-type associations, including
1134 filename extensions, that might identify the media type.</p>
1136 <p>You can override any <code class="directive">ForceType</code> setting
1137 by using the value of <code>none</code>:</p>
1139 <div class="example"><p><code>
1140 # force all files to be image/gif:<br />
1141 <Location /images><br />
1142 <span class="indent">
1143 ForceType image/gif<br />
1145 </Location><br />
1147 # but normal mime-type associations here:<br />
1148 <Location /images/mixed><br />
1149 <span class="indent">
1150 ForceType none<br />
1156 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1157 <div class="directive-section"><h2><a name="HostnameLookups" id="HostnameLookups">HostnameLookups</a> <a name="hostnamelookups" id="hostnamelookups">Directive</a></h2>
1158 <table class="directive">
1159 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables DNS lookups on client IP addresses</td></tr>
1160 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>HostnameLookups On|Off|Double</code></td></tr>
1161 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>HostnameLookups Off</code></td></tr>
1162 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1163 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1164 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1166 <p>This directive enables DNS lookups so that host names can be
1167 logged (and passed to CGIs/SSIs in <code>REMOTE_HOST</code>).
1168 The value <code>Double</code> refers to doing double-reverse
1169 DNS lookup. That is, after a reverse lookup is performed, a forward
1170 lookup is then performed on that result. At least one of the ip
1171 addresses in the forward lookup must match the original
1172 address. (In "tcpwrappers" terminology this is called
1173 <code>PARANOID</code>.)</p>
1175 <p>Regardless of the setting, when <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code> is
1176 used for controlling access by hostname, a double reverse lookup
1177 will be performed. This is necessary for security. Note that the
1178 result of this double-reverse isn't generally available unless you
1179 set <code>HostnameLookups Double</code>. For example, if only
1180 <code>HostnameLookups On</code> and a request is made to an object
1181 that is protected by hostname restrictions, regardless of whether
1182 the double-reverse fails or not, CGIs will still be passed the
1183 single-reverse result in <code>REMOTE_HOST</code>.</p>
1185 <p>The default is <code>Off</code> in order to save the network
1186 traffic for those sites that don't truly need the reverse
1187 lookups done. It is also better for the end users because they
1188 don't have to suffer the extra latency that a lookup entails.
1189 Heavily loaded sites should leave this directive
1190 <code>Off</code>, since DNS lookups can take considerable
1191 amounts of time. The utility <a href="../programs/logresolve.html">logresolve</a>, compiled by default
1192 to the <code>bin</code> subdirectory of your installation directory, can
1193 be used to look up host names from logged IP addresses offline.</p>
1196 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1197 <div class="directive-section"><h2><a name="IdentityCheck" id="IdentityCheck">IdentityCheck</a> <a name="identitycheck" id="identitycheck">Directive</a></h2>
1198 <table class="directive">
1199 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables logging of the RFC1413 identity of the remote
1201 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>IdentityCheck On|Off</code></td></tr>
1202 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>IdentityCheck Off</code></td></tr>
1203 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1204 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1205 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1207 <p>This directive enables RFC1413-compliant logging of the
1208 remote user name for each connection, where the client machine
1209 runs identd or something similar. This information is logged in
1212 <p>The information should not be trusted in any way except for
1213 rudimentary usage tracking.</p>
1215 <p>Note that this can cause serious latency problems accessing
1216 your server since every request requires one of these lookups
1217 to be performed. When firewalls are involved each lookup might
1218 possibly fail and add 30 seconds of latency to each hit. So in
1219 general this is not very useful on public servers accessible
1220 from the Internet.</p>
1223 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1224 <div class="directive-section"><h2><a name="IfDefine" id="IfDefine"><IfDefine></a> <a name="ifdefine" id="ifdefine">Directive</a></h2>
1225 <table class="directive">
1226 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that will be processed only
1227 if a test is true at startup</td></tr>
1228 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfDefine [!]<var>parameter-name</var>> ...
1229 </IfDefine></code></td></tr>
1230 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1231 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1232 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1233 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1235 <p>The <code><IfDefine <var>test</var>>...</IfDefine>
1236 </code> section is used to mark directives that are conditional. The
1237 directives within an <code class="directive"><IfDefine></code>
1238 section are only processed if the <var>test</var> is true. If <var>
1239 test</var> is false, everything between the start and end markers is
1242 <p>The <var>test</var> in the <code class="directive"><IfDefine></code> section directive can be one of two forms:</p>
1245 <li><var>parameter-name</var></li>
1247 <li><code>!</code><var>parameter-name</var></li>
1250 <p>In the former case, the directives between the start and end
1251 markers are only processed if the parameter named
1252 <var>parameter-name</var> is defined. The second format reverses
1253 the test, and only processes the directives if
1254 <var>parameter-name</var> is <strong>not</strong> defined.</p>
1256 <p>The <var>parameter-name</var> argument is a define as given on
1257 the <code>httpd</code> command line via <code>-D<var>parameter-</var>
1258 </code>, at the time the server was started.</p>
1260 <p><code class="directive"><IfDefine></code> sections are
1261 nest-able, which can be used to implement simple
1262 multiple-parameter tests. Example:</p>
1264 <div class="example"><p><code>
1265 httpd -DReverseProxy ...<br />
1268 <IfDefine ReverseProxy><br />
1269 <span class="indent">
1270 LoadModule rewrite_module modules/mod_rewrite.so<br />
1271 LoadModule proxy_module modules/libproxy.so<br />
1277 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1278 <div class="directive-section"><h2><a name="IfModule" id="IfModule"><IfModule></a> <a name="ifmodule" id="ifmodule">Directive</a></h2>
1279 <table class="directive">
1280 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Encloses directives that are processed conditional on the
1281 presence or absence of a specific module</td></tr>
1282 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfModule [!]<var>module-name</var>> ...
1283 </IfModule></code></td></tr>
1284 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1285 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1286 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1287 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1289 <p>The <code><IfModule <var>test</var>>...</IfModule></code>
1290 section is used to mark directives that are conditional on the presence of
1291 a specific module. The directives within an <code class="directive"><IfModule></code> section are only processed if the <var>test</var>
1292 is true. If <var>test</var> is false, everything between the start and
1293 end markers is ignored.</p>
1295 <p>The <var>test</var> in the <code class="directive"><IfModule></code> section directive can be one of two forms:</p>
1298 <li><var>module name</var></li>
1300 <li>!<var>module name</var></li>
1303 <p>In the former case, the directives between the start and end
1304 markers are only processed if the module named <var>module
1305 name</var> is included in Apache -- either compiled in or
1306 dynamically loaded using <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>. The second format reverses the test,
1307 and only processes the directives if <var>module name</var> is
1308 <strong>not</strong> included.</p>
1310 <p>The <var>module name</var> argument is the file name of the
1311 module, at the time it was compiled. For example,
1312 <code>mod_rewrite.c</code>. If a module consists of several
1313 source files, use the name of the file containing the string
1314 <code>STANDARD20_MODULE_STUFF</code>.</p>
1316 <p><code class="directive"><IfModule></code> sections are
1317 nest-able, which can be used to implement simple multiple-module
1320 <div class="note">This section should only be used if you need to have one
1321 configuration file that works whether or not a specific module
1322 is available. In normal operation, directives need not be
1323 placed in <code class="directive"><IfModule></code>
1327 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1328 <div class="directive-section"><h2><a name="Include" id="Include">Include</a> <a name="include" id="include">Directive</a></h2>
1329 <table class="directive">
1330 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Includes other configuration files from within
1331 the server configuration files</td></tr>
1332 <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>
1333 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1334 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1335 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1336 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Wildcard matching available in 2.0.41 and later</td></tr>
1338 <p>This directive allows inclusion of other configuration files
1339 from within the server configuration files.</p>
1341 <p>Shell-style (fnmatch) wildcard characters can be used to
1342 include several files at once, in alphabetical order. In
1343 addition, if <code class="directive">Include</code> points to a directory,
1344 rather than a file, Apache will read all files in that directory
1345 and any subdirectory. But including entire directories is not
1346 recommended, because it is easy to accidentally leave temporary
1347 files in a directory that can cause <code>httpd</code> to
1350 <p>The file path specified may be a fully qualified path (i.e.
1351 starting with a slash), or may be relative to the
1352 <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory.</p>
1356 <div class="example"><p><code>
1357 Include /usr/local/apache2/conf/ssl.conf<br />
1358 Include /usr/local/apache2/conf/vhosts/*.conf
1361 <p>Or, providing paths relative to your <code class="directive"><a href="#serverroot">ServerRoot</a></code> directory:</p>
1363 <div class="example"><p><code>
1364 Include conf/ssl.conf<br />
1365 Include conf/vhosts/*.conf
1368 <p>Running <code>apachectl configtest</code> will give you a list
1369 of the files that are being processed during the configuration
1372 <div class="example"><p><code>
1373 root@host# apachectl configtest<br />
1374 Processing config file: /usr/local/apache2/conf/ssl.conf<br />
1375 Processing config file: /usr/local/apache2/conf/vhosts/vhost1.conf<br />
1376 Processing config file: /usr/local/apache2/conf/vhosts/vhost2.conf<br />
1382 <li><a href="../programs/apachectl.html">apachectl</a></li>
1385 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1386 <div class="directive-section"><h2><a name="KeepAlive" id="KeepAlive">KeepAlive</a> <a name="keepalive" id="keepalive">Directive</a></h2>
1387 <table class="directive">
1388 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables HTTP persistent connections</td></tr>
1389 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAlive On|Off</code></td></tr>
1390 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAlive On</code></td></tr>
1391 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1392 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1393 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1395 <p>The Keep-Alive extension to HTTP/1.0 and the persistent
1396 connection feature of HTTP/1.1 provide long-lived HTTP sessions
1397 which allow multiple requests to be sent over the same TCP
1398 connection. In some cases this has been shown to result in an
1399 almost 50% speedup in latency times for HTML documents with
1400 many images. To enable Keep-Alive connections, set
1401 <code>KeepAlive On</code>.</p>
1403 <p>For HTTP/1.0 clients, Keep-Alive connections will only be
1404 used if they are specifically requested by a client. In
1405 addition, a Keep-Alive connection with an HTTP/1.0 client can
1406 only be used when the length of the content is known in
1407 advance. This implies that dynamic content such as CGI output,
1408 SSI pages, and server-generated directory listings will
1409 generally not use Keep-Alive connections to HTTP/1.0 clients.
1410 For HTTP/1.1 clients, persistent connections are the default
1411 unless otherwise specified. If the client requests it, chunked
1412 encoding will be used in order to send content of unknown
1413 length over persistent connections.</p>
1417 <li><code class="directive"><a href="#maxkeepaliverequests">MaxKeepAliveRequests</a></code></li>
1420 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1421 <div class="directive-section"><h2><a name="KeepAliveTimeout" id="KeepAliveTimeout">KeepAliveTimeout</a> <a name="keepalivetimeout" id="keepalivetimeout">Directive</a></h2>
1422 <table class="directive">
1423 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for subsequent
1424 requests on a persistent connection</td></tr>
1425 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>KeepAliveTimeout <var>seconds</var></code></td></tr>
1426 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>KeepAliveTimeout 15</code></td></tr>
1427 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1428 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1429 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1431 <p>The number of seconds Apache will wait for a subsequent
1432 request before closing the connection. Once a request has been
1433 received, the timeout value specified by the
1434 <code class="directive"><a href="#timeout">Timeout</a></code> directive applies.</p>
1436 <p>Setting <code class="directive">KeepAliveTimeout</code> to a high value
1437 may cause performance problems in heavily loaded servers. The
1438 higher the timeout, the more server processes will be kept
1439 occupied waiting on connections with idle clients.</p>
1442 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1443 <div class="directive-section"><h2><a name="Limit" id="Limit"><Limit></a> <a name="limit" id="limit">Directive</a></h2>
1444 <table class="directive">
1445 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict enclosed access controls to only certain HTTP
1447 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Limit <var>method</var> [<var>method</var>] ... > ...
1448 </Limit></code></td></tr>
1449 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1450 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1451 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1452 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1454 <p>Access controls are normally effective for
1455 <strong>all</strong> access methods, and this is the usual
1456 desired behavior. <strong>In the general case, access control
1457 directives should not be placed within a
1458 <code class="directive"><Limit></code> section.</strong></p>
1460 <p>The purpose of the <code class="directive"><Limit></code>
1461 directive is to restrict the effect of the access controls to the
1462 nominated HTTP methods. For all other methods, the access
1463 restrictions that are enclosed in the <code class="directive"><Limit></code> bracket <strong>will have no
1464 effect</strong>. The following example applies the access control
1465 only to the methods <code>POST</code>, <code>PUT</code>, and
1466 <code>DELETE</code>, leaving all other methods unprotected:</p>
1468 <div class="example"><p><code>
1469 <Limit POST PUT DELETE><br />
1470 <span class="indent">
1471 Require valid-user<br />
1476 <p>The method names listed can be one or more of: <code>GET</code>,
1477 <code>POST</code>, <code>PUT</code>, <code>DELETE</code>,
1478 <code>CONNECT</code>, <code>OPTIONS</code>, <code>TRACE</code>,
1479 <code>PATCH</code>, <code>PROPFIND</code>, <code>PROPPATCH</code>,
1480 <code>MKCOL</code>, <code>COPY</code>, <code>MOVE</code>,
1481 <code>LOCK</code>, and <code>UNLOCK</code>. <strong>The method name is
1482 case-sensitive.</strong> If <code>GET</code> is used it will also
1483 restrict <code>HEAD</code> requests.</p>
1486 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1487 <div class="directive-section"><h2><a name="LimitExcept" id="LimitExcept"><LimitExcept></a> <a name="limitexcept" id="limitexcept">Directive</a></h2>
1488 <table class="directive">
1489 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restrict access controls to all HTTP methods
1490 except the named ones</td></tr>
1491 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LimitExcept <var>method</var> [<var>method</var>] ... > ...
1492 </LimitExcept></code></td></tr>
1493 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1494 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1495 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1496 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1498 <p><code class="directive"><LimitExcept></code> and
1499 <code></LimitExcept></code> are used to enclose
1500 a group of access control directives which will then apply to any
1501 HTTP access method <strong>not</strong> listed in the arguments;
1502 i.e., it is the opposite of a <code class="directive"><a href="#limit"><Limit></a></code> section and can be used to control
1503 both standard and nonstandard/unrecognized methods. See the
1504 documentation for <code class="directive"><a href="#limit"><Limit></a></code> for more details.</p>
1508 <div class="example"><p><code>
1509 <LimitExcept POST GET><br />
1510 <span class="indent">
1511 Require valid-user<br />
1518 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1519 <div class="directive-section"><h2><a name="LimitRequestBody" id="LimitRequestBody">LimitRequestBody</a> <a name="limitrequestbody" id="limitrequestbody">Directive</a></h2>
1520 <table class="directive">
1521 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Restricts the total size of the HTTP request body sent
1522 from the client</td></tr>
1523 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestBody <var>bytes</var></code></td></tr>
1524 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestBody 0</code></td></tr>
1525 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1526 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1527 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1528 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1530 <p>This directive specifies the number of <var>bytes</var> from 0
1531 (meaning unlimited) to 2147483647 (2GB) that are allowed in a
1532 request body. The default value is defined by the compile-time
1533 constant <code>DEFAULT_LIMIT_REQUEST_BODY</code> (0 as
1536 <p>The <code class="directive">LimitRequestBody</code> directive allows
1537 the user to set a limit on the allowed size of an HTTP request
1538 message body within the context in which the directive is given
1539 (server, per-directory, per-file or per-location). If the client
1540 request exceeds that limit, the server will return an error
1541 response instead of servicing the request. The size of a normal
1542 request message body will vary greatly depending on the nature of
1543 the resource and the methods allowed on that resource. CGI scripts
1544 typically use the message body for retrieving form information.
1545 Implementations of the <code>PUT</code> method will require
1546 a value at least as large as any representation that the server
1547 wishes to accept for that resource.</p>
1549 <p>This directive gives the server administrator greater
1550 control over abnormal client request behavior, which may be
1551 useful for avoiding some forms of denial-of-service
1554 <p>If, for example, you are permitting file upload to a particular
1555 location, and wish to limit the size of the uploaded file to 100K,
1556 you might use the following directive:</p>
1558 <div class="example"><p><code>
1559 LimitRequestBody 102400
1564 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1565 <div class="directive-section"><h2><a name="LimitRequestFields" id="LimitRequestFields">LimitRequestFields</a> <a name="limitrequestfields" id="limitrequestfields">Directive</a></h2>
1566 <table class="directive">
1567 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of HTTP request header fields that
1568 will be accepted from the client</td></tr>
1569 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFields <var>number</var></code></td></tr>
1570 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFields 100</code></td></tr>
1571 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1572 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1573 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1575 <p><var>Number</var> is an integer from 0 (meaning unlimited) to
1576 32767. The default value is defined by the compile-time
1577 constant <code>DEFAULT_LIMIT_REQUEST_FIELDS</code> (100 as
1580 <p>The <code class="directive">LimitRequestFields</code> directive allows
1581 the server administrator to modify the limit on the number of
1582 request header fields allowed in an HTTP request. A server needs
1583 this value to be larger than the number of fields that a normal
1584 client request might include. The number of request header fields
1585 used by a client rarely exceeds 20, but this may vary among
1586 different client implementations, often depending upon the extent
1587 to which a user has configured their browser to support detailed
1588 content negotiation. Optional HTTP extensions are often expressed
1589 using request header fields.</p>
1591 <p>This directive gives the server administrator greater
1592 control over abnormal client request behavior, which may be
1593 useful for avoiding some forms of denial-of-service attacks.
1594 The value should be increased if normal clients see an error
1595 response from the server that indicates too many fields were
1596 sent in the request.</p>
1600 <div class="example"><p><code>
1601 LimitRequestFields 50
1606 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1607 <div class="directive-section"><h2><a name="LimitRequestFieldSize" id="LimitRequestFieldSize">LimitRequestFieldSize</a> <a name="limitrequestfieldsize" id="limitrequestfieldsize">Directive</a></h2>
1608 <table class="directive">
1609 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of the HTTP request header allowed from the
1611 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestFieldsize <var>bytes</var></code></td></tr>
1612 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestFieldsize 8190</code></td></tr>
1613 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1614 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1615 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1617 <p>This directive specifies the number of <var>bytes</var> from 0
1618 to the value of the compile-time constant
1619 <code>DEFAULT_LIMIT_REQUEST_FIELDSIZE</code> (8190 as
1620 distributed) that will be allowed in an HTTP request
1623 <p>The <code class="directive">LimitRequestFieldSize</code> directive
1624 allows the server administrator to reduce the limit on the allowed
1625 size of an HTTP request header field below the normal input buffer
1626 size compiled with the server. A server needs this value to be
1627 large enough to hold any one header field from a normal client
1628 request. The size of a normal request header field will vary
1629 greatly among different client implementations, often depending
1630 upon the extent to which a user has configured their browser to
1631 support detailed content negotiation.</p>
1633 <p>This directive gives the server administrator greater
1634 control over abnormal client request behavior, which may be
1635 useful for avoiding some forms of denial-of-service attacks.</p>
1639 <div class="example"><p><code>
1640 LimitRequestFieldSize 16380
1643 <div class="note">Under normal conditions, the value should not be changed from
1648 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1649 <div class="directive-section"><h2><a name="LimitRequestLine" id="LimitRequestLine">LimitRequestLine</a> <a name="limitrequestline" id="limitrequestline">Directive</a></h2>
1650 <table class="directive">
1651 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit the size of the HTTP request line that will be accepted
1652 from the client</td></tr>
1653 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitRequestLine <var>bytes</var></code></td></tr>
1654 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitRequestLine 8190</code></td></tr>
1655 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1656 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1657 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1659 <p>This directive sets the number of <var>bytes</var> from 0 to
1660 the value of the compile-time constant
1661 <code>DEFAULT_LIMIT_REQUEST_LINE</code> (8190 as distributed)
1662 that will be allowed on the HTTP request-line.</p>
1664 <p>The <code class="directive">LimitRequestLine</code> directive allows
1665 the server administrator to reduce the limit on the allowed size
1666 of a client's HTTP request-line below the normal input buffer size
1667 compiled with the server. Since the request-line consists of the
1668 HTTP method, URI, and protocol version, the
1669 <code class="directive">LimitRequestLine</code> directive places a
1670 restriction on the length of a request-URI allowed for a request
1671 on the server. A server needs this value to be large enough to
1672 hold any of its resource names, including any information that
1673 might be passed in the query part of a <code>GET</code> request.</p>
1675 <p>This directive gives the server administrator greater
1676 control over abnormal client request behavior, which may be
1677 useful for avoiding some forms of denial-of-service attacks.</p>
1681 <div class="example"><p><code>
1682 LimitRequestLine 16380
1685 <div class="note">Under normal conditions, the value should not be changed from
1689 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1690 <div class="directive-section"><h2><a name="LimitXMLRequestBody" id="LimitXMLRequestBody">LimitXMLRequestBody</a> <a name="limitxmlrequestbody" id="limitxmlrequestbody">Directive</a></h2>
1691 <table class="directive">
1692 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the size of an XML-based request body</td></tr>
1693 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LimitXMLRequestBody <var>bytes</var></code></td></tr>
1694 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LimitXMLRequestBody 1000000</code></td></tr>
1695 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
1696 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
1697 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1698 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1700 <p>Limit (in bytes) on maximum size of an XML-based request
1701 body. A value of <code>0</code> will disable any checking.</p>
1705 <div class="example"><p><code>
1706 LimitXMLRequestBody 0
1711 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1712 <div class="directive-section"><h2><a name="Location" id="Location"><Location></a> <a name="location" id="location">Directive</a></h2>
1713 <table class="directive">
1714 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to matching
1716 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Location
1717 <var>URL-path</var>|<var>URL</var>> ... </Location></code></td></tr>
1718 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1719 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1720 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1722 <p>The <code class="directive"><Location></code> directive
1723 provides for access control by URL. It is similar to the
1724 <code class="directive"><a href="#directory"><Directory></a></code>
1725 directive, and starts a subsection which is terminated with a
1726 <code></Location></code> directive. <code class="directive"><Location></code> sections are processed in the
1727 order they appear in the configuration file, after the <code class="directive"><a href="#directory"><Directory></a></code> sections and
1728 <code>.htaccess</code> files are read, and after the <code class="directive"><a href="#files"><Files></a></code> sections.</p>
1730 <p>Note that URLs do not have to line up with the filesystem at
1731 all, it should be emphasized that <code class="directive"><Location></code> operates completely
1732 outside the filesystem.</p>
1734 <p>For all origin (non-proxy) requests, the URL to be matched is a
1735 URL-path of the form <code>/path/</code>. No scheme, hostname,
1736 port, or query string may be included. For proxy requests, the
1737 URL to be matched is of the form
1738 <code>scheme://servername/path</code>, and you must include the
1741 <p>The URL may use wildcards. In a wild-card string, <code>?</code> matches
1742 any single character, and <code>*</code> matches any sequences of
1746 expressions can also be used, with the addition of the
1747 <code>~</code> character. For example:</p>
1749 <div class="example"><p><code>
1750 <Location ~ "/(extra|special)/data">
1753 <p>would match URLs that contained the substring <code>/extra/data</code>
1754 or <code>/special/data</code>. The directive <code class="directive"><a href="#locationmatch"><LocationMatch></a></code> behaves
1755 identical to the regex version of <code class="directive"><Location></code>.</p>
1757 <p>The <code class="directive"><Location></code>
1758 functionality is especially useful when combined with the
1759 <code class="directive"><a href="#sethandler">SetHandler</a></code>
1760 directive. For example, to enable status requests, but allow them
1761 only from browsers at <code>foo.com</code>, you might use:</p>
1763 <div class="example"><p><code>
1764 <Location /status><br />
1765 <span class="indent">
1766 SetHandler server-status<br />
1767 Order Deny,Allow<br />
1769 Allow from .foo.com<br />
1774 <div class="note"><h3>Note about / (slash)</h3>
1775 <p>The slash character has special meaning depending on where in a
1776 URL it appears. People may be used to its behavior in the filesystem
1777 where multiple adjacent slashes are frequently collapsed to a single
1778 slash (<em>i.e.</em>, <code>/home///foo</code> is the same as
1779 <code>/home/foo</code>). In URL-space this is not necessarily true.
1780 The <code class="directive"><a href="#locationmatch"><LocationMatch></a></code>
1781 directive and the regex version of <code class="directive"><Location></code> require you to explicitly specify multiple
1782 slashes if that is your intention.</p>
1784 <p>For example, <code><LocationMatch ^/abc></code> would match
1785 the request URL <code>/abc</code> but not the request URL <code>
1786 //abc</code>. The (non-regex) <code class="directive"><Location></code> directive behaves similarly when used for
1787 proxy requests. But when (non-regex) <code class="directive"><Location></code> is used for non-proxy requests it will
1788 implicitly match multiple slashes with a single slash. For example,
1789 if you specify <code><Location /abc/def></code> and the
1790 request is to <code>/abc//def</code> then it will match.</p>
1795 <li><a href="../sections.html">How <Directory>, <Location>
1796 and <Files> sections work</a> for an explanation of how these
1797 different sections are combined when a request is received</li>
1800 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1801 <div class="directive-section"><h2><a name="LocationMatch" id="LocationMatch"><LocationMatch></a> <a name="locationmatch" id="locationmatch">Directive</a></h2>
1802 <table class="directive">
1803 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Applies the enclosed directives only to regular-expression
1804 matching URLs</td></tr>
1805 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><LocationMatch
1806 <var>regex</var>> ... </LocationMatch></code></td></tr>
1807 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1808 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1809 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1811 <p>The <code class="directive"><LocationMatch></code> directive
1812 provides for access control by URL, in an identical manner to
1813 <code class="directive"><a href="#location"><Location></a></code>. However,
1814 it takes a regular expression as an argument instead of a simple
1815 string. For example:</p>
1817 <div class="example"><p><code>
1818 <LocationMatch "/(extra|special)/data">
1821 <p>would match URLs that contained the substring <code>/extra/data</code>
1822 or <code>/special/data</code>.</p>
1826 <li><a href="../sections.html">How <Directory>, <Location>
1827 and <Files> sections work</a> for an explanation of how these
1828 different sections are combined when a request is received</li>
1831 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1832 <div class="directive-section"><h2><a name="LogLevel" id="LogLevel">LogLevel</a> <a name="loglevel" id="loglevel">Directive</a></h2>
1833 <table class="directive">
1834 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the verbosity of the ErrorLog</td></tr>
1835 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogLevel <var>level</var></code></td></tr>
1836 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogLevel warn</code></td></tr>
1837 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1838 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1839 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1841 <p><code class="directive">LogLevel</code> adjusts the verbosity of the
1842 messages recorded in the error logs (see <code class="directive"><a href="#errorlog">ErrorLog</a></code> directive). The following
1843 <var>level</var>s are available, in order of decreasing
1846 <table class="bordered">
1848 <th><strong>Level</strong> </th>
1850 <th><strong>Description</strong> </th>
1852 <th><strong>Example</strong> </th>
1856 <td><code>emerg</code> </td>
1858 <td>Emergencies - system is unusable.</td>
1860 <td>"Child cannot open lock file. Exiting"</td>
1864 <td><code>alert</code> </td>
1866 <td>Action must be taken immediately.</td>
1868 <td>"getpwuid: couldn't determine user name from uid"</td>
1872 <td><code>crit</code> </td>
1874 <td>Critical Conditions.</td>
1876 <td>"socket: Failed to get a socket, exiting child"</td>
1880 <td><code>error</code> </td>
1882 <td>Error conditions.</td>
1884 <td>"Premature end of script headers"</td>
1888 <td><code>warn</code> </td>
1890 <td>Warning conditions.</td>
1892 <td>"child process 1234 did not exit, sending another
1897 <td><code>notice</code> </td>
1899 <td>Normal but significant condition.</td>
1901 <td>"httpd: caught SIGBUS, attempting to dump core in
1906 <td><code>info</code> </td>
1908 <td>Informational.</td>
1910 <td>"Server seems busy, (you may need to increase
1911 StartServers, or Min/MaxSpareServers)..."</td>
1915 <td><code>debug</code> </td>
1917 <td>Debug-level messages</td>
1919 <td>"Opening config file ..."</td>
1923 <p>When a particular level is specified, messages from all
1924 other levels of higher significance will be reported as well.
1925 <em>E.g.</em>, when <code>LogLevel info</code> is specified,
1926 then messages with log levels of <code>notice</code> and
1927 <code>warn</code> will also be posted.</p>
1929 <p>Using a level of at least <code>crit</code> is
1934 <div class="example"><p><code>
1939 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1940 <div class="directive-section"><h2><a name="MaxKeepAliveRequests" id="MaxKeepAliveRequests">MaxKeepAliveRequests</a> <a name="maxkeepaliverequests" id="maxkeepaliverequests">Directive</a></h2>
1941 <table class="directive">
1942 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of requests allowed on a persistent
1943 connection</td></tr>
1944 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxKeepAliveRequests <var>number</var></code></td></tr>
1945 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxKeepAliveRequests 100</code></td></tr>
1946 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1947 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1948 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1950 <p>The <code class="directive">MaxKeepAliveRequests</code> directive
1951 limits the number of requests allowed per connection when
1952 <code class="directive"><a href="#keepalive">KeepAlive</a></code> is on. If it is
1953 set to <code>0</code>, unlimited requests will be allowed. We
1954 recommend that this setting be kept to a high value for maximum
1955 server performance.</p>
1959 <div class="example"><p><code>
1960 MaxKeepAliveRequests 500
1964 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1965 <div class="directive-section"><h2><a name="NameVirtualHost" id="NameVirtualHost">NameVirtualHost</a> <a name="namevirtualhost" id="namevirtualhost">Directive</a></h2>
1966 <table class="directive">
1967 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Designates an IP address for name-virtual
1969 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NameVirtualHost <var>addr</var>[:<var>port</var>]</code></td></tr>
1970 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
1971 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
1972 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
1974 <p>The <code class="directive">NameVirtualHost</code> directive is a
1975 required directive if you want to configure <a href="../vhosts/">name-based virtual hosts</a>.</p>
1977 <p>Although <var>addr</var> can be hostname it is recommended
1978 that you always use an IP address, e.g.</p>
1980 <div class="example"><p><code>
1981 NameVirtualHost 111.22.33.44
1984 <p>With the <code class="directive">NameVirtualHost</code> directive you
1985 specify the IP address on which the server will receive requests
1986 for the name-based virtual hosts. This will usually be the address
1987 to which your name-based virtual host names resolve. In cases
1988 where a firewall or other proxy receives the requests and forwards
1989 them on a different IP address to the server, you must specify the
1990 IP address of the physical interface on the machine which will be
1991 servicing the requests. If you have multiple name-based hosts on
1992 multiple addresses, repeat the directive for each address.</p>
1994 <div class="note"><h3>Note</h3>
1995 <p>Note, that the "main server" and any <code>_default_</code> servers
1996 will <strong>never</strong> be served for a request to a
1997 <code class="directive">NameVirtualHost</code> IP Address (unless for some
1998 reason you specify <code class="directive">NameVirtualHost</code> but then
1999 don't define any <code class="directive">VirtualHost</code>s for that
2003 <p>Optionally you can specify a port number on which the
2004 name-based virtual hosts should be used, e.g.</p>
2006 <div class="example"><p><code>
2007 NameVirtualHost 111.22.33.44:8080
2010 <p>IPv6 addresses must be enclosed in square brackets, as shown
2011 in the following example:</p>
2013 <div class="example"><p><code>
2014 NameVirtualHost [fe80::a00:20ff:fea7:ccea]:8080
2017 <p>To receive requests on all interfaces, you can use an argument of
2020 <div class="example"><p><code>
2024 <div class="note"><h3>Argument to <code class="directive"><VirtualHost></code>
2026 <p>Note that the argument to the <code class="directive"><VirtualHost></code> directive must
2027 exactly match the argument to the <code class="directive">NameVirtualHost</code> directive.</p>
2029 <div class="example"><p><code>
2030 NameVirtualHost 1.2.3.4<br />
2031 <VirtualHost 1.2.3.4><br />
2033 </VirtualHost><br />
2039 <li><a href="../vhosts/">Virtual Hosts
2040 documentation</a></li>
2043 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2044 <div class="directive-section"><h2><a name="Options" id="Options">Options</a> <a name="options" id="options">Directive</a></h2>
2045 <table class="directive">
2046 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures what features are available in a particular
2048 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Options
2049 [+|-]<var>option</var> [[+|-]<var>option</var>] ...</code></td></tr>
2050 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Options All</code></td></tr>
2051 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2052 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
2053 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2054 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2056 <p>The <code class="directive">Options</code> directive controls which
2057 server features are available in a particular directory.</p>
2059 <p><var>option</var> can be set to <code>None</code>, in which
2060 case none of the extra features are enabled, or one or more of
2064 <dt><code>All</code></dt>
2066 <dd>All options except for <code>MultiViews</code>. This is the default
2069 <dt><code>ExecCGI</code></dt>
2072 Execution of CGI scripts is permitted.</dd>
2074 <dt><code>FollowSymLinks</code></dt>
2078 The server will follow symbolic links in this directory.
2080 <p>Even though the server follows the symlink it does <em>not</em>
2081 change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
2082 <p>Note also, that this option <strong>gets ignored</strong> if set
2083 inside a <code class="directive"><a href="#location"><Location></a></code>
2087 <dt><code>Includes</code></dt>
2090 Server-side includes are permitted.</dd>
2092 <dt><code>IncludesNOEXEC</code></dt>
2096 Server-side includes are permitted, but the <code>#exec cmd</code>
2097 and <code>#exec cgi</code> are disabled. It is still possible to
2098 <code>#include virtual</code> CGI scripts from
2099 <code class="directive">ScriptAlias</code>e'd directories.</dd>
2101 <dt><code>Indexes</code></dt>
2104 If a URL which maps to a directory is requested, and the
2105 there is no <code class="directive">DirectoryIndex</code> (<em>e.g.</em>,
2106 <code>index.html</code>) in that directory, then the server will
2107 return a formatted listing of the directory.</dd>
2109 <dt><code>MultiViews</code></dt>
2112 <a href="../content-negotiation.html">Content negotiated</a>
2113 "MultiViews" are allowed.</dd>
2115 <dt><code>SymLinksIfOwnerMatch</code></dt>
2119 The server will only follow symbolic links for which the target
2120 file or directory is owned by the same user id as the link.<br /> <strong>Note</strong>: this option gets ignored if set inside
2121 a <code class="directive"><a href="#location"><Location></a></code>
2124 <p>Normally, if multiple <code class="directive">Options</code> could apply to a
2125 directory, then the most specific one is taken complete; the
2126 options are not merged. However if <em>all</em> the options on
2127 the <code class="directive">Options</code> directive are preceded by a
2128 <code>+</code> or <code>-</code>
2129 symbol, the options are merged. Any options preceded by a <code>+</code>
2130 are added to the options currently in force, and any options
2131 preceded by a <code>-</code> are removed from the options currently in
2134 <p>For example, without any <code>+</code> and <code>-</code> symbols:</p>
2136 <div class="example"><p><code>
2137 <Directory /web/docs><br />
2138 <span class="indent">
2139 Options Indexes FollowSymLinks<br />
2141 </Directory><br />
2143 <Directory /web/docs/spec><br />
2144 <span class="indent">
2145 Options Includes<br />
2150 <p>then only <code>Includes</code> will be set for the
2151 <code>/web/docs/spec</code> directory. However if the second
2152 <code class="directive">Options</code> directive uses the <code>+</code> and
2153 <code>-</code> symbols:</p>
2155 <div class="example"><p><code>
2156 <Directory /web/docs><br />
2157 <span class="indent">
2158 Options Indexes FollowSymLinks<br />
2160 </Directory><br />
2162 <Directory /web/docs/spec><br />
2163 <span class="indent">
2164 Options +Includes -Indexes<br />
2169 <p>then the options <code>FollowSymLinks</code> and
2170 <code>Includes</code> are set for the <code>/web/docs/spec</code>
2173 <div class="note"><h3>Note</h3>
2174 <p>Using <code>-IncludesNOEXEC</code> or
2175 <code>-Includes</code> disables server-side includes completely
2176 regardless of the previous setting.</p>
2179 <p>The default in the absence of any other settings is
2180 <code>All</code>.</p>
2183 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2184 <div class="directive-section"><h2><a name="Require" id="Require">Require</a> <a name="require" id="require">Directive</a></h2>
2185 <table class="directive">
2186 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Selects which authenticated users can access
2187 a resource</td></tr>
2188 <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>
2189 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2190 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
2191 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2192 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2194 <p>This directive selects which authenticated users can access
2195 a directory. The allowed syntaxes are:</p>
2199 Require user <var>userid</var> [<var>userid</var>] ...
2201 <p>Only the named users can access the resource.</p>
2205 Require group <var>group-name</var> [<var>group-name</var>] ...
2208 <p>Only users in the named groups can access the
2215 <p>All valid users can access the resource.</p>
2219 <p><code class="directive">Require</code> must be accompanied by
2220 <code class="directive"><a href="#authname">AuthName</a></code> and <code class="directive"><a href="#authtype">AuthType</a></code> directives, and directives such
2221 as <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code>
2222 and <code class="directive"><a href="../mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code> (to
2223 define users and groups) in order to work correctly. Example:</p>
2225 <div class="example"><p><code>
2226 AuthType Basic<br />
2227 AuthName "Restricted Directory"<br />
2228 AuthUserFile /web/users<br />
2229 AuthGroupFile /web/groups<br />
2233 <p>Access controls which are applied in this way are effective for
2234 <strong>all</strong> methods. <strong>This is what is normally
2235 desired.</strong> If you wish to apply access controls only to
2236 specific methods, while leaving other methods unprotected, then
2237 place the <code class="directive">Require</code> statement into a
2238 <code class="directive"><a href="#limit"><Limit></a></code>
2243 <li><code class="directive"><a href="#satisfy">Satisfy</a></code></li>
2244 <li><code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code></li>
2247 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2248 <div class="directive-section"><h2><a name="RLimitCPU" id="RLimitCPU">RLimitCPU</a> <a name="rlimitcpu" id="rlimitcpu">Directive</a></h2>
2249 <table class="directive">
2250 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the CPU consumption of processes launched
2251 by Apache children</td></tr>
2252 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitCPU <var>number</var>|max [<var>number</var>|max]</code></td></tr>
2253 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2254 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2255 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2256 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2257 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2259 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2260 resource limit for all processes and the second parameter sets
2261 the maximum resource limit. Either parameter can be a number,
2262 or <code>max</code> to indicate to the server that the limit should
2263 be set to the maximum allowed by the operating system
2264 configuration. Raising the maximum resource limit requires that
2265 the server is running as root, or in the initial startup
2268 <p>This applies to processes forked off from Apache children
2269 servicing requests, not the Apache children themselves. This
2270 includes CGI scripts and SSI exec commands, but not any
2271 processes forked off from the Apache parent such as piped
2274 <p>CPU resource limits are expressed in seconds per
2279 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2280 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2283 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2284 <div class="directive-section"><h2><a name="RLimitMEM" id="RLimitMEM">RLimitMEM</a> <a name="rlimitmem" id="rlimitmem">Directive</a></h2>
2285 <table class="directive">
2286 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the memory consumption of processes launched
2287 by Apache children</td></tr>
2288 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RLimitMEM <var>number</var>|max [<var>number</var>|max]</code></td></tr>
2289 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2290 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2291 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2292 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2293 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2295 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2296 resource limit for all processes and the second parameter sets
2297 the maximum resource limit. Either parameter can be a number,
2298 or <code>max</code> to indicate to the server that the limit should
2299 be set to the maximum allowed by the operating system
2300 configuration. Raising the maximum resource limit requires that
2301 the server is running as root, or in the initial startup
2304 <p>This applies to processes forked off from Apache children
2305 servicing requests, not the Apache children themselves. This
2306 includes CGI scripts and SSI exec commands, but not any
2307 processes forked off from the Apache parent such as piped
2310 <p>Memory resource limits are expressed in bytes per
2315 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2316 <li><code class="directive"><a href="#rlimitnproc">RLimitNPROC</a></code></li>
2319 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2320 <div class="directive-section"><h2><a name="RLimitNPROC" id="RLimitNPROC">RLimitNPROC</a> <a name="rlimitnproc" id="rlimitnproc">Directive</a></h2>
2321 <table class="directive">
2322 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limits the number of processes that can be launched by
2323 processes launched by Apache children</td></tr>
2324 <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>
2325 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Unset; uses operating system defaults</code></td></tr>
2326 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2327 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2328 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2329 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2331 <p>Takes 1 or 2 parameters. The first parameter sets the soft
2332 resource limit for all processes and the second parameter sets
2333 the maximum resource limit. Either parameter can be a number,
2334 or <code>max</code> to indicate to the server that the limit
2335 should be set to the maximum allowed by the operating system
2336 configuration. Raising the maximum resource limit requires that
2337 the server is running as root, or in the initial startup
2340 <p>This applies to processes forked off from Apache children
2341 servicing requests, not the Apache children themselves. This
2342 includes CGI scripts and SSI exec commands, but not any
2343 processes forked off from the Apache parent such as piped
2346 <p>Process limits control the number of processes per user.</p>
2348 <div class="note"><h3>Note</h3>
2349 <p>If CGI processes are <strong>not</strong> running
2350 under userids other than the web server userid, this directive
2351 will limit the number of processes that the server itself can
2352 create. Evidence of this situation will be indicated by
2353 <strong><code>cannot fork</code></strong> messages in the
2354 <code>error_log</code>.</p>
2359 <li><code class="directive"><a href="#rlimitmem">RLimitMEM</a></code></li>
2360 <li><code class="directive"><a href="#rlimitcpu">RLimitCPU</a></code></li>
2363 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2364 <div class="directive-section"><h2><a name="Satisfy" id="Satisfy">Satisfy</a> <a name="satisfy" id="satisfy">Directive</a></h2>
2365 <table class="directive">
2366 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Interaction between host-level access control and
2367 user authentication</td></tr>
2368 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Satisfy Any|All</code></td></tr>
2369 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Satisfy All</code></td></tr>
2370 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
2371 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
2372 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2373 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2375 <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
2376 either <code>All</code> or <code>Any</code>. This directive is only
2377 useful if access to a particular area is being restricted by both
2378 username/password <em>and</em> client host address. In this case
2379 the default behavior (<code>All</code>) is to require that the client
2380 passes the address access restriction <em>and</em> enters a valid
2381 username and password. With the <code>Any</code> option the client will be
2382 granted access if they either pass the host restriction or enter a
2383 valid username and password. This can be used to password restrict
2384 an area, but to let clients from particular addresses in without
2385 prompting for a password.</p>
2387 <p>For example, if you wanted to let people on your network have
2388 unrestricted access to a portion of your website, but require that
2389 people outside of your network provide a password, you could use a
2390 configuration similar to the following:</p>
2392 <div class="example"><p><code>
2393 Require valid-user<br />
2394 Allow from 192.168.1<br />
2401 <li><code class="directive"><a href="../mod/mod_authz_host.html#allow">Allow</a></code></li>
2402 <li><code class="directive"><a href="#require">Require</a></code></li>
2405 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2406 <div class="directive-section"><h2><a name="ScriptInterpreterSource" id="ScriptInterpreterSource">ScriptInterpreterSource</a> <a name="scriptinterpretersource" id="scriptinterpretersource">Directive</a></h2>
2407 <table class="directive">
2408 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Technique for locating the interpreter for CGI
2410 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptInterpreterSource Registry|Registry-Strict|Script</code></td></tr>
2411 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScriptInterpreterSource Script</code></td></tr>
2412 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2413 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2414 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2415 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2416 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Win32 only
2417 option Registry-Strict is available in Apache 2.0 and later</td></tr>
2419 <p>This directive is used to control how Apache finds the
2420 interpreter used to run CGI scripts. The default technique is to
2421 use the interpreter pointed to by the <code>#!</code> line in the
2424 <p>Setting <code>ScriptInterpreterSource Registry</code> will
2425 cause the Windows Registry to be searched using the script file
2426 extension (e.g., <code>.pl</code>) as a search key.</p>
2428 <p>The option <code>Registry-Strict</code> which is new in Apache 2.0
2429 does the same as <code>Registry</code> but uses a more strict registry
2433 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2434 <div class="directive-section"><h2><a name="ServerAdmin" id="ServerAdmin">ServerAdmin</a> <a name="serveradmin" id="serveradmin">Directive</a></h2>
2435 <table class="directive">
2436 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Email address that the server includes in error
2437 messages sent to the client</td></tr>
2438 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAdmin <var>email-address</var></code></td></tr>
2439 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2440 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2441 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2443 <p>The <code class="directive">ServerAdmin</code> sets the e-mail address
2444 that the server includes in any error messages it returns to the
2447 <p>It may be worth setting up a dedicated address for this, e.g.</p>
2449 <div class="example"><p><code>
2450 ServerAdmin www-admin@foo.example.com
2452 <p>as users do not always mention that they are talking about the
2456 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2457 <div class="directive-section"><h2><a name="ServerAlias" id="ServerAlias">ServerAlias</a> <a name="serveralias" id="serveralias">Directive</a></h2>
2458 <table class="directive">
2459 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Alternate names for a host used when matching requests
2460 to name-virtual hosts</td></tr>
2461 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerAlias <var>hostname</var> [<var>hostname</var>] ...</code></td></tr>
2462 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2463 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2464 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2466 <p>The <code class="directive">ServerAlias</code> directive sets the
2467 alternate names for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
2469 <div class="example"><p><code>
2470 <VirtualHost *><br />
2471 ServerName server.domain.com<br />
2472 ServerAlias server server2.domain.com server2<br />
2474 </VirtualHost>
2479 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2482 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2483 <div class="directive-section"><h2><a name="ServerName" id="ServerName">ServerName</a> <a name="servername" id="servername">Directive</a></h2>
2484 <table class="directive">
2485 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hostname and port that the server uses to identify
2487 <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>
2488 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2489 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2490 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2491 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>In version 2.0, this
2492 directive supersedes the functionality of the Port
2493 directive from version 1.3.</td></tr>
2495 <p>The <code class="directive">ServerName</code> directive sets the hostname and
2496 port that the server uses to identify itself. This is used when
2497 creating redirection URLs. For example, if the name of the
2498 machine hosting the webserver is <code>simple.example.com</code>,
2499 but the machine also has the DNS alias <code>www.example.com</code>
2500 and you wish the webserver to be so identified, the following
2501 directive should be used:</p>
2503 <div class="example"><p><code>
2504 ServerName www.example.com:80
2507 <p>If no <code class="directive">ServerName</code> is specified, then the
2508 server attempts to deduce the hostname by performing a reverse
2509 lookup on the IP address. If no port is specified in the
2510 servername, then the server will use the port from the incoming
2511 request. For optimal reliability and predictability, you should
2512 specify an explicit hostname and port using the
2513 <code class="directive">ServerName</code> directive.</p>
2515 <p>If you are using <a href="../vhosts/name-based.html">name-based virtual hosts</a>,
2516 the <code class="directive">ServerName</code> inside a
2517 <code class="directive"><a href="#virtualhost"><VirtualHost></a></code>
2518 section specifies what hostname must appear in the request's
2519 <code>Host:</code> header to match this virtual host.</p>
2521 <p>See the description of the
2522 <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code> directive for
2523 settings which determine whether self-referential URL's (e.g., by the
2524 <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module) will refer to the
2525 specified port, or to the port number given in the client's request.
2530 <li><a href="../dns-caveats.html">DNS Issues</a></li>
2531 <li><a href="../vhosts/">Apache virtual host
2532 documentation</a></li>
2533 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
2534 <li><code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code></li>
2535 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
2538 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2539 <div class="directive-section"><h2><a name="ServerPath" id="ServerPath">ServerPath</a> <a name="serverpath" id="serverpath">Directive</a></h2>
2540 <table class="directive">
2541 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Legacy URL pathname for a name-based virtual host that
2542 is accessed by an incompatible browser</td></tr>
2543 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerPath <var>URL-path</var></code></td></tr>
2544 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
2545 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2546 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2548 <p>The <code class="directive">ServerPath</code> directive sets the legacy
2549 URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
2553 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2556 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2557 <div class="directive-section"><h2><a name="ServerRoot" id="ServerRoot">ServerRoot</a> <a name="serverroot" id="serverroot">Directive</a></h2>
2558 <table class="directive">
2559 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Base directory for the server installation</td></tr>
2560 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerRoot <var>directory-path</var></code></td></tr>
2561 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerRoot /usr/local/apache</code></td></tr>
2562 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2563 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2564 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2566 <p>The <code class="directive">ServerRoot</code> directive sets the
2567 directory in which the server lives. Typically it will contain the
2568 subdirectories <code>conf/</code> and <code>logs/</code>. Relative
2569 paths for other configuration files are taken as relative to this
2572 <div class="example"><h3>Example</h3><p><code>
2573 ServerRoot /home/httpd
2579 <li><a href="../invoking.html">the <code>-d</code>
2580 option to <code>httpd</code></a></li>
2581 <li><a href="../misc/security_tips.html#serverroot">the
2582 security tips</a> for information on how to properly set
2583 permissions on the ServerRoot</li>
2586 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2587 <div class="directive-section"><h2><a name="ServerSignature" id="ServerSignature">ServerSignature</a> <a name="serversignature" id="serversignature">Directive</a></h2>
2588 <table class="directive">
2589 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the footer on server-generated documents</td></tr>
2590 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerSignature On|Off|EMail</code></td></tr>
2591 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerSignature Off</code></td></tr>
2592 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2593 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
2594 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2595 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2597 <p>The <code class="directive">ServerSignature</code> directive allows the
2598 configuration of a trailing footer line under server-generated
2599 documents (error messages, <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ftp directory
2600 listings, <code class="module"><a href="../mod/mod_info.html">mod_info</a></code> output, ...). The reason why you
2601 would want to enable such a footer line is that in a chain of proxies,
2602 the user often has no possibility to tell which of the chained servers
2603 actually produced a returned error message.<br /> The <code>Off</code>
2604 setting, which is the default, suppresses the footer line (and is
2605 therefore compatible with the behavior of Apache-1.2 and
2606 below). The <code>On</code> setting simply adds a line with the
2607 server version number and <code class="directive"><a href="#servername">ServerName</a></code> of the serving virtual host,
2608 and the <code>EMail</code> setting additionally creates a
2609 "mailto:" reference to the <code class="directive"><a href="#serveradmin">ServerAdmin</a></code> of the referenced
2612 <p>After version 2.0.44, the details of the server version number
2613 presented are controlled by the <code class="directive"><a href="#servertokens">ServerTokens</a></code> directive.</p>
2617 <li><code class="directive"><a href="#servertokens">ServerTokens</a></code></li>
2620 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2621 <div class="directive-section"><h2><a name="ServerTokens" id="ServerTokens">ServerTokens</a> <a name="servertokens" id="servertokens">Directive</a></h2>
2622 <table class="directive">
2623 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the Server HTTP response header</td></tr>
2624 <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>
2625 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ServerTokens Full</code></td></tr>
2626 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2627 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2628 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2630 <p>This directive controls whether <code>Server</code> response
2631 header field which is sent back to clients includes a
2632 description of the generic OS-type of the server as well as
2633 information about compiled-in modules.</p>
2636 <dt><code>ServerTokens Prod[uctOnly]</code></dt>
2638 <dd>Server sends (<em>e.g.</em>): <code>Server:
2641 <dt><code>ServerTokens Major</code></dt>
2643 <dd>Server sends (<em>e.g.</em>): <code>Server:
2644 Apache/2</code></dd>
2646 <dt><code>ServerTokens Minor</code></dt>
2648 <dd>Server sends (<em>e.g.</em>): <code>Server:
2649 Apache/2.0</code></dd>
2651 <dt><code>ServerTokens Min[imal]</code></dt>
2653 <dd>Server sends (<em>e.g.</em>): <code>Server:
2654 Apache/2.0.41</code></dd>
2656 <dt><code>ServerTokens OS</code></dt>
2658 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2661 <dt><code>ServerTokens Full</code> (or not specified)</dt>
2663 <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
2664 (Unix) PHP/4.2.2 MyMod/1.2</code></dd>
2667 <p>This setting applies to the entire server, and cannot be
2668 enabled or disabled on a virtualhost-by-virtualhost basis.</p>
2670 <p>After version 2.0.44, this directive also controls the
2671 information presented by the <code class="directive"><a href="#serversignature">ServerSignature</a></code> directive.</p>
2675 <li><code class="directive"><a href="#serversignature">ServerSignature</a></code></li>
2678 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2679 <div class="directive-section"><h2><a name="SetHandler" id="SetHandler">SetHandler</a> <a name="sethandler" id="sethandler">Directive</a></h2>
2680 <table class="directive">
2681 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Forces all matching files to be processed by a
2683 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetHandler <var>handler-name</var>|None</code></td></tr>
2684 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2685 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2686 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2687 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2688 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Moved into the core in Apache 2.0</td></tr>
2690 <p>When placed into an <code>.htaccess</code> file or a
2691 <code class="directive"><a href="#directory"><Directory></a></code> or
2692 <code class="directive"><a href="#location"><Location></a></code>
2693 section, this directive forces all matching files to be parsed
2694 through the <a href="../handler.html">handler</a> given by
2695 <var>handler-name</var>. For example, if you had a directory you
2696 wanted to be parsed entirely as imagemap rule files, regardless
2697 of extension, you might put the following into an
2698 <code>.htaccess</code> file in that directory:</p>
2700 <div class="example"><p><code>
2701 SetHandler imap-file
2704 <p>Another example: if you wanted to have the server display a
2705 status report whenever a URL of
2706 <code>http://servername/status</code> was called, you might put
2707 the following into <code>httpd.conf</code>:</p>
2709 <div class="example"><p><code>
2710 <Location /status><br />
2711 <span class="indent">
2712 SetHandler server-status<br />
2719 <li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
2722 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2723 <div class="directive-section"><h2><a name="SetInputFilter" id="SetInputFilter">SetInputFilter</a> <a name="setinputfilter" id="setinputfilter">Directive</a></h2>
2724 <table class="directive">
2725 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process client requests and POST
2727 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetInputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
2728 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2729 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2730 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2731 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2733 <p>The <code class="directive">SetInputFilter</code> directive sets the
2734 filter or filters which will process client requests and POST
2735 input when they are received by the server. This is in addition to
2736 any filters defined elsewhere, including the
2737 <code class="directive"><a href="../mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>
2740 <p>If more than one filter is specified, they must be separated
2741 by semicolons in the order in which they should process the
2746 <li><a href="../filter.html">Filters</a> documentation</li>
2749 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2750 <div class="directive-section"><h2><a name="SetOutputFilter" id="SetOutputFilter">SetOutputFilter</a> <a name="setoutputfilter" id="setoutputfilter">Directive</a></h2>
2751 <table class="directive">
2752 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the filters that will process responses from the
2754 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetOutputFilter <var>filter</var>[;<var>filter</var>...]</code></td></tr>
2755 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
2756 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
2757 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2758 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2760 <p>The <code class="directive">SetOutputFilter</code> directive sets the filters
2761 which will process responses from the server before they are
2762 sent to the client. This is in addition to any filters defined
2763 elsewhere, including the
2764 <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>
2767 <p>For example, the following configuration will process all files
2768 in the <code>/www/data/</code> directory for server-side
2771 <div class="example"><p><code>
2772 <Directory /www/data/><br />
2773 <span class="indent">
2774 SetOutputFilter INCLUDES<br />
2779 <p>If more than one filter is specified, they must be separated
2780 by semicolons in the order in which they should process the
2785 <li><a href="../filter.html">Filters</a> documentation</li>
2788 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2789 <div class="directive-section"><h2><a name="TimeOut" id="TimeOut">TimeOut</a> <a name="timeout" id="timeout">Directive</a></h2>
2790 <table class="directive">
2791 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Amount of time the server will wait for
2792 certain events before failing a request</td></tr>
2793 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TimeOut <var>number</var></code></td></tr>
2794 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TimeOut 300</code></td></tr>
2795 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2796 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2797 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2799 <p>The <code class="directive">TimeOut</code> directive currently defines
2800 the amount of time Apache will wait for three things:</p>
2803 <li>The total amount of time it takes to receive a GET
2806 <li>The amount of time between receipt of TCP packets on a
2807 POST or PUT request.</li>
2809 <li>The amount of time between ACKs on transmissions of TCP
2810 packets in responses.</li>
2813 <p>We plan on making these separately configurable at some point
2814 down the road. The timer used to default to 1200 before 1.2,
2815 but has been lowered to 300 which is still far more than
2816 necessary in most situations. It is not set any lower by
2817 default because there may still be odd places in the code where
2818 the timer is not reset when a packet is sent. </p>
2821 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2822 <div class="directive-section"><h2><a name="UseCanonicalName" id="UseCanonicalName">UseCanonicalName</a> <a name="usecanonicalname" id="usecanonicalname">Directive</a></h2>
2823 <table class="directive">
2824 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures how the server determines its own name and
2826 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName On|Off|DNS</code></td></tr>
2827 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName On</code></td></tr>
2828 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
2829 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2830 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2832 <p>In many situations Apache must construct a <em>self-referential</em>
2833 URL -- that is, a URL that refers back to the same server. With
2834 <code>UseCanonicalName On</code> Apache will use the hostname and port
2835 specified in the <code class="directive"><a href="#servername">ServerName</a></code>
2836 directive to construct the canonical name for the server. This name
2837 is used in all self-referential URLs, and for the values of
2838 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in CGIs.</p>
2840 <p>With <code>UseCanonicalName Off</code> Apache will form
2841 self-referential URLs using the hostname and port supplied by
2842 the client if any are supplied (otherwise it will use the
2843 canonical name, as defined above). These values are the same
2844 that are used to implement <a href="../vhosts/name-based.html">name based virtual hosts</a>,
2845 and are available with the same clients. The CGI variables
2846 <code>SERVER_NAME</code> and <code>SERVER_PORT</code> will be
2847 constructed from the client supplied values as well.</p>
2849 <p>An example where this may be useful is on an intranet server
2850 where you have users connecting to the machine using short
2851 names such as <code>www</code>. You'll notice that if the users
2852 type a shortname, and a URL which is a directory, such as
2853 <code>http://www/splat</code>, <em>without the trailing
2854 slash</em> then Apache will redirect them to
2855 <code>http://www.domain.com/splat/</code>. If you have
2856 authentication enabled, this will cause the user to have to
2857 authenticate twice (once for <code>www</code> and once again
2858 for <code>www.domain.com</code> -- see <a href="http://httpd.apache.org/docs/misc/FAQ.html#prompted-twice">the
2859 FAQ on this subject for more information</a>). But if
2860 <code class="directive">UseCanonicalName</code> is set <code>Off</code>, then
2861 Apache will redirect to <code>http://www/splat/</code>.</p>
2863 <p>There is a third option, <code>UseCanonicalName DNS</code>,
2864 which is intended for use with mass IP-based virtual hosting to
2865 support ancient clients that do not provide a
2866 <code>Host:</code> header. With this option Apache does a
2867 reverse DNS lookup on the server IP address that the client
2868 connected to in order to work out self-referential URLs.</p>
2870 <div class="warning"><h3>Warning</h3>
2871 <p>If CGIs make assumptions about the values of <code>SERVER_NAME</code>
2872 they may be broken by this option. The client is essentially free
2873 to give whatever value they want as a hostname. But if the CGI is
2874 only using <code>SERVER_NAME</code> to construct self-referential URLs
2875 then it should be just fine.</p>
2880 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
2881 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
2884 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
2885 <div class="directive-section"><h2><a name="VirtualHost" id="VirtualHost"><VirtualHost></a> <a name="virtualhost" id="virtualhost">Directive</a></h2>
2886 <table class="directive">
2887 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Contains directives that apply only to a specific
2888 hostname or IP address</td></tr>
2889 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><VirtualHost
2890 <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
2891 ...> ... </VirtualHost></code></td></tr>
2892 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
2893 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
2894 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
2896 <p><code class="directive"><VirtualHost></code> and
2897 <code></VirtualHost></code> are used to enclose a group of
2898 directives that will apply only to a particular virtual host. Any
2899 directive that is allowed in a virtual host context may be
2900 used. When the server receives a request for a document on a
2901 particular virtual host, it uses the configuration directives
2902 enclosed in the <code class="directive"><VirtualHost></code>
2903 section. <var>Addr</var> can be:</p>
2906 <li>The IP address of the virtual host;</li>
2908 <li>A fully qualified domain name for the IP address of the
2911 <li>The character <code>*</code>, which is used only in combination with
2912 <code>NameVirtualHost *</code> to match all IP addresses; or</li>
2914 <li>The string <code>_default_</code>, which is used only
2915 with IP virtual hosting to catch unmatched IP addresses.</li>
2918 <div class="example"><h3>Example</h3><p><code>
2919 <VirtualHost 10.1.2.3><br />
2920 <span class="indent">
2921 ServerAdmin webmaster@host.foo.com<br />
2922 DocumentRoot /www/docs/host.foo.com<br />
2923 ServerName host.foo.com<br />
2924 ErrorLog logs/host.foo.com-error_log<br />
2925 TransferLog logs/host.foo.com-access_log<br />
2927 </VirtualHost>
2931 <p>IPv6 addresses must be specified in square brackets because
2932 the optional port number could not be determined otherwise. An
2933 IPv6 example is shown below:</p>
2935 <div class="example"><p><code>
2936 <VirtualHost [fe80::a00:20ff:fea7:ccea]><br />
2937 <span class="indent">
2938 ServerAdmin webmaster@host.example.com<br />
2939 DocumentRoot /www/docs/host.example.com<br />
2940 ServerName host.example.com<br />
2941 ErrorLog logs/host.example.com-error_log<br />
2942 TransferLog logs/host.example.com-access_log<br />
2944 </VirtualHost>
2947 <p>Each Virtual Host must correspond to a different IP address,
2948 different port number or a different host name for the server,
2949 in the former case the server machine must be configured to
2950 accept IP packets for multiple addresses. (If the machine does
2951 not have multiple network interfaces, then this can be
2952 accomplished with the <code>ifconfig alias</code> command -- if
2953 your OS supports it).</p>
2955 <div class="note"><h3>Note</h3>
2956 <p>The use of <code class="directive"><VirtualHost></code> does
2957 <strong>not</strong> affect what addresses Apache listens on. You
2958 may need to ensure that Apache is listening on the correct addresses
2959 using <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>.</p>
2962 <p>When using IP-based virtual hosting, the special name
2963 <code>_default_</code> can be specified in
2964 which case this virtual host will match any IP address that is
2965 not explicitly listed in another virtual host. In the absence
2966 of any <code>_default_</code> virtual host the "main" server config,
2967 consisting of all those definitions outside any VirtualHost
2968 section, is used when no IP-match occurs. (But note that any IP
2969 address that matches a <code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code> directive will use neither
2970 the "main" server config nor the <code>_default_</code> virtual host.
2971 See the <a href="../vhosts/name-based.html">name-based virtual hosting</a>
2972 documentation for further details.)</p>
2974 <p>You can specify a <code>:port</code> to change the port that is
2975 matched. If unspecified then it defaults to the same port as the
2976 most recent <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
2977 statement of the main server. You may also specify <code>:*</code>
2978 to match all ports on that address. (This is recommended when used
2979 with <code>_default_</code>.)</p>
2981 <div class="warning"><h3>Security</h3>
2982 <p>See the <a href="../misc/security_tips.html">security tips</a>
2983 document for details on why your security could be compromised if the
2984 directory where logfiles are stored is writable by anyone other
2985 than the user that starts the server.</p>
2990 <li><a href="../vhosts/">Apache Virtual Host documentation</a></li>
2991 <li><a href="../dns-caveats.html">Warnings about DNS and
2993 <li><a href="../bind.html">Setting
2994 which addresses and ports Apache uses</a></li>
2995 <li><a href="../sections.html">How <Directory>, <Location>
2996 and <Files> sections work</a> for an explanation of how these
2997 different sections are combined when a request is received</li>
3002 <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
3003 <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>