upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / docs / manual / mod / mod_vhost_alias.html.en
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
7       -->
8 <title>mod_vhost_alias - 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>
13 <body>
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.0</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.0</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_vhost_alias</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_vhost_alias.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../tr/mod/mod_vhost_alias.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
26 </div>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for dynamically configured mass virtual
28 hosting</td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>vhost_alias_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_vhost_alias.c</td></tr></table>
32 <h3>Summary</h3>
33
34     <p>This module creates dynamically configured virtual hosts, by
35     allowing the IP address and/or the <code>Host:</code> header of
36     the HTTP request to be used as part of the pathname to
37     determine what files to serve. This allows for easy use of a
38     huge number of virtual hosts with similar configurations.</p>
39     
40     <div class="note"><h3>Note</h3>
41       <p>If <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> or <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code> are
42       used for translating URIs to filenames, they will override the
43       directives of <code class="module"><a href="../mod/mod_vhost_alias.html">mod_vhost_alias</a></code> described below. For
44       example, the following configuration will map <code>
45       /cgi-bin/script.pl</code> to <code>
46       /usr/local/apache2/cgi-bin/script.pl</code> in all cases:</p>
47
48       <div class="example"><p><code>
49         ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/<br />
50         VirtualScriptAlias /never/found/%0/cgi-bin/
51       </code></p></div>
52     </div>
53 </div>
54 <div id="quickview"><h3 class="directives">Directives</h3>
55 <ul id="toc">
56 <li><img alt="" src="../images/down.gif" /> <a href="#virtualdocumentroot">VirtualDocumentRoot</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#virtualdocumentrootip">VirtualDocumentRootIP</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#virtualscriptalias">VirtualScriptAlias</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#virtualscriptaliasip">VirtualScriptAliasIP</a></li>
60 </ul>
61 <h3>Topics</h3>
62 <ul id="topics">
63 <li><img alt="" src="../images/down.gif" /> <a href="#interpol">Directory Name Interpolation</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
65 </ul><h3>See also</h3>
66 <ul class="seealso">
67 <li><code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code></li>
68 <li><a href="../vhosts/mass.html">Dynamically configured mass 
69     virtual hosting</a></li>
70 </ul></div>
71 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
72 <div class="section">
73 <h2><a name="interpol" id="interpol">Directory Name Interpolation</a></h2>
74     
75
76     <p>All the directives in this module interpolate a string into
77     a pathname. The interpolated string (henceforth called the
78     "name") may be either the server name (see the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code>
79     directive for details on how this is determined) or the IP
80     address of the virtual host on the server in dotted-quad
81     format. The interpolation is controlled by specifiers inspired
82     by <code>printf</code> which have a number of formats:</p>
83
84 <table>
85
86 <tr><td><code>%%</code></td>
87 <td>insert a <code>%</code></td></tr>
88
89 <tr><td><code>%p</code></td>
90 <td>insert the port number of the virtual host</td></tr>
91
92 <tr><td><code>%N.M</code></td>
93 <td>insert (part of) the name</td></tr>
94      
95 </table>
96
97     <p><code>N</code> and <code>M</code> are used to specify
98     substrings of the name. <code>N</code> selects from the
99     dot-separated components of the name, and <code>M</code>
100     selects characters within whatever <code>N</code> has selected.
101     <code>M</code> is optional and defaults to zero if it isn't
102     present; the dot must be present if and only if <code>M</code>
103     is present. The interpretation is as follows:</p>
104
105     <table>
106       
107       <tr><td><code>0</code></td>
108       <td>the whole name</td></tr>
109
110       <tr><td><code>1</code></td>
111       <td>the first part</td></tr>
112
113       <tr><td><code>2</code></td>
114       <td>the second part</td></tr>
115
116       <tr><td><code>-1</code></td>
117       <td>the last part</td></tr>
118
119       <tr><td><code>-2</code></td>
120       <td>the penultimate part</td></tr>
121
122       <tr><td><code>2+</code></td>
123       <td>the second and all subsequent parts</td></tr>
124
125       <tr><td><code>-2+</code></td>
126       <td>the penultimate and all preceding parts</td></tr>
127
128       <tr><td><code>1+</code> and <code>-1+</code></td>
129       <td>the same as <code>0</code></td></tr>
130     </table>
131
132     <p>If <code>N</code> or <code>M</code> is greater than the number
133     of parts available a single underscore is interpolated. </p>
134
135 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
136 <div class="section">
137 <h2><a name="examples" id="examples">Examples</a></h2>
138     
139
140     <p>For simple name-based virtual hosts you might use the
141     following directives in your server configuration file:</p>
142
143     <div class="example"><p><code>
144       UseCanonicalName    Off<br />
145       VirtualDocumentRoot /usr/local/apache/vhosts/%0
146     </code></p></div>
147
148     <p>A request for
149     <code>http://www.example.com/directory/file.html</code> will be
150     satisfied by the file
151     <code>/usr/local/apache/vhosts/www.example.com/directory/file.html</code>.
152     </p> 
153
154     <p>For a very large number of virtual hosts it is a good idea
155     to arrange the files to reduce the size of the
156     <code>vhosts</code> directory. To do this you might use the
157     following in your configuration file:</p>
158
159     <div class="example"><p><code>
160       UseCanonicalName    Off<br />
161       VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
162     </code></p></div>
163
164     <p>A request for
165     <code>http://www.domain.example.com/directory/file.html</code>
166     will be satisfied by the file
167     <code>/usr/local/apache/vhosts/example.com/d/o/m/domain/directory/file.html</code>.</p>
168
169     <p>A more even spread of files can be achieved by hashing from the
170     end of the name, for example: </p>
171
172 <div class="example"><p><code>
173     VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2
174 </code></p></div>
175
176     <p>The example request would come from
177     <code>/usr/local/apache/vhosts/example.com/n/i/a/domain/directory/file.html</code>.</p>
178
179     <p>Alternatively you might use: </p>
180
181 <div class="example"><p><code>
182     VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
183 </code></p></div>
184
185     <p>The example request would come from
186     <code>/usr/local/apache/vhosts/example.com/d/o/m/ain/directory/file.html</code>.</p>
187
188     <p>For IP-based virtual hosting you might use the following in
189     your configuration file:</p>
190
191     <div class="example"><p><code>
192       UseCanonicalName DNS<br />
193       VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs<br />
194       VirtualScriptAliasIP  /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
195     </code></p></div>
196
197     <p>A request for
198     <code>http://www.domain.example.com/directory/file.html</code>
199     would be satisfied by the file
200     <code>/usr/local/apache/vhosts/10/20/30/40/docs/directory/file.html</code>
201     if the IP address of <code>www.domain.example.com</code> were
202     10.20.30.40. A request for
203     <code>http://www.domain.example.com/cgi-bin/script.pl</code> would
204     be satisfied by executing the program
205     <code>/usr/local/apache/vhosts/10/20/30/40/cgi-bin/script.pl</code>.</p>
206
207     <p>If you want to include the <code>.</code> character in a
208     <code>VirtualDocumentRoot</code> directive, but it clashes with
209     a <code>%</code> directive, you can work around the problem in
210     the following way:</p>
211
212 <div class="example"><p><code>
213     VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0
214 </code></p></div>
215
216     <p>A request for
217     <code>http://www.domain.example.com/directory/file.html</code>
218     will be satisfied by the file
219     <code>/usr/local/apache/vhosts/domain.example/directory/file.html</code>.</p>
220      
221     <p>The <code class="directive"><a href="../mod/mod_log_config.html#logformat">LogFormat</a></code>
222     directives <code>%V</code> and <code>%A</code> are useful
223     in conjunction with this module.</p>
224 </div>
225 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
226 <div class="directive-section"><h2><a name="VirtualDocumentRoot" id="VirtualDocumentRoot">VirtualDocumentRoot</a> <a name="virtualdocumentroot" id="virtualdocumentroot">Directive</a></h2>
227 <table class="directive">
228 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the document root
229 for a given virtual host</td></tr>
230 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualDocumentRoot <em>interpolated-directory</em>|none</code></td></tr>
231 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualDocumentRoot none</code></td></tr>
232 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
233 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
234 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
235 </table>
236
237     <p>The <code class="directive">VirtualDocumentRoot</code> directive allows you to
238     determine where Apache will find your documents based on the
239     value of the server name. The result of expanding
240     <em>interpolated-directory</em> is used as the root of the
241     document tree in a similar manner to the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> directive's argument. 
242     If <em>interpolated-directory</em> is <code>none</code> then
243     <code class="directive">VirtualDocumentRoot</code> is turned off. This directive 
244     cannot be used in the same context as <code class="directive"><a href="#virtualdocumentrootip">VirtualDocumentRootIP</a></code>.</p>
245
246
247 </div>
248 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
249 <div class="directive-section"><h2><a name="VirtualDocumentRootIP" id="VirtualDocumentRootIP">VirtualDocumentRootIP</a> <a name="virtualdocumentrootip" id="virtualdocumentrootip">Directive</a></h2>
250 <table class="directive">
251 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the document root
252 for a given virtual host</td></tr>
253 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualDocumentRootIP <em>interpolated-directory</em>|none</code></td></tr>
254 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualDocumentRootIP none</code></td></tr>
255 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
256 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
257 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
258 </table>
259
260 <p>The <code class="directive">VirtualDocumentRootIP</code> directive is like the
261     <code class="directive"><a href="#virtualdocumentroot">VirtualDocumentRoot</a></code>
262     directive, except that it uses the IP address of the server end
263     of the connection for directory interpolation instead of the server
264     name.</p>
265
266 </div>
267 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
268 <div class="directive-section"><h2><a name="VirtualScriptAlias" id="VirtualScriptAlias">VirtualScriptAlias</a> <a name="virtualscriptalias" id="virtualscriptalias">Directive</a></h2>
269 <table class="directive">
270 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the CGI directory for
271 a given virtual host</td></tr>
272 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualScriptAlias <em>interpolated-directory</em>|none</code></td></tr>
273 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualScriptAlias none</code></td></tr>
274 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
275 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
276 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
277 </table>
278
279     <p>The <code class="directive">VirtualScriptAlias</code> directive allows you to
280     determine where Apache will find CGI scripts in a similar
281     manner to <code class="directive"><a href="#virtualdocumentroot">VirtualDocumentRoot</a></code> does for other documents. It matches
282     requests for URIs starting <code>/cgi-bin/</code>, much like <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
283     <code>/cgi-bin/</code> would.</p>
284
285
286 </div>
287 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
288 <div class="directive-section"><h2><a name="VirtualScriptAliasIP" id="VirtualScriptAliasIP">VirtualScriptAliasIP</a> <a name="virtualscriptaliasip" id="virtualscriptaliasip">Directive</a></h2>
289 <table class="directive">
290 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the cgi directory for
291 a given virtual host</td></tr>
292 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualScriptAliasIP <em>interpolated-directory</em>|none</code></td></tr>
293 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualScriptAliasIP none</code></td></tr>
294 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
295 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
296 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
297 </table>
298
299     <p>The <code class="directive">VirtualScriptAliasIP</code> directive is like the
300     <code class="directive"><a href="#virtualscriptalias">VirtualScriptAlias</a></code>
301     directive, except that it uses the IP address of the server end
302     of the connection for directory interpolation instead of the server
303     name.</p>
304
305     
306 </div>
307 </div>
308 <div class="bottomlang">
309 <p><span>Available Languages: </span><a href="../en/mod/mod_vhost_alias.html" title="English">&nbsp;en&nbsp;</a> |
310 <a href="../tr/mod/mod_vhost_alias.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
311 </div><div id="footer">
312 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
313 <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>
314 </body></html>