I'm having a strange problem. I'll be quick about the setup:


Following are A-records pointing to the same IP:

  • www.domain.com
  • domain.com
  • login.domain.com
  • dev.domain.com

I have tried using CNAME for the sub-domains, but that did not change anything.

Apache 2 setup

I have two virtual-hosts:

<VirtualHost *:80>
  ServerName domain.com
  ServerAlias www.domain.com
  DocumentRoot /var/www/a
  [...log setup]


<VirtualHost *:80>
  ServerName dev.domain.com
  DocumentRoot /var/www/b
  [...log setup]

Take notice that there is no host set up for login.domain.com.


Now to the problem. When I enter dev.domain.com it says server not found instantly. Have tried clearing cache and all that, and on several computers. www.domain.com and domain.com serve from the right directory. login.domain.com redirects to domain.com for some reason.

The config above is the only one under sites-enabled, but it also loads a config from phpmyadmin.

I guess what I'm asking is, how do I begin diagnosing the problem? How can I rule a DNS problem out? I have tried adding dev.domain.com as a serveralias to the current config - nothing changes. And I have no idea why login.domain.com redirects - there's not wildcard anywhere as far as I can see.

Where do I start?


When someone queries a non-existent domain name, the reply that it does not exists (NXDOMAIN), cached in the intermediate DNS servers.

Possibly for dev.domain.com, negative reply was cached somewhere.

To test, try

1. nslookup dev.domain.com (or dig dev.domain.com)
2. nslookup dev.domain.com ns1.domain.com (or dig @ns1.domain.com dev.domain.com)

If that is the case, you'll get negative answer in 1. and your IP in 2.

There's no solution other to wait the time specified in the last field of your SOA record (nslookup -type=SOA domain.com or dig domain.com SOA). To prevent it in the future, put there some lower value.

As for login.domain.com - it falls back to the first VirtualHost defined. It is normal behavior.

(I'd agree that if you would post the real domain name, it would make our life better)

| improve this answer | |

I guess what I'm asking is, how do I begin diagnosing the problem? How can I rule a DNS problem out?

  1. In case of multiply virthosts in Apache, fist virthost serves as fallback for all hosts-requests, which aren't found in visthosts lists, but reach server due to DNS configuration (or other methods), it's clearly OK for your non-existing virthost
  2. Never, never mask domain in case of domain-related issues - this way you guaranteed to compel all interested in the answer to guess, instead of testing and debugging.
  3. For me "dev.domain.com" is perfectly valid according to you quote, but I prefer to test it real life
  4. Wild guessing - dev.domain.com can somehow resolve to wrong IP, without http-server on it. How to test
    • nslookup dev.domain.com, verify IP-of-dev.domain.com
    • traceroute IP-of-dev.domain.com OR traceroute dev.domain.com
    • telnet dev.domain.com 80 and perform shortest http-session, if connected or use wget dev.domain.com/index.file for monitoring actons of http-client with site dev
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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