etrader Posted March 28, 2009 Share Posted March 28, 2009 I have two domain on my server. I configured BIND DNS and two virtual host on apache server for them. The first domain works well, but when browsing the second domain, it shows the content of first apache virtual host, instead of the second one with the name of the second domain. Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/ Share on other sites More sharing options...
corbin Posted March 28, 2009 Share Posted March 28, 2009 What does the virtual host configuration look like in your httpd.conf? Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-795945 Share on other sites More sharing options...
etrader Posted March 28, 2009 Author Share Posted March 28, 2009 It's a long file on /etc/httpd/conf I think you mean the last part, which is <VirtualHost 200.35.149.48> DocumentRoot "/var/www/html/site1" <Directory "/var/www/html/site1"> allow from all Options +Indexes </Directory> </VirtualHost> <VirtualHost 200.35.149.48> DocumentRoot "/var/www/html/site2" <Directory "/var/www/html/site2"> allow from all Options +Indexes </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-795960 Share on other sites More sharing options...
corbin Posted March 28, 2009 Share Posted March 28, 2009 You need to be using name based virtual hosts. Basic example: NameVirtualHost *:80 <VirtualHost *:80> ServerName domain1.tld DocumentRoot "/path/to/doc/root/" </VirtualHost> <VirtualHost *:80> ServerName domain2.tld DocumentRoot "/path/to/doc/root2/" </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-795986 Share on other sites More sharing options...
etrader Posted March 28, 2009 Author Share Posted March 28, 2009 Thanks for your useful reply Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796005 Share on other sites More sharing options...
corbin Posted March 29, 2009 Share Posted March 29, 2009 No problem . Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796081 Share on other sites More sharing options...
etrader Posted March 29, 2009 Author Share Posted March 29, 2009 Theoretically, can it have an influence on the website speed? I feel the speed of loading was slightly faster when using the IP for the address Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796136 Share on other sites More sharing options...
corbin Posted March 29, 2009 Share Posted March 29, 2009 The only possible lag you may have felt would be the domain name resolving, which shouldn't be noticeable, and Apache handling the virtual host, which should definitely not be noticeable. In other words, it was probably in your head ;p. Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796263 Share on other sites More sharing options...
etrader Posted March 29, 2009 Author Share Posted March 29, 2009 Sorry for this, but the problem still persists The httpd.conf now looks like <VirtualHost *:80> DocumentRoot /var/www/html/site1 <Directory "/var/www/html/site1"> allow from all Options +Indexes </Directory> ServerName www.site1.com </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html/site2 <Directory "/var/www/html/site2"> allow from all Options +Indexes </Directory> ServerName www.site2.com </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796277 Share on other sites More sharing options...
corbin Posted March 29, 2009 Share Posted March 29, 2009 You have NameVirtualHost *:80 Somewhere, yes? Also, I don't think the <Directory> tags should be inside the <VirtualHost> tags. Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796288 Share on other sites More sharing options...
etrader Posted March 29, 2009 Author Share Posted March 29, 2009 I set it up through Webmin, and the <Directory> tags were created by Webmin Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-796355 Share on other sites More sharing options...
etrader Posted April 19, 2009 Author Share Posted April 19, 2009 You have NameVirtualHost *:80 Somewhere, yes? Also, I don't think the <Directory> tags should be inside the <VirtualHost> tags. You were quite write, corbin The problem was related to "NameVirtualHost *:80" Thanks a million Quote Link to comment https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/#findComment-814008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.