I'm a web developer and I've started admininstrating a small VPS for hosting some very small websites. For testing pourpose we need to create a third level domain, but I'm not sure about how to configure it. The server is running Debian stable with apache2. I've added a virtual host to create a third level domain:

<VirtualHost *:80>
    ServerName thirdlevel.servername.foo
    DocumentRoot /path/to/document/root
    # some other apache config

Now, in the control panel of my ISP (where I bought the domain) I've put those parameter for DNS configuration, and I have no idea if this is correct or not:

record type: A
name: servername.com.
value: (real IP here, of course)

record type: A
name: www

record type: CNAME
name: thirdlevel.servername.foo.
value: servername.foo

after some hours the last rule (which is the one i'm not sure about) was marked "active" but I still cannot access my website pointing thirdlevel.servername.foo thnks


  • It is very difficult to debug a DNS problem when you hide the real names. We cannot even test, so all the answers you will get are only guesses.
    – bortzmeyer
    Oct 11, 2010 at 9:20
  • sry, I've found out that the problem was caused by a conflict in the zone config. now, It should work.
    – ArtoAle
    Oct 12, 2010 at 9:12

3 Answers 3

  1. You appear to have servername.com and servername.foo in the same zone. There should only be one domain per zone.
  2. If you just forgot to change the first .com to .foo, then thirdlevel.servername.foo. should just be thirdlevel
  3. For the value of thirdlevel, you need a . on the end, or it will append the origin for you (assuming the zone file starts with $ORIGIN servername.foo.).

If you have access to the text of the zone file, instead of the usual annoying HTML form that most registrars provide, you want something like the following:

$ORIGIN servername.foo.
$TTL 14400
@       86400   IN      SOA     YOUR.NS1.GOES.HERE.      your.email.with.at.replaced.by.dot.comcast.net.   (
                                        201009091812 ;Serial Number
                                        86400 ;refresh
                                        7200 ;retry
                                        3600000 ;expire
                                        86400 ;minimum
                86400   IN      NS      YOUR.NS1.GOES.HERE.
                86400   IN      NS      YOUR.NS2.GOES.HERE.
                14400   IN      A
www             14400   IN      A
thirdlevel      14400   IN      CNAME   @

The @ gets replaced by whatever $ORIGIN is set to, so you don't have to keep retyping it. I am curious why you can't just use another A record for thirdlevel.

  • I'm completely noob about DNS managing, so I tought a good point was to use CNAME. Now I know I must use A record for third level. I only have access to HTML form, so I must use it. The .org/.foo problem is not the point (in fact it's just a fake server name, not the actual one :D)
    – ArtoAle
    Oct 9, 2010 at 21:49

It might take sometime for DNS changes to replicate everywhere.
Check if you can resolve the new CNAME already.
The apache configuration looks good so far.


Your Apache2 is configured correctly, but in your domain's DNS you are missing CNAME record for any third level domain

value:   *.yourdomain.com
type:    CNAME
target:  yourdomain.com
  • The accepted answer is substantially better and doesn't imply that you must add wildcard CNAMEs and also points out that CNAMES aren't even necessary.
    – Theuni
    Dec 8, 2012 at 23:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .