]> granicus.if.org Git - apache/commitdiff
Belatedly update the documentation to include the NameVirtualHost *
authorTony Finch <fanf@apache.org>
Thu, 19 Oct 2000 19:24:51 +0000 (19:24 +0000)
committerTony Finch <fanf@apache.org>
Thu, 19 Oct 2000 19:24:51 +0000 (19:24 +0000)
stuff. This isn't quite a sync with the 1.3 docco because we don't
want to mention 1.3 in the 2.0 docs.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86673 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/vhosts/details.html
docs/manual/vhosts/examples.html

index f14bd088a5b25d026248a7aef58a40cd5603d178..d481b7ce68bb80d08d89dd773c420670fca3fdb7 100644 (file)
@@ -69,7 +69,8 @@ results from DNS lookups) are called the vhost's <EM>address set</EM>.
 
 <P>Unless a <A HREF="../mod/core.html#namevirtualhost">NameVirtualHost</A>
 directive is used for a specific IP address the first vhost with
-that address is treated as an IP-based vhost.
+that address is treated as an IP-based vhost. The IP address can also
+be the wildcard <CODE>*</CODE>.
 
 <P>If name-based vhosts should be used a <CODE>NameVirtualHost</CODE>
 directive <EM>must</EM> appear with the IP address set to be used for the
@@ -202,6 +203,11 @@ for the port to which the client sent the request. If there is no
 matching <SAMP>_default_</SAMP> vhost the request is served from the
 main_server.
 
+<P>If the IP address is not found in the hash table then the match
+against the port number may also result in an entry corresponding to a
+<CODE>NameVirtualHost *</CODE>, which is subsequently handled like
+other name-based vhosts.
+
 <P>If the lookup succeeded (a corresponding list for the IP address was
 found) the next step is to decide if we have to deal with an IP-based
 or a name-base vhost.
@@ -309,6 +315,7 @@ taken to be a proxy request.
     <CODE>_default_</CODE> vhost which is your standard <CODE>Port</CODE>
     by default. A wildcard port can be specified (<EM>i.e.</EM>,
     <CODE>_default_:*</CODE>) to catch requests to any available port.
+    This also applies to <CODE>NameVirtualHost *</CODE> vhosts.
     <P>
     
 <LI>The main_server is only used to serve a request if the IP address
index c6e4fcc4bfb227386979e68575f97072272bd27a..d00a38a40b1479808f91d8010e54d92f894968a9 100644 (file)
@@ -18,8 +18,9 @@
 <H2>Base configuration</H2>
 
 <UL>
-<LI><A HREF="#ip">IP-based vhosts only</A>
-<LI><A HREF="#name">Name-based vhosts only</A>
+<LI><A HREF="#purename">Simple name-based vhosting</A>
+<LI><A HREF="#name">More complicated name-based vhosts</A>
+<LI><A HREF="#ip">IP-based vhosts</A>
 <LI><A HREF="#mixed">Mixed name-/IP-based vhosts</A>
 <LI><A HREF="#port">Port-based vhosts</A>
 </UL>
 
 <HR>
 
-<H3><A NAME="ip">IP-based vhosts only</A></H3>
+<H3><A NAME="purename">Simple name-based vhosting</A></H3>
 
 <UL>
 
-<LI><STRONG>Setup 1:</STRONG>
-    The server machine has two IP addresses (<SAMP>111.22.33.44</SAMP>
-    and <SAMP>111.22.33.55</SAMP>)
-    which resolve to the names <SAMP>server.domain.tld</SAMP> and
-    <SAMP>www.otherdomain.tld</SAMP> respectively.
-    The hostname <SAMP>www.domain.tld</SAMP> is an alias (CNAME)
-    for <SAMP>server.domain.tld</SAMP> and will represent the
-    main server.
+<LI><STRONG>Setup:</STRONG>
+    The server machine has a primary name <SAMP>server.domain.tld</SAMP>.
+    There are two aliases (CNAMEs) <SAMP>www.domain.tld</SAMP> and
+    <SAMP>www.sub.domain.tld</SAMP> for the address <SAMP>server.domain.tld</SAMP>.
     <P>
     <STRONG>Server configuration:</STRONG>
 
