home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _DE98C58C6B60B10CEA48ABE93E35698F < prev    next >
Extensible Markup Language  |  2007-09-01  |  17KB  |  312 lines

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