Apache Help

paulb at savagesoft.com paulb at savagesoft.com
Thu Feb 28 19:26:42 CST 2002


I have setup a machine like the following, the differences I noticed is
that I used an IP address, which must be the same for both.  I looked in
my Apache book I had crossed out the domain name and wrote "put ip of
NameVirtual Host.

I allso have the directory seperated.

Listen 10.10.10.80
NameVirualHost 10.10.10.80

   .
   .
   .

<VirtualHost 10.10.10.80>
ServerName domain1.net
DocumentRoot /var/www/domain1/html
</VirtualHost>

<VirtualHost 10.10.10.80>
ServerName domain2.org
DocumentRoot /var/www/domain2/html
</VirtualHost>

Paul Barham

On Thu, 28 Feb 2002, Gerald Combs wrote:

> On Thu, 28 Feb 2002, Michael Pratt wrote:
> 
> > I am trying to set up multiple domains using one IP  I have this in my 
> > httpd.conf
> > 
> > NameVirtualHost <DSL IP ADDRESS>
> > 
> > <VirtualHost domain1.net>
> > DocumentRoot /var/www/html
> > ServerName domain1.net
> > </VirtualHost>
> > 
> > <VirtualHost domain2.org>
> > DocumentRoot /var/www/html/domain2
> > ServerName domain2.org
> > </VirtualHost>
> >
> > The problem I have is no matter what domain I put in it goes to domain1.net
> > 
> > how can I set Apache up to point Domain1 to /var/www/html and Domain2 to 
> > /var/www/html/domain2?
> 
> What do domain1.net and domain2.org resolve to?  You might try changing
> each of the "VirtualHost" directives to point to your DSL IP address
> instead of a hostname.  According to the Apache docs, you can also
> dispense with any IP address dependencies by doing the following:
> 
> NameVirtualHost *
> 
> <VirtualHost *>
> DocumentRoot /var/www/html
> ServerName domain1.net
> </VirtualHost>
> 
> <VirtualHost *>
> DocumentRoot /var/www/html/domain2
> ServerName domain2.org
> </VirtualHost>
> 
> If I understand the documentation correctly, "NameVirtualHost" means "I
> want to run name-based virtual web sites on IP address(es) <x>," with a
> "*" meaning all IP addresses bound to the server.  
> 
> The IP address(es) specified in VirtualHost must correspond to an address
> or list of addresses specified in NameVirtualHost.  This lets you do
> goofy things like have IP addresses A, B, and C bound to the server
> with virtual host entry J responding to requests on addresses A and B,
> and virtual host entry K reponding to requests on addresses B and C
> (note the overlap), provided you have DNS set up correctly.
> 
> Once you have your VirtualHost properly matched with a NameVirtualHOst
> address, the ServerName directive can be used to match the "Host:"
> header that the client sends in its HTTP request.
> 
> BTW, "ServerName" can contain wildcards.  One of our client websites
> has a wildcard DNS entry that points "*.theirdomain.com" to the
> web server.  A corresponding "ServerName *.theirdomain.com" accepts
> connections to any host name under that domain.  A backend CGI figures
> out what data to send based on the hostname provided, so fetching
> "http://joebob.theirdomain.com/" gets different content than fetching
> "http://bobbiesue.theirdomain.com/".
> 
> 
> 
> 
> 
> 




More information about the Kclug mailing list