-
     <BLOCKQUOTE><PRE>
     ...
     Port 80
-    DocumentRoot /www/domain
-    ServerName www.domain.tld
+    ServerName server.domain.tld
 
-    &lt;VirtualHost 111.22.33.55&gt;
-    DocumentRoot /www/otherdomain
-    ServerName www.otherdomain.tld
-    ...
-    &lt;/VirtualHost&gt;
-    </PRE>
-    <SAMP>www.otherdomain.tld</SAMP> can only be reached through the
-    address <SAMP>111.22.33.55</SAMP>, while <SAMP>www.domain.tld</SAMP>
-    can only be reached through <SAMP>111.22.33.44</SAMP>
-    (which represents our main server).
-    </BLOCKQUOTE>
-    <P>
+    NameVirtualHost *
 
-<LI><STRONG>Setup 2:</STRONG>
-    Same as setup 1, but we don't want to have a dedicated main server.
-    <P>
-    <STRONG>Server configuration:</STRONG>
-
-    <BLOCKQUOTE><PRE>
-    ...
-    Port 80
-    ServerName server.domain.tld
-    
-    &lt;VirtualHost 111.22.33.44&gt;
+    &lt;VirtualHost *&gt;
     DocumentRoot /www/domain
     ServerName www.domain.tld
     ...
     &lt;/VirtualHost&gt;
-
-    &lt;VirtualHost 111.22.33.55&gt;
-    DocumentRoot /www/otherdomain
-    ServerName www.otherdomain.tld
+    
+    &lt;VirtualHost *&gt;
+    DocumentRoot /www/subdomain
+    ServerName www.sub.domain.tld
     ...
-    &lt;/VirtualHost&gt;
+    &lt;/VirtualHost&gt; 
     </PRE>
-    The main server can never catch a request, because all IP addresses
-    of our machine are in use for IP-based virtual hosts
-    (only <SAMP>localhost</SAMP> requests can hit the main server).
+    The asterisks match all addresses, so the main server serves no
+    requests. Due to the fact that <SAMP>www.domain.tld</SAMP> is first
+    in the configuration file, it has the highest priority and can be
+    seen as the <CITE>default</CITE> or <CITE>primary</CITE> server.
     </BLOCKQUOTE>
     <P>
-    
-<LI><STRONG>Setup 3:</STRONG>
-    The server machine has two IP addresses (<SAMP>111.22.33.44</SAMP>
-    and <SAMP>111.22.33.55</SAMP>)
-    which resolve to the names <SAMP>server.domain.tld</SAMP> and
-    <SAMP>www-cache.domain.tld</SAMP> respectively.
-    The hostname <SAMP>www.domain.tld</SAMP> is an alias (CNAME)
-    for <SAMP>server.domain.tld</SAMP> and will represent the
-    main server.
-    <SAMP>www-cache.domain.tld</SAMP> will become our proxy-cache 
-    listening on port 8080, while the web server itself uses the default
-    port 80.
-    <P>
-    <STRONG>Server configuration:</STRONG>
-
-    <BLOCKQUOTE><PRE>
-    ...
-    Port 80
-    Listen 111.22.33.44:80
-    Listen 111.22.33.55:8080
-    ServerName server.domain.tld
-    
-    &lt;VirtualHost 111.22.33.44:80&gt;
-    DocumentRoot /www/domain
-    ServerName www.domain.tld
-    ...
-    &lt;/VirtualHost&gt;
 
-    &lt;VirtualHost 111.22.33.55:8080&gt;
-    ServerName www-cache.domain.tld
-    ...
-      &lt;Directory proxy:&gt;
-      Order Deny,Allow
-      Deny from all
-      Allow from 111.22.33
-      &lt;/Directory&gt;
-    &lt;/VirtualHost&gt;
-    </PRE>
-    The main server can never catch a request, because all IP addresses
-    (apart from <SAMP>localhost</SAMP>) of our machine are in use for IP-based
-    virtual hosts. The web server can only be reached on the first address
-    through port 80 and the proxy only on the second address through port 8080.
-    </BLOCKQUOTE>
 </UL>
