Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So, I just bought a brand new domain. I set up my dns records with the host (godaddy) but something strange happens on my server.

I've added this to the httpd.conf file:

<VirtualHost *:80>
ServerName www.newdomainname.tld
DocumentRoot /usr/share/roundcube/
</VirtualHost>

But somehow I'm redirected to the root of my server. Then I tried adding this under the entry for the new domain name:

<VirtualHost *:80>
ServerName shop.olddomainname.tld
DocumentRoot /usr/share/roundcube/
</VirtualHost>

And it worked without any problems. What's going on? Am I forgetting anything?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Assuming this is your first additional domain, do you have a NameVirtualHost outside of the VirtualHosts section?

NameVirtualHost *:80 

The setup for multi VirtualHosts is documented nicely at http://httpd.apache.org/docs/2.2/vhosts/examples.html

A good way to figure out what you have configured is to run

/usr/local/apache2/bin/httpd -S 

Which will return all directives currently configured.

share|improve this answer
    
I had that in the ports.conf file, but not in the httpd.conf file. I also have a few files in sites-enabled/, but don't really know what files get loaded at what time... –  skerit Mar 30 '11 at 9:36
    
Okay, you can figure out what the VirtualHost setting are by running httpd -S (added to original answer). –  Decado Mar 30 '11 at 9:59

On Ubuntu you should define your virtual hosts in /etc/apache2/sites-available. These get linked to the /etc/apache2/sites-enabled by the a2ensite command.

You may want to examine the existing default site and possibly disable it with the a2dissite command. The first defined site will be treated as the default site by apache.
As your definitions are the same, you may just want one site with a serveralias defined.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.