lars 98/12/18 15:49:45
Modified: htdocs/manual/vhosts name-based.html Log: Some updates/modifications (based on the patch from the PR). PR: 3549 Submitted by: Joshua Slive <[EMAIL PROTECTED]> Revision Changes Path 1.9 +30 -15 apache-1.3/htdocs/manual/vhosts/name-based.html Index: name-based.html =================================================================== RCS file: /export/home/cvs/apache-1.3/htdocs/manual/vhosts/name-based.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- name-based.html 1998/09/17 12:33:12 1.8 +++ name-based.html 1998/12/18 23:49:44 1.9 @@ -40,34 +40,49 @@ <H2>Using non-IP Virtual Hosts</H2> <P>Using the new virtual hosts is quite easy, and superficially looks -like the old method. You simply add to one of the Apache configuration -files (most likely <CODE>httpd.conf</CODE> or <CODE>srm.conf</CODE>) -code similar to the following:</P> +like the old method. The notable difference between IP-based and +name-based virtual host configuration is the +<A HREF="../mod/core.html#namevirtualhost"><CODE>NameVirtualHost</CODE></A> +directive which specifies an IP address that should be used as a +target for name-based virtual hosts.</P> + +<P>For example, suppose that both <SAMP>www.domain.tld</SAMP> and +<SAMP>www.otherdomain.tld</SAMP> point at the IP address +<SAMP>111.22.33.44</SAMP>. Then you simply add to one of the Apache +configuration files (most likely <CODE>httpd.conf</CODE> or +<CODE>srm.conf</CODE>) code similar to the following:</P> + + + <PRE> NameVirtualHost 111.22.33.44 <VirtualHost 111.22.33.44> ServerName www.domain.tld - DocumentRoot /web/domain + DocumentRoot /www/domain </VirtualHost> -</PRE> -<P>The notable difference between IP-based and name-based virtual host -configuration is the -<A HREF="../mod/core.html#namevirtualhost"><CODE>NameVirtualHost</CODE></A> -directive which specifies an IP address that should be used as a target for -name-based virtual hosts. + <VirtualHost 111.22.33.44> + ServerName www.otherdomain.tld + DocumentRoot /www/otherdomain + </VirtualHost> +</PRE> <P>Of course, any additional directives can (and should) be placed into the <CODE><VirtualHost></CODE> section. To make this work, -all that is needed is to make sure that the name -<SAMP>www.domain.tld</SAMP> points to the IP address -<SAMP>111.22.33.44</SAMP></P> +all that is needed is to make sure that the names +<SAMP>www.domain.tld</SAMP> and <SAMP>www.otherdomain.tld</SAMP> +are pointing to the IP address <SAMP>111.22.33.44</SAMP></P> <P>Note: When you specify an IP address in a <CODE>NameVirtualHost</CODE> directive then requests to that IP address will only ever be served -by matching <VirtualHost>s. The "main server" will <STRONG>never</STRONG> -be served from the specified IP address. +by matching <VirtualHost>s. The "main server" will +<STRONG>never</STRONG> be served from the specified IP address. +If you start to use virtual hosts you should stop to use the "main server" +as an independent server and rather use it as a place for +configuration directives that are common for all your virtual hosts. +In other words, you should add a <VirtualHost> section for +<EM>every</EM> server (hostname) you want to maintain on your server. <P>Additionally, many servers may wish to be accessible by more than one name. For example, the example server might want to be accessible