fanf 00/10/19 12:24:55
Modified: htdocs/manual/vhosts examples.html Log: Belatedly update the documentation to include the NameVirtualHost * 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. Revision Changes Path 1.8 +203 -88 httpd-docs-2.0/htdocs/manual/vhosts/examples.html Index: examples.html =================================================================== RCS file: /home/cvs/httpd-docs-2.0/htdocs/manual/vhosts/examples.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- examples.html 2000/09/18 01:55:48 1.7 +++ examples.html 2000/10/19 19:24:51 1.8 @@ -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> @@ -34,115 +35,48 @@ <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 - - <VirtualHost 111.22.33.55> - DocumentRoot /www/otherdomain - ServerName www.otherdomain.tld - ... - </VirtualHost> - </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> + ServerName server.domain.tld -<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> + NameVirtualHost * - <BLOCKQUOTE><PRE> - ... - Port 80 - ServerName server.domain.tld - - <VirtualHost 111.22.33.44> + <VirtualHost *> DocumentRoot /www/domain ServerName www.domain.tld ... </VirtualHost> - - <VirtualHost 111.22.33.55> - DocumentRoot /www/otherdomain - ServerName www.otherdomain.tld + + <VirtualHost *> + DocumentRoot /www/subdomain + ServerName www.sub.domain.tld ... - </VirtualHost> + </VirtualHost> </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 - - <VirtualHost 111.22.33.44:80> - DocumentRoot /www/domain - ServerName www.domain.tld - ... - </VirtualHost> - - <VirtualHost 111.22.33.55:8080> - ServerName www-cache.domain.tld - ... - <Directory proxy:> - Order Deny,Allow - Deny from all - Allow from 111.22.33 - </Directory> - </VirtualHost> - </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> @@ -225,6 +159,186 @@ <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 + + <VirtualHost 192.168.1.1 111.22.33.55> + DocumentRoot /www/server1 + ServerName server1.domain.tld + ServerAlias server1 + ... + </VirtualHost> + </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 + + <VirtualHost 111.22.33.44:80> + ServerName www.domain.tld + DocumentRoot /www/domain-80 + </VirtualHost> + + <VirtualHost 111.22.33.44:8080> + ServerName www.domain.tld + DocumentRoot /www/domain-8080 + </VirtualHost> + + <VirtualHost 111.22.33.44:80> + ServerName www.otherdomain.tld + DocumentRoot /www/otherdomain-80 + </VirtualHost> + + <VirtualHost 111.22.33.44:8080> + ServerName www.otherdomain.tld + DocumentRoot /www/otherdomain-8080 + </VirtualHost> + + </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 + + <VirtualHost 111.22.33.55> + DocumentRoot /www/otherdomain + ServerName www.otherdomain.tld + ... + </VirtualHost> + </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 + + <VirtualHost 111.22.33.44> + DocumentRoot /www/domain + ServerName www.domain.tld + ... + </VirtualHost> + + <VirtualHost 111.22.33.55> + DocumentRoot /www/otherdomain + ServerName www.otherdomain.tld + ... + </VirtualHost> + </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 + + <VirtualHost 111.22.33.44:80> + DocumentRoot /www/domain + ServerName www.domain.tld + ... + </VirtualHost> + + <VirtualHost 111.22.33.55:8080> + ServerName www-cache.domain.tld + ... + <Directory proxy:> + Order Deny,Allow + Deny from all + Allow from 111.22.33 + </Directory> + </VirtualHost> + </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> @@ -508,6 +622,7 @@ </UL> +<LI><STRONG>Setup:</STRONG> <!--#include virtual="footer.html" --> </BODY> </HTML>