+
 <HR>
 
-<H3><A NAME="name">Name-based vhosts only</A></H3>
+<H3><A NAME="name">More complicated name-based vhosts</A></H3>
 
 <UL>
 
     <SAMP>111.22.33.55</SAMP> with an unknown or no <CODE>Host:</CODE>
     header will be served from <SAMP>www.otherdomain.tld</SAMP>.
     </BLOCKQUOTE>
+
+<LI><STRONG>Setup 3:</STRONG>
+       The server machine has two IP addresses (<SAMP>192.168.1.1</SAMP>
+       and <SAMP>111.22.33.55</SAMP>). The machine is sitting between
+       an internal (intranet) network and an external (internet) network.
+       Outside of the network, the name <SAMP>server1.domain.tld</SAMP>
+       resolves to the external address (<SAMP>111.22.33.55</SAMP>), but
+       inside the network, that same name resolves to the internal
+       address (<SAMP>192.168.1.1</SAMP>).<P>
+
+       The server can be made to respond to internal and external
+       requests with the same content, with just one <CODE>VirtualHost</CODE>
+       section.
+       <P>
+
+       <STRONG>Server configuration:</STRONG>
+
+       <BLOCKQUOTE><PRE>
+    ...
+    NameVirtualHost 192.168.1.1
+    NameVirtualHost 111.22.33.55
+
+    &lt;VirtualHost 192.168.1.1 111.22.33.55&gt;
+    DocumentRoot /www/server1
+    ServerName server1.domain.tld
+    ServerAlias server1
+    ...
+    &lt;/VirtualHost&gt;
+    </PRE></BLOCKQUOTE>
+
+       Now requests from both networks will be served from the same
+       <CODE>VirtualHost</CODE>
+
+<LI><STRONG>Setup 4:</STRONG>
+       You have multiple domains going to the same IP and also want
+       to serve multiple ports.  By defining the
+       ports in the "NameVirtualHost" tag, you can allow this to
+       work. If you try using <VirtualHost name:port> without the
+       NameVirtualHost name:port or you try to use the Port
+       directive, your configuration will not work.
+       <P>
+
+       <STRONG>Server configuration:</STRONG>
+
+       <BLOCKQUOTE><PRE>
+    ...   
+    NameVirtualHost 111.22.33.44:80
+    NameVirtualHost 111.22.33.44:8080
+
+    &lt;VirtualHost 111.22.33.44:80&gt;
+    ServerName www.domain.tld
+    DocumentRoot /www/domain-80
+    &lt;/VirtualHost&gt;
+
+    &lt;VirtualHost 111.22.33.44:8080&gt;
+    ServerName www.domain.tld
+    DocumentRoot /www/domain-8080
+    &lt;/VirtualHost&gt;
+
+    &lt;VirtualHost 111.22.33.44:80&gt;
+    ServerName www.otherdomain.tld
+    DocumentRoot /www/otherdomain-80
+    &lt;/VirtualHost&gt;
+
+    &lt;VirtualHost 111.22.33.44:8080&gt;
+    ServerName www.otherdomain.tld
+    DocumentRoot /www/otherdomain-8080
+    &lt;/VirtualHost&gt;
+
+    </PRE></BLOCKQUOTE>
+
+</UL>
+
+<HR>
+
+<H3><A NAME="ip">IP-based vhosts</A></H3>
+
+<UL>
+
+<LI><STRONG>Setup 1:</STRONG>
+    The server machine has two IP addresses (<SAMP>111.22.33.44</SAMP>
+    and <SAMP>111.22.33.55</SAMP>)
+    which resolve to the names <SAMP>server.domain.tld</SAMP> and
+    <SAMP>www.otherdomain.tld</SAMP> respectively.
+    The hostname <SAMP>www.domain.tld</SAMP> is an alias (CNAME)
+    for <SAMP>server.domain.tld</SAMP> and will represent the
+    main server.
+    <P>
+    <STRONG>Server configuration:</STRONG>
+
+
+    <BLOCKQUOTE><PRE>
+    ...
+    Port 80
+    DocumentRoot /www/domain
+    ServerName www.domain.tld
+
+    &lt;VirtualHost 111.22.33.55&gt;
+    DocumentRoot /www/otherdomain
+    ServerName www.otherdomain.tld
+    ...
+    &lt;/VirtualHost&gt;
+    </PRE>
+    <SAMP>www.otherdomain.tld</SAMP> can only be reached through the
+    address <SAMP>111.22.33.55</SAMP>, while <SAMP>www.domain.tld</SAMP>
+    can only be reached through <SAMP>111.22.33.44</SAMP>
+    (which represents our main server).
+    </BLOCKQUOTE>
+    <P>
+
+<LI><STRONG>Setup 2:</STRONG>
+    Same as setup 1, but we don't want to have a dedicated main server.
+    <P>
+    <STRONG>Server configuration:</STRONG>
+
+    <BLOCKQUOTE><PRE>
+    ...
+    Port 80
+    ServerName server.domain.tld
+    
+    &lt;VirtualHost 111.22.33.44&gt;
+    DocumentRoot /www/domain
+    ServerName www.domain.tld
+    ...
+    &lt;/VirtualHost&gt;
+
+    &lt;VirtualHost 111.22.33.55&gt;
+    DocumentRoot /www/otherdomain
+    ServerName www.otherdomain.tld
+    ...
+    &lt;/VirtualHost&gt;
+    </PRE>
+    The main server can never catch a request, because all IP addresses
+    of our machine are in use for IP-based virtual hosts
+    (only <SAMP>localhost</SAMP> requests can hit the main server).
+    </BLOCKQUOTE>
+    <P>
+    
+<LI><STRONG>Setup 3:</STRONG>
+    The server machine has two IP addresses (<SAMP>111.22.33.44</SAMP>
+    and <SAMP>111.22.33.55</SAMP>)
+    which resolve to the names <SAMP>server.domain.tld</SAMP> and
+    <SAMP>www-cache.domain.tld</SAMP> respectively.
+    The hostname <SAMP>www.domain.tld</SAMP> is an alias (CNAME)
+    for <SAMP>server.domain.tld</SAMP> and will represent the
+    main server.
+    <SAMP>www-cache.domain.tld</SAMP> will become our proxy-cache 
+    listening on port 8080, while the web server itself uses the default
+    port 80.
+    <P>
+    <STRONG>Server configuration:</STRONG>
+
+    <BLOCKQUOTE><PRE>
+    ...
+    Port 80
+    Listen 111.22.33.44:80
+    Listen 111.22.33.55:8080
+    ServerName server.domain.tld
+    
+    &lt;VirtualHost 111.22.33.44:80&gt;
+    DocumentRoot /www/domain
+    ServerName www.domain.tld
+    ...
+    &lt;/VirtualHost&gt;
+
+    &lt;VirtualHost 111.22.33.55:8080&gt;
+    ServerName www-cache.domain.tld
+    ...
+      &lt;Directory proxy:&gt;
+      Order Deny,Allow
+      Deny from all
+      Allow from 111.22.33
+      &lt;/Directory&gt;
+    &lt;/VirtualHost&gt;
+    </PRE>
+    The main server can never catch a request, because all IP addresses
+    (apart from <SAMP>localhost</SAMP>) of our machine are in use for IP-based
+    virtual hosts. The web server can only be reached on the first address
+    through port 80 and the proxy only on the second address through port 8080.
+    </BLOCKQUOTE>
 </UL>
 
 <HR>
 
 </UL> 
 
+<LI><STRONG>Setup:</STRONG>
 <!--#include virtual="footer.html" -->
 </BODY>
 </HTML>