httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <...@bourse.ch>
Subject Re: Virtual Host Problems Pulling Hair Out
Date Thu, 24 Jan 2002 08:42:13 GMT
>  I have been working on this same problem for a 
> week now and cannot figure this out. I am new 
> to Linux and Apache. I normally get things 
> worked out on my own but this has me stumped. 
> 
> Problem: I have 2 domain names that I am 
> wanting to host. The problem is that when I 
> type it in my browser 
> 
> www.domain1.com  it takes me to where it is 
> suppose to go.
> 
> www.domain2.com takes me to domain1 site.
> 

Your httpd.conf is a bit too long to plough through at this time in the
morning but I saw enough to say that it has a few errors. In particular,
You only need one NameVirtualHost directive for the IP address which
serves your name-based VHs.

Re-arrange it to look more like this (assuming your NBVHs are on
192.168.1.1):

NameVirtualHost 192.168.1.1

Listen 192.168.1.1
<VirtualHost 192.168.1.1>
  ServerName domain1
  DocumentRoot /path/to/domain1
</VirtualHost>
<VirtualHost 192.168.1.1>
  ServerName domain2
  DocumentRoot /path/to/domain2
</VirtualHost>

If you are assigning NBVHs to a particular IP address, don't refer to it
outside of the VH containers (i.e. with server level directives). In
fact, once you start to use VHs, it is usually wiser to put all sites
inside VHs and do away with all server level DocumentRoot, ServerName
etc. directives.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message