View Full Version : [ubuntu] 7.10 Domain Issues - VHosts?

April 30th, 2008, 08:18 PM
So for the last few days I have been pulling my hair out trying to solve this.

I have had a headless server running for about two weeks now and its all dandy. My domain is working great and there are no major issues.

Then I tried adding another domain name to the server.... No matter what I try (I have reconfiged apache about a billion times) I can not get the second domain to work. It just keeps redirecting to the first virtual host that I added.

Here is my vhost setup (domains changes for privacy):

NameVirtualHost *

<VirtualHost *>
DocumentRoot /var/www/domain1.com
ServerName www.domain1.com

<VirtualHost *>
DocumentRoot /var/www/domain2.com
ServerName www.domain2.com

It seems like no matter how I set them up, it always goes to whichever the first virtual host is. For instance if I move the config for domain2.com above the other, domain1.com will just redirect to domain2.com and vice versa.

If anyone can shed some light I am grateful... I cant tell you how many times I have hit up the forums and Google.


BTW - Ubuntu 7.10 | Apache2 | PHP5 | MySQL 5 | Webmin 1.4

May 1st, 2008, 05:04 AM
Firstly are you going to the site as an IP address or a URL. If you are using a URL make sure you have a correct DNS entry for it. Try comparing this against yours if you haven't already.

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /www/docs/dummy-host2.example.com
ServerName dummy-host2.example.com
ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common

But by the looks of it there isn't anything wrong with you virtual hosting code. Have you tried restarting the apache2 service? because that has caused me lots of problems in the past