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

Having a strange issue configuring apache.

I've got 4 domains

  • www.mydomain.tld
  • www.my-domain.tld

  • www.anotherdomain.tld

  • www.another-domain.tld

I've configured named virtualhost for each of the domains.

mydomain.tld, my-domain.tld and anotherdomain.tld works correctly but another-domain.tld isn't working correctly.

Apache seems to be picking up the virtualhost for anotherdomain.tld and serving it rather than the another-domain.tld

both have the server name set correctly

  • ServerName anotherdomain.tld

and

  • ServerName another-domain.tld

which seems to be the only place this could be an issue. Does anyone have any suggestion on finding the cause of this error.

A couple of other notes: each virtualhost is in a different file. mydomain.tld and my-domain.tld on a different ip address to anotherdomain.tld and another-domain.tld.

share|improve this question
1  
I have a couple ideas - but could you post the relevant vhosts configs? Obviously, feel free to edit the domain names out :) –  warren Sep 16 '09 at 8:10
1  
Please paste the relevant bits of configuration -- it's much easier to see. –  markdrayton Sep 16 '09 at 8:11
    
What happens if you put the name in quotes? –  John Gardeniers Sep 16 '09 at 8:22
    
Are permissions set the same on your 4 config files? –  Keith Stokes Sep 16 '09 at 11:20
    
Is it getting caught by your rewrite rules? –  Dennis Williamson Sep 16 '09 at 13:13

1 Answer 1

How can you tell that the web server is serving anotherdomain.tld instead of another-domain.tld? Do you see that URL in the browser's address bar has anotherdomain.tld in it?

If you created these configuration with copy-paste technique, then you could have left the DocumentRoot the same for both domains.

Another guess is if anotherdomain.tld and another-domain.tld are configured on the same IP address for apache, but another-domain.tlp DNS "A" record is set up to a different IP, Apache HTTPD just pulls out the default VirtualHost for the IP specified in its configuration, which may be anotherdomain.tld.

Example: If you have in DNS:

 anotherdomain.tld ->  1.2.3.12
 another-domain.tld -> 1.2.3.12

Then in httpd.conf:

<VirtualHost 1.2.3.12:80>
 ServerName anotherdomain.tld
  ...
</VirtualHost

<VirtualHost 1.2.3.18:80>
 ServerName another-domain.tld
  ...
</VirtualHost

When you type http://another-domain.tld/ in the browser's address bar, it makes a request to 1.2.3.12, which pulls out the default virtual host for 1.2.3.12, which is anotherdomain.tld.

These are just two wild guesses though...

share|improve this answer

Your Answer

 
discard

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