fanf 00/09/13 12:56:27
Modified: htdocs/manual/vhosts examples.html Log: Since IP-based vhosting is strongly discouraged by the IP address registraries and since NameVirtualHost * simplifies the majority of configurations, re-order the examples to put solutions for more common problems earlier in the file. Revision Changes Path 1.10 +134 -136 httpd-docs-1.3/htdocs/manual/vhosts/examples.html Index: examples.html =================================================================== RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/vhosts/examples.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- examples.html 2000/09/12 17:04:20 1.9 +++ examples.html 2000/09/13 19:56:26 1.10 @@ -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> @@ -30,48 +31,21 @@ <LI><A HREF="#default">Using <CODE>_default_</CODE> vhosts</A> <LI><A HREF="#migrate">Migrating a named-based vhost to an IP-based vhost</A> <LI><A HREF="#serverpath">Using the <CODE>ServerPath</CODE> directive</A> -<LI><A HREF="#purename">Purely name-based vhosting</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. - <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>Compatibility:</STRONG> + This syntax was added in Apache 1.3.13. -<LI><STRONG>Setup 2:</STRONG> - Same as setup 1, but we don't want to have a dedicated 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> @@ -79,71 +53,33 @@ ... 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> + NameVirtualHost * - <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> + <VirtualHost *> DocumentRoot /www/domain ServerName www.domain.tld ... </VirtualHost> - - <VirtualHost 111.22.33.55:8080> - ServerName www-cache.domain.tld + + <VirtualHost *> + DocumentRoot /www/subdomain + ServerName www.sub.domain.tld ... - <Directory proxy:> - Order Deny,Allow - Deny from all - Allow from 111.22.33 - </Directory> - </VirtualHost> + </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. + 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> + </UL> + <HR> -<H3><A NAME="name">Name-based vhosts only</A></H3> +<H3><A NAME="name">More complicated name-based vhosts</A></H3> <UL> @@ -262,6 +198,115 @@ <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> + <H3><A NAME="mixed">Mixed name-/IP-based vhosts</A></H3> <UL> @@ -540,53 +585,6 @@ </BLOCKQUOTE> </UL> - -<HR> - -<H3><A NAME="purename">Purely name-based vhosting</A></H3> - -<UL> - -<LI><STRONG>Compatibility:</STRONG> - This feature was added in Apache 1.3.13. - -<LI><STRONG>Setup:</STRONG> - The server machine has an IP address - which resolves to the 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 - ServerName server.domain.tld - - NameVirtualHost * - - <VirtualHost *> - DocumentRoot /www/domain - ServerName www.domain.tld - ... - </VirtualHost> - - <VirtualHost *> - DocumentRoot /www/subdomain - ServerName www.sub.domain.tld - ... - </VirtualHost> - </PRE> - There are no unspecified - addresses/ports, therefore the main server serves - no requests. Due to the fact - that <SAMP>www.domain.tld</SAMP> has the highest priority - it can be seen as the <CITE>default</CITE> or - <CITE>primary</CITE> server. - </BLOCKQUOTE> - <P> - -</UL> <LI><STRONG>Setup:</STRONG> <!--#include virtual="footer.html" -->