-
Notifications
You must be signed in to change notification settings - Fork 0
/
tlds
29 lines (21 loc) · 1.42 KB
/
tlds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Custom Top-Level Domains
A top-level domain, or TLD, is the final section of a domain name: .com, .org, .net, etc. By customizing our own DNS server, we've created TLDs for each of our environments: .lcl, .dev, .qa, .stg, and .prod. This allows everyone to quickly and consistently navigate hundreds of projects among multiple environments by simply appending the environment name to the URL.
[IMAGE]
To accomplish this, our BIND server `named.conf` contains entries like:
zone "dev." in {
type master;
file "/var/named/zones/wildcard/dev";
};
That zone file contains a single wildcard CNAME record:
$TTL 3H
@ IN SOA dev. root.dev. (
0 ; serial
3H ; refresh
1H ; retry
1W ; expire
1H ; minimum
);
@ IN NS ns.example.biz.
* IN CNAME dev.example.biz.
Anything ending in .dev (example.com.dev, www.example.com.dev, example.exampletwo.org.dev, etc) will resolve to this dev.example.biz server, where Apache's virtualhost configurations will serve the appropriate site based on the hostname.
This process has worked well for the last couple of years. Everyone knows exactly where to find any project, in any environment, no matter how many thousands of sites we develop and maintain. Also, our sysadmins can quickly distinguish private and public routing for subnets that have external access (i.e. staging and production). Simply adding or removing .prod from the URL can help troubleshoot a variety of networking issues.