Launching a Subdomain, From Zero to Live
Adding a subdomain is usually a five-minute job in a DNS panel. Getting it right, so that it resolves everywhere, has a valid certificate, does not break anything else in the zone and will not become a security problem in two years' time, takes a little more thought. This guide walks through the complete sequence for one new subdomain, using app.example.com as the example. The reserved documentation domain and IP ranges are used throughout; substitute your own values.
Step 1: Decide what the subdomain points at
Everything else follows from this. There are two common situations:
- Your own server or a fixed IP address. You know the IPv4 address, and possibly an IPv6 address, of the machine that will serve the subdomain. You will use A and AAAA records.
- A hosted service. A platform such as a hosted shop, help desk or website builder gives you a hostname to point at, for example
shops.provider.example. You will normally use a CNAME record, so that if the provider changes its IP addresses, your subdomain follows automatically.
The comparison of CNAME and A records covers the trade-offs in detail.
Step 2: Know the CNAME rules
CNAME records come with restrictions that catch people out:
- A name that has a CNAME record cannot have any other record of a different type at the same name. You cannot, for example, have both a CNAME and an MX record at
app.example.com. - For that reason, a CNAME cannot normally be placed at the zone apex, the bare
example.com, because the apex must hold SOA and NS records. Some DNS providers offer proprietary "flattening" or alias features to work around this. - The target of a CNAME should be a hostname, never an IP address.
Step 3: Choose a TTL
The time to live (TTL) tells resolvers how many seconds they may cache your answer. A short TTL means changes are picked up quickly but generates more queries; a long TTL is efficient but makes changes slow to spread. For a brand-new record a moderate TTL, such as an hour, is a sensible default. If you expect to change the record soon, for instance during a migration, a shorter TTL for the first few days makes corrections faster. See TTL do's and don'ts.
Step 4: Add the records
For a subdomain on your own server, the records might look like this:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | app | 192.0.2.10 | 3600 |
| AAAA | app | 2001:db8::10 | 3600 |
For a hosted service, a single CNAME:
| Type | Name | Value | TTL |
|---|---|---|---|
| CNAME | app | shops.provider.example. | 3600 |
Most panels expect only the label (app) in the name field and add the domain for you. Some want the full name. If you enter app.example.com in a panel that appends the domain, you may accidentally create app.example.com.example.com. The trailing dot on the CNAME value marks it as a fully qualified name; panels differ on whether you need to type it. The visual tutorial mapping a DNS panel to a zone file shows the difference.
Only add an AAAA record if the server really answers on that IPv6 address. A wrong AAAA record can make the site fail for visitors whose networks prefer IPv6. See IPv6 and AAAA records.
Step 5: Verify, first at the source
Do not rely on loading the site in a browser, which may be using a cached answer. Ask the authoritative name servers directly, then a public resolver. With dig:
- Find the authoritative servers:
dig NS example.com +short. - Query one of them directly:
dig @ns1.provider.example app.example.com A. If the answer is wrong here, the problem is in your zone, not in propagation. - Query a public resolver:
dig @9.9.9.9 app.example.com Aor another resolver you trust. If the authoritative answer is right but this is not, you are waiting on caches, which the TTL of any previous answer governs.
On systems without dig, nslookup app.example.com ns1.provider.example does the same job. The dig tips and the guide to propagation without the myths go further.
Step 6: Issue a certificate
Browsers expect HTTPS on every site, so the subdomain needs a certificate covering its name. With an ACME certificate authority such as Let's Encrypt, the common validation methods are:
- HTTP-01, where the authority fetches a file from the subdomain over HTTP. It requires the subdomain to resolve and serve content already, and it cannot be used for wildcard certificates.
- DNS-01, where you publish a TXT record at
_acme-challenge.app.example.com. It works before the site is serving and is required for wildcard certificates.
Hosted services usually issue the certificate for you once the CNAME is in place and you have added the domain in their dashboard. If you publish a CAA record for your domain, make sure it allows the authority that will issue for the subdomain. See wildcard certificates with DNS-01 and CAA records.
Step 7: Test the whole path
Once DNS and the certificate are in place, test from outside your own network if you can: load the site over HTTPS, check that the certificate covers the exact name, and confirm that any redirects, for example from HTTP to HTTPS, behave as intended. The self-check for subdomains that are not working lists the usual culprits.
Step 8: Record who owns it
The final step is the one most often skipped. Write down in a shared register what the subdomain is for, who requested it, which service it points at and when it should be reviewed. That single line is what prevents a forgotten record from becoming a takeover risk later, as explained in preventing subdomain takeover. The subdomain register guide and the launch checklist turn this into routine.
The Learn hub groups every guide by stage of a subdomain's life.