While trying to add a sub-domain to my Linode account, I did the typical Google search to see if someone else had done so already, and I could just copy their instructions. Alas, there were plenty of posts titled “Subdomain on Linode” (or something to that effect), but they all only showed how to register a host under the DNS, and set up the <VirtualHost> records under Apache.
A host is not the same as a sub-domain.
Let’s assume we have a domain “mydomain.com”. Adding in “lab.mydomain.com” as an “A” record will simply make a host. You cannot then do “work.lab.mydomain.com” using this method – something which should be perfectly acceptable under an actual sub-domain.
Herewith, I present the correct procedure for adding in a sub-domain under the Linode DNS (using the above example of “mydomain.com”).
- Under the Domain zone for “mydomain.com”, add in the following “NS” records:
- ns1.linode.com -> lab.mydomain.com
- ns2.linode.com -> lab.mydomain.com
- ns3.linode.com -> lab.mydomain.com
- ns4.linode.com -> lab.mydomain.com
- ns5.linode.com -> lab.mydomain.com
- Create a new domain zone for “lab.mydomain.com”
Presto. You can now add in host records such as “www.lab.mydomain.com” or whatever you want.