Subdomains and DNS

I know how to set up virtual hosts, but that doesn't have anything to do with subdomains connecting to apache at all, does it?

I have mydomain.com, and test.mydomain.com can't find a server, while mydomain.com does. I looked in the DNS manager, and it doesn't seem to have any kind of wildcard entry. How do I set this up?

Thanks

~sean

8 Replies

Setup a CNAME record '*' that aliases to your hostname.

you can also do a "A" record

test A 600 mydomain.com

record

it will do the same as a cname

Thanks guys… that was easy

@MrRx7:

you can also do a "A" record

test A 600 mydomain.com

record

it will do the same as a cname

OK, which of the two methods is preferred? Is there a reason to use one over the other?

I'm still trying to get my hands around DNS.

Thanks,

Jim.

First, what is being defined here is not a sub-domain at all. In the case of the A record, it is a single host that is in the domain 'mydomain.com'. In the case of the wildcard CNAME, it is a record that resolves any name to the A name referred to in the CNAME record.

Ideally, a wildcard CNAME entry should never be used. I don't believe that it is standard, and I know from personal experience that it will not always work as expected or desired, especially with software that does extensive DNS queries, such as an MTA or webserver.

If you want a host to be referred to by many names, you can either use multiple A records or a single A record and multiple CNAME records.

Feel free to use nslookup or dig to check ashevin.com to see how I manage my own domain.

> If you want a host to be referred to by many names, you can either use multiple A records or a single A record and multiple CNAME records.

But is there a "standard" way to point all subdomains to the same place?

@seanhess:

> If you want a host to be referred to by many names, you can either use multiple A records or a single A record and multiple CNAME records.

But is there a "standard" way to point all subdomains to the same place?

I have used both and either will work fine, I have not noticed any differences between either method. I personally use "A" records for my subdomains

@AverageGuy:

OK, which of the two methods is preferred? Is there a reason to use one over the other?

So I guess the answer in the simple case is no.

Thanks,

Jim.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct