To make a domain load your website, its DNSDNS The internet’s phone book. It turns a name people can remember, like example.com, into the number address computers use to find the server. More about DNS → must point at your server’s IP address. You do this with A recordsA record The line in a domain’s settings that says which server’s address to send visitors to. Like a forwarding address card for your website. More about A record → (and AAAA recordsAAAA record The same as an A record, but for the newer, longer kind of internet address (IPv6). Only needed if your server has one. More about AAAA record → for IPv6) wherever your domain’s DNS is managed.
First find out where your DNS is managed. It is usually your registrarDomain registrar The company you buy and renew your domain name from, and where you choose who handles its settings. More about Domain registrar →, but if you changed nameservers to a DNS service or your host, the records live there instead. Run dig NS example.com +short to see which nameserversNameserver The server that holds all of a domain’s settings. Whoever runs your nameservers controls where your website and email point. More about Nameserver → are in charge.
A record or nameservers?
Hosts often give you two ways to connect a domain, and they do different things:
| Method | What you change | Who manages DNS afterwards | Best when |
|---|---|---|---|
| Point an A record | One or two records at your current DNS provider | You, where it is now | Email or other services already use the domain’s DNS |
| Change nameservers | The domain’s nameservers, at the registrar | The host | A new domain with nothing else on it, and you want the host to handle everything |
Pointing records is the safer choice for an existing domain, because nothing else moves. Changing nameservers hands every record to the host; anything you do not recreate there, including email, stops working. See what a nameserver is.
Steps
- Find your server’s IP addressIP address The number address of a device on the internet, like 203.0.113.10. Computers use it to find each other, the way post uses street addresses. More about IP address →. Your host shows it in the control panelControl panel A website you log into to manage your hosting with buttons and forms, instead of typing commands. cPanel and Plesk are the common ones. More about Control panel → or welcome email. On the server itself,
curl -4 ifconfig.meprints its public IPv4 address. - Open the DNS settings for the domain in your registrar or DNS provider.
- Set the A record for the bare domain. Name
@(or blank), type A, value your server’s IP. If an A record for@already exists, edit it rather than adding a second one; two A records split visitors between two servers. - Add www. Either an A record for
wwwwith the same IP, or a CNAMECNAME record A domain setting that says “this name is just another name for that one”. For example, www pointing at the main domain. More about CNAME record → fromwwwto your bare domain. - Add AAAA records only if your server has a working IPv6 address.
- Save, and leave the TTLTTL How long other computers may remember a domain setting before checking again, in seconds. Short means changes show up faster. More about TTL → at the default unless you are planning a move.
- Tell the server about the domain. The web serverWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server → or control panel must have a site configured for this domain name, or it will show a default page.
Subdomains
A subdomainSubdomain A name in front of your domain, like shop.example.com or blog.example.com. It can show a different site from the main one. More about Subdomain → such as blog.example.com or shop.example.com is just another name in the same zone. Add an A record with the name blog and the server’s IP, or a CNAME if a service gives you a hostname to point at. Subdomains can point at different servers from the main site.
Behind Cloudflare
If your DNS is on Cloudflare, each A and CNAME record has a proxy switch. With the orange cloud on, visitors connect to Cloudflare, which fetches from your server; dig then shows Cloudflare’s addresses, not yours. That is expected. Turn the proxy off (grey cloud) while you set up the server and its certificate, then turn it on and set SSL mode to Full (strict). See what a CDN is.
Check it
dig example.com A +short
dig www.example.com +short
Both should return your server’s IP. If they show an old address, the change is still propagating.
If it does not work
| Symptom | Likely cause |
|---|---|
dig shows the old IP | The change is still propagating, or you edited the wrong provider: check dig NS example.com +short |
dig shows the right IP, browser shows the old site | Your computer’s cache: flush your DNS cache |
| Right IP, but a default “Welcome to Nginx” or host page | The server has no site configured for this domain name |
| DNS_PROBE_FINISHED_NXDOMAIN | Record missing, or the domain’s nameservers are wrong |
| ERR_CONNECTION_REFUSED | DNS is fine; the server or its firewall is refusing connections |
www works but the bare domain does not, or the reverse | One of the two records is missing |
Then add HTTPS
Once the domain resolves to the server, issue a certificate. See free SSL with Let’s Encrypt. Certificate tools check the domain points at your server first, so this always comes after the DNS change.
Leave MX records alone unless you are changing email too. Pointing the website elsewhere does not affect email, but deleting MX recordsMX record The domain setting that tells the world where to deliver your email. More about MX record → stops mail arriving.
Related
After changing the record, use the DNS propagation checker to see when the new address has reached everyone.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.

