Domain and DNS Setup: A Step-by-Step Configuration Guide

Most domain and DNS pitfalls aren't technical—they're sequencing errors: updating NS records before creating DNS entries, configuring only www without the root …

Insights:Domain and DNS Setup: A Step-by-Step Configuration Guide

After purchasing a domain, your website won't appear automatically. Several steps lie in between: registrar, DNS provider, server, and certificate. Get the order wrong and every subsequent step requires extra troubleshooting.

The sequence below works for launching a new site, and also serves as a checklist when switching servers or DNS providers.

Step 1: Sort Out Domain Ownership and Verification

  1. Confirm the registrar and account: Who owns the domain, whether the account email can log in, and which card is bound for renewals.
  2. Enable the registrar lock: Keep domain locks, privacy protection, and transfer passwords secure—don't share them casually.
  3. Complete verification: Domains registered in mainland China must complete real-name verification per the registrar's requirements; overseas registrars follow their own verification workflows.
  4. Record the expiration date: Set renewal reminders and don't rely on just one person's WeChat.

Acceptance criteria: You can log into the registrar admin panel, see the domain status as normal, WHOIS information complies with local requirements, and the expiration date is recorded.

Step 2: Choose a DNS Provider, Then Update NS Records

Your DNS provider determines resolution speed, supported record types, and how well incidents are handled. Before choosing, confirm it supports the records you need: A, AAAA, CNAME, MX, TXT, CAA, and possibly ALIAS or DNSSEC.

Switching order:

  1. Copy all existing records to the new DNS provider first—do not delete the old records yet.
  2. Verify that A, AAAA, CNAME, MX, and TXT records are all present.
  3. Then update the NS records at the registrar to point to the new provider.
  4. Wait for NS propagation; avoid making repeated changes during this period.

Common mistakes: Changing NS records before finishing the DNS copy; having records active on both providers without knowing which ones are actually resolving; entering only one NS record and leaving the other blank.

Acceptance: run dig NS your domain or nslookup -type=NS your domain to check whether the returned NS records belong to the new provider, and confirm both NS servers can resolve.

Step 3: Set up A / AAAA records for both root domain and www

The website server needs an A record pointing to an IPv4 address; if it also supports IPv6, add an AAAA record.

The root domain and www are two separate addresses — configure both, and pick one as canonical:

  • Option A: 301-redirect the root domain to www.
  • Option B: 301-redirect www to the root domain.

Do not have both return a 200 status with identical content, or search engines will see duplicate pages.

If your DNS provider does not support placing a CNAME on the root domain, don't force it; use A/AAAA for the root domain and a CNAME pointing to the root domain or the alias provided by your service provider for www.

Acceptance: the root domain, www, and URLs with or without trailing slashes all load correctly and resolve to the same canonical URL, with no records still pointing to the old server.

Step 4: Deploy HTTPS before configuring forced redirection

  1. Obtain certificates for both the root domain and www, or use one that covers both.
  2. Verify the full certificate chain is installed — do not install only the leaf certificate.
  3. First ensure HTTPS works, then redirect HTTP to HTTPS via 301.
  4. Check for mixed content: images, CSS, and JS must no longer load over http://.
  5. Enable HSTS last, after confirming every page on the site uses HTTPS.

Acceptance: Both https:// and http:// are accessible, but traffic always routes to HTTPS; certificate expiry dates have reminders set; no certificate warnings appear in the browser.

Section 5: If Using Business Email, Configure MX Along With Sending Authentication

Configuring only MX allows receiving emails but does not guarantee your sent messages won't be flagged as spam. You typically also need to set up the following:

  • MX: Pointed to the mail server provided by your email service provider.
  • SPF: Declared in a TXT record to specify authorized sending sources.
  • DKIM: Configured using the public key provided by your service provider for message signing.
  • DMARC: Start in monitoring mode, then gradually tighten enforcement.

Note: A root domain may have multiple TXT records, but only one SPF record is allowed — do not place multiple SPF records side by side.

Acceptance: Sending and receiving work correctly; send a test email to yourself and verify that SPF, DKIM, and DMARC pass in the message headers; monitor bounces and junk folders.

Section 6: Lower TTL Before Switching Servers, Then Update Records

TTL defines how long DNS records are cached. Before changing your IP address, lower the TTL on the relevant records first, wait for old cache entries to expire, then update the A/AAAA records. After the change, monitor for a period to confirm no traffic reaches the old IP before restoring the original TTL value.

Common mistakes: leaving TTL at 24 hours and switching the IP immediately; shutting down the old server right after making changes; updating only one record and forgetting about www or subdomains.

Acceptance: Multiple network environments or online DNS lookup tools return consistent results; there are no persistent requests seen in the old server logs; you know which IP to restore when rolling back.

Last: Lock Down Verification and Monitoring Procedures

On launch day, perform at least these four tasks:

  1. Verify that NS, A/AAAA, CNAME, MX, and TXT records are all present and correct.
  2. Confirm that the main domain and www both 301-redirect to the same destination.
  • Check the certificate chain and expiration date.
  • Set up domain resolution or website availability monitoring so you get notified when something goes wrong.
  • DNS isn't a one-time setup. It's prone to recurring issues at key touchpoints like renewals, server swaps, provider changes, and certificate renewals. Keeping your records and change logs in a single fixed location is far more reliable than trying to remember who last modified what.

    Related Reading: