Re: domain mixed up problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-03-27 at 15:05 +0530, J. Bakshi wrote:
> Dear list,
> 
> I  have a remote server with 2 different domain pointing to the same
> server. I have configured some vhosts for these 2 domains. But I have
> found that the vhosts are working for both the domains. For an example
> say I have two domains  domain1.com  and  domain2.com
> 
> Now two vhosts are site1.domain1.com   and   site2.domain2.com
> 
> Now if you exchange the domains like site1.domain2.com it still works as
> before ( site1.domain1.com )
> How can I restrict this behavior so that  site1.domain1.com works but 
> site1.domain2.com not ?
> 
> Here are my vhost configuration
> 
> ## site1 on domain1
> NameVirtualHost  site1.domain1.com:80
> 
> <VirtualHost  site1.domain1.com:80>
> ServerName http://www.site1.domain1.com
> ServerAlias http://ble.site1.domain1.com
> 
> DocumentRoot /srv/www/htdocs/site1
> 
> DirectoryIndex index.php
> 
> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
> <Directory "/srv/www/htdocs/site1/">
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Options None
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
> 
> ## site2 on domain2
> NameVirtualHost  site2.domain2.com:80
> 
> <VirtualHost  site2.domain2.com:80>
> ServerName http://www.site2.domain2.com
> ServerAlias http://site2.domain2.com
> 
> DocumentRoot /srv/www/htdocs/site2
> 
> DirectoryIndex index.php
> 
> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
> <Directory "/srv/www/htdocs/site2/">
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Options None
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
> 
> 

Apache will serve any request that it receives. With vhosts, it tries to
find one matching the host header of the request. If one is not found,
it will serve the first vhost listed in the conf.

So, either dont let site2.domain1.com resolve to this server, or have a
default 'error' vhost appear first in your config file.

Tom


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux