2N/A<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2N/A <
title>Apache module mod_vhost_alias</
title>
2N/A <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 2N/A <
body bgcolor="#FFFFFF" text="#000000" link="#0000FF" 2N/A vlink="#000080" alink="#FF0000">
2N/A <
h1 align="CENTER">Module mod_vhost_alias</
h1>
2N/A <
p>This module provides support for <
a 2N/A rel="Help"><
strong>Status:</
strong></
a> Extension<
br />
32N/A rel="Help"><
strong>Source File:</
strong></
a>
313N/A rel="Help"><
strong>Module Identifier:</
strong></
a>
313N/A vhost_alias_module<
br />
313N/A rel="Help"><
strong>Compatibility:</
strong></
a> Available in
313N/A Apache 1.3.7 and later.</
p>
2104N/A <
p>This module creates dynamically configured virtual hosts, by
313N/A allowing the IP address
and/
or the <
code>Host:</
code> header of
313N/A the HTTP request to be used as part of the pathname to
313N/A determine what files to serve. This allows for easy use of a
313N/A huge number of virtual hosts with similar configurations.</
p>
4357N/A href="#virtualdocumentroot">VirtualDocumentRoot</
a></
li>
4357N/A href="#virtualdocumentrootip">VirtualDocumentRootIP</
a></
li>
127N/A <
li><
a href="#virtualscriptalias">VirtualScriptAlias</
a></
li>
3817N/A href="#virtualscriptaliasip">VirtualScriptAliasIP</
a></
li>
3817N/A <
h2>Directory Name Interpolation</
h2>
327N/A <
p>All the directives in this module interpolate a string into
327N/A a pathname. The interpolated string (henceforth called the
327N/A "name") may be either the server name (see the <
a 327N/A directive for details on how this is determined) or the IP
327N/A address of the virtual host on the server in dotted-quad
327N/A format. The interpolation is controlled by specifiers inspired
327N/A by <
code>printf</
code> which have a number of formats:</
p>
327N/A <
dt><
code>%%</
code></
dt>
3817N/A <
dd>insert a <
code>%</
code></
dd>
2217N/A <
dd>insert the port number of the virtual host</
dd>
177N/A <
dd>insert (part of) the name</
dd>
4437N/A <
p><
code>N</
code> and <
code>M</
code> are used to specify
3951N/A substrings of the name. <
code>N</
code> selects from the
3951N/A dot-separated components of the name, and <
code>M</
code>
3951N/A selects characters within whatever <
code>N</
code> has selected.
2N/A <
code>M</
code> is optional and defaults to zero if it isn't
3951N/A present; the dot must be present if and only if <
code>M</
code>
883N/A is present. The interpretation is as follows:</
p>
38N/A <
dt><
code>0</
code></
dt>
477N/A <
dd>the second part</
dd>
38N/A <
dt><
code>-1</
code></
dt>
6N/A <
dd>the last part</
dd>
3936N/A <
dd>the penultimate part</
dd>
34N/A <
dd>the second and all subsequent parts</
dd>
94N/A <
dt><
code>-2+</
code></
dt>
156N/A <
dd>the penultimate and all preceding parts</
dd>
34N/A <
dt><
code>1+</
code> and <
code>-1+</
code></
dt>
1251N/A <
dd>the same as <
code>0</
code></
dd>
1256N/A If <
code>N</
code> or <
code>M</
code> is greater than the number
72N/A of parts available a single underscore is interpolated. <
br />
61N/A <
p>For simple name-based virtual hosts you might use the
220N/A following directives in your server configuration file:</
p>
61N/A UseCanonicalName Off
172N/A <
p>For a very large number of virtual hosts it is a good idea
61N/A to arrange the files to reduce the size of the
152N/A <
code>vhosts</
code> directory. To do this you might use the
74N/A following in your configuration file:</
p>
61N/A will be satisfied by the file
172N/A A more even spread of files can be achieved by hashing from the
61N/A end of the name, for example:
454N/A The example request would come from
172N/A Alternatively you might use:
152N/A The example request would come from
220N/A <
p>For IP-based virtual hosting you might use the following in
43N/A your configuration file:</
p>
64N/A UseCanonicalName DNS
64N/A would be satisfied by the file
220N/A 10.20.30.40. A request for
64N/A be satisfied by executing the program
64N/A <
p>If you want to include the <
code>.</
code> character in a
64N/A <
code>VirtualDocumentRoot</
code> directive, but it clashes with
64N/A a <
code>%</
code> directive, you can work around the problem in
64N/A the following way:</
p>
34N/A will be satisfied by the file
12N/A directives</
a> <
code>%V</
code> and <
code>%A</
code> are useful
12N/A in conjunction with this module.</
p>
12N/A <
h2><
a id="virtualdocumentroot" 12N/A name="virtualdocumentroot">VirtualDocumentRoot
369N/A rel="Help"><
strong>Syntax:</
strong></
a> VirtualDocumentRoot
3056N/A <
em>interpolated-directory</
em><
br />
4085N/A rel="Help"><
strong>Default:</
strong></
a> None<
br />
61N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
61N/A rel="Help"><
strong>Status:</
strong></
a> Extension<
br />
12N/A rel="Help"><
strong>Module:</
strong></
a> mod_vhost_alias<
br />
4085N/A rel="Help"><
strong>Compatibility:</
strong></
a>
181N/A VirtualDocumentRoot is only available in 1.3.7 and later.</
p>
12N/A <
p>The <
code>VirtualDocumentRoot</
code> directive allows you to
4085N/A determine where Apache will find your documents based on the
61N/A value of the server name. The result of expanding
61N/A <
em>interpolated-directory</
em> is used as the root of the
12N/A document tree in a similar manner to the <
a 279N/A directive's argument. If <
em>interpolated-directory</
em> is
279N/A <
code>none</
code> then <
code>VirtaulDocumentRoot</
code> is
181N/A turned off. This directive cannot be used in the same context
181N/A href="#virtualdocumentrootip"><
code>VirtualDocumentRootIP</
code></
a>.</
p>
3864N/A <
h2><
a id="virtualdocumentrootip" 3864N/A name="virtualdocumentrootip">VirtualDocumentRootIP
3558N/A rel="Help"><
strong>Syntax:</
strong></
a> VirtualDocumentRootIP
3558N/A <
em>interpolated-directory</
em><
br />
3558N/A rel="Help"><
strong>Default:</
strong></
a> None<
br />
3864N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
3864N/A rel="Help"><
strong>Status:</
strong></
a> Extension<
br />
3558N/A rel="Help"><
strong>Module:</
strong></
a> mod_vhost_alias<
br />
3558N/A rel="Help"><
strong>Compatibility:</
strong></
a>
3747N/A VirtualDocumentRootIP is only available in 1.3.7 and later.</
p>
3747N/A <
p>The <
code>VirtualDocumentRootIP</
code> directive is like the
3558N/A href="#virtualdocumentroot"><
code>VirtualDocumentRoot</
code></
a>
3558N/A directive, except that it uses the IP address of the server end
3558N/A of the connection instead of the server name.</
p>
3558N/A <
h2><
a id="virtualscriptalias" 3558N/A name="virtualscriptalias">VirtualScriptAlias directive</
a></
h2>
4286N/A rel="Help"><
strong>Syntax:</
strong></
a> VirtualScriptAlias
3558N/A <
em>interpolated-directory</
em><
br />
3747N/A rel="Help"><
strong>Default:</
strong></
a> None<
br />
3558N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
3558N/A rel="Help"><
strong>Status:</
strong></
a> Extension<
br />
3750N/A rel="Help"><
strong>Module:</
strong></
a> mod_vhost_alias<
br />
3750N/A rel="Help"><
strong>Compatibility:</
strong></
a>
3558N/A VirtualScriptAlias is only available in 1.3.7 and later.</
p>
3558N/A <
p>The <
code>VirtualScriptAlias</
code> directive allows you to
3864N/A determine where Apache will find CGI scripts in a similar
3558N/A href="#virtualdocumentroot"><
code>VirtualDocumentRoot</
code></
a>
3558N/A does for other documents. It matches requests for URIs starting
4286N/A <
code>/cgi-bin/</
code>, much like <
code><
a 3558N/A /cgi-bin/</
code> would.</
p>
3750N/A <
h2><
a id="virtualscriptaliasip" 3558N/A name="virtualscriptaliasip">VirtualScriptAliasIP
3558N/A rel="Help"><
strong>Syntax:</
strong></
a> VirtualScriptAliasIP
3558N/A <
em>interpolated-directory</
em><
br />
4286N/A rel="Help"><
strong>Default:</
strong></
a> None<
br />
3558N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
3558N/A rel="Help"><
strong>Status:</
strong></
a> Extension<
br />
3558N/A rel="Help"><
strong>Module:</
strong></
a> mod_vhost_alias<
br />
3558N/A rel="Help"><
strong>Compatibility:</
strong></
a>
3558N/A VirtualScriptAliasIP is only available in 1.3.7 and later.</
p>
3558N/A <
p>The <
code>VirtualScriptAliasIP</
code> directive is like the
3750N/A href="#virtualscriptalias"><
code>VirtualScriptAlias</
code></
a>
3750N/A directive, except that it uses the IP address of the server end
3750N/A of the connection instead of the server name.</
p>
3353N/A <
h3 align="CENTER">Apache HTTP Server Version 1.3</
h3>