mod_vhost_alias.xml revision e942c741056732f50da2074b36fe59805d370650
0d26a2bd71224b954baab529bbadc4d676c35b95slive<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<modulesynopsis>
0d26a2bd71224b954baab529bbadc4d676c35b95slivehref="/vhosts/mass.html">dynamically configured mass virtual
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>This module creates dynamically configured virtual hosts, by
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen allowing the IP address and/or the <code>Host:</code> header of
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen the HTTP request to be used as part of the pathname to
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen determine what files to serve. This allows for easy use of a
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen huge number of virtual hosts with similar configurations.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>All the directives in this module interpolate a string into
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen a pathname. The interpolated string (henceforth called the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen "name") may be either the server name (see the <a
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen href="core.html#usecanonicalname"><code>UseCanonicalName</code></a>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen directive for details on how this is determined) or the IP
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen address of the virtual host on the server in dotted-quad
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen format. The interpolation is controlled by specifiers inspired
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen by <code>printf</code> which have a number of formats:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<td>insert the port number of the virtual host</td></tr>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p><code>N</code> and <code>M</code> are used to specify
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen substrings of the name. <code>N</code> selects from the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen dot-separated components of the name, and <code>M</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen selects characters within whatever <code>N</code> has selected.
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>M</code> is optional and defaults to zero if it isn't
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen present; the dot must be present if and only if <code>M</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen is present. The interpretation is as follows:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <td>the penultimate and all preceding parts</td></tr>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>If <code>N</code> or <code>M</code> is greater than the number
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen of parts available a single underscore is interpolated. </p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>For simple name-based virtual hosts you might use the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen following directives in your server configuration file:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen UseCanonicalName Off<br />
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>A request for
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>http://www.example.com/directory/file.html</code> will be
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen satisfied by the file
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/www.example.com/directory/file.html</code>.
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>For a very large number of virtual hosts it is a good idea
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen to arrange the files to reduce the size of the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>vhosts</code> directory. To do this you might use the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen following in your configuration file:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen UseCanonicalName Off<br />
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>A request for
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>http://www.example.isp.com/directory/file.html</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen will be satisfied by the file
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/isp.com/e/x/a/example/directory/file.html</code>.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>A more even spread of files can be achieved by hashing from the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen end of the name, for example: </p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The example request would come from
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/isp.com/e/l/p/example/directory/file.html</code>.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The example request would come from
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/isp.com/e/x/a/mple/directory/file.html</code>.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>For IP-based virtual hosting you might use the following in
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen your configuration file:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen UseCanonicalName DNS<br />
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs<br />
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>A request for
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>http://www.example.isp.com/directory/file.html</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen would be satisfied by the file
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/10/20/30/40/docs/directory/file.html</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen if the IP address of <code>www.example.com</code> were
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen 10.20.30.40. A request for
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>http://www.example.isp.com/cgi-bin/script.pl</code> would
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen be satisfied by executing the program
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/10/20/30/40/cgi-bin/script.pl</code>.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>If you want to include the <code>.</code> character in a
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>VirtualDocumentRoot</code> directive, but it clashes with
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen a <code>%</code> directive, you can work around the problem in
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen the following way:</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>A request for
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>http://www.example.isp.com/directory/file.html</code>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen will be satisfied by the file
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>/usr/local/apache/vhosts/example.isp/directory/file.html</code>.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The <directive module="mod_log_config">LogFormat</directive>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen directives <code>%V</code> and <code>%A</code> are useful
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen in conjunction with this module.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<directivesynopsis>
0d26a2bd71224b954baab529bbadc4d676c35b95slive<description>Dynamically configure the location of the document root
0d26a2bd71224b954baab529bbadc4d676c35b95slivefor a given virtual host</description>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<syntax>VirtualDocumentRoot <em>interpolated-directory</em></syntax>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<compatibility>VirtualDocumentRoot is only available in 1.3.7 and
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowenlater.</compatibility>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The <code>VirtualDocumentRoot</code> directive allows you to
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen determine where Apache will find your documents based on the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen value of the server name. The result of expanding
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <em>interpolated-directory</em> is used as the root of the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen document tree in a similar manner to the <directive
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen module="core">DocumentRoot</directive> directive's argument.
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen If <em>interpolated-directory</em> is <code>none</code> then
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <code>VirtaulDocumentRoot</code> is turned off. This directive
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen cannot be used in the same context as
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</directivesynopsis>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<directivesynopsis>
0d26a2bd71224b954baab529bbadc4d676c35b95slive<description>Dynamically configure the location of the document root
0d26a2bd71224b954baab529bbadc4d676c35b95slivefor a given virtual host</description>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<syntax>VirtualDocumentRootIP <em>interpolated-directory</em></syntax>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<compatibility>VirtualDocumentRootIP is only available in 1.3.7
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowenand later.</compatibility>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<p>The <code>VirtualDocumentRootIP</code> directive is like the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen directive, except that it uses the IP address of the server end
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen of the connection instead of the server name.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</directivesynopsis>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<directivesynopsis>
0d26a2bd71224b954baab529bbadc4d676c35b95slive<description>Dynamically configure the location of the CGI directory for
0d26a2bd71224b954baab529bbadc4d676c35b95slivea given virtual host</description>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<syntax>VirtualScriptAlias <em>interpolated-directory</em></syntax>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<compatibility>VirtualScriptAlias is only available in 1.3.7
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowenand later.</compatibility>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The <code>VirtualScriptAlias</code> directive allows you to
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen determine where Apache will find CGI scripts in a similar
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen does for other documents. It matches requests for URIs starting
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</directivesynopsis>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<directivesynopsis>
0d26a2bd71224b954baab529bbadc4d676c35b95slive<description>Dynamically configure the location of the cgi directory for
0d26a2bd71224b954baab529bbadc4d676c35b95slivea given virtual host</description>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<syntax>VirtualScriptAliasIP <em>interpolated-directory</em></syntax>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</contextlist>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen<compatibility>VirtualScriptAliasIP is only available in 1.3.7
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowenand later.</compatibility>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen <p>The <code>VirtualScriptAliasIP</code> directive is like the
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen href="#virtualscriptalias"><code>VirtualScriptAlias</code></a>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen directive, except that it uses the IP address of the server end
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen of the connection instead of the server name.</p>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</directivesynopsis>
63ab8205d2d1e2e4b6e7e4f81adde8782a85ea9drbowen</modulesynopsis>