Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have an apache server that runs our work Intranet (intranet.domain.com), as well as a test site with restricted access (dummy.domain.com). Both are in DNS and both work when I go to the full address, but I also have a CNAME in DNS (drewnett - points to intranet.domain.com.) and this is connecting to our test site as opposed to our main site.

Through experimenting I found out that drewnett will take you to the location defined in the first config that it finds (so first alphapetically in this case).

I'm lost for what to check, as Apache Configs must be correct for the full address to connect correctly, and my CNAME has a '.' at the end of it.

Any pointers here would be welcome.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You have to add a ServerAlias for this other hostname.

share|improve this answer
    
Thans, that sorted it. –  David Gard Feb 29 '12 at 10:11
add comment

Extended version of JohnD's answer

When more than one virtualhost exist in Apache and it get request for host, not known to it (through ServerName or ServerAlias), it returns first virtualhost in list.

In order to get dummy.domain.com instead of drewnett, you have to add drewnett as alias for "main" host

share|improve this answer
    
Got it, thanks. I assumed that putting the FQDN against the CNAME would do the trick, but guess it just references that for IP. Thanks again. –  David Gard Feb 29 '12 at 10:11
add comment

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.