The Short Answer
Pointing a domain at your VPS is a two-minute job once you know where your DNS lives: log in to wherever your domain’s DNS is managed (your registrar, Cloudflare, or your hosting panel), create an A record pointing your domain to the server’s IP address, add a CNAME for www, and wait for propagation — usually minutes, sometimes up to 24 hours. The most common mistake is editing DNS in the wrong place, so the first step of this guide is finding out which service actually controls your domain’s DNS.
This guide assumes you already have a domain name and a VPS with a public IPv4 address. If you do not have a server yet, How to Choose a VPS: A Beginner’s Guide walks through picking one, and How to Install WordPress on a VPS covers what to do once the domain resolves.
Step 1: Find Out Where Your DNS Lives
DNS records only work if you edit them at the authoritative nameserver — the service the rest of the internet asks about your domain. There are three common setups:
- Registrar DNS. You bought the domain at Namecheap, GoDaddy, Porkbun or similar and never changed the nameservers. Your DNS lives in the registrar’s panel, under “DNS” or “Advanced DNS”.
- Cloudflare. You (or a previous setup) pointed the domain’s nameservers at Cloudflare. DNS lives in the Cloudflare dashboard, and Cloudflare also proxies your traffic by default.
- Hosting panel. Some hosts manage DNS for you. If you bought the domain with a hosting plan, check the host’s panel first.
Not sure? Look up your domain’s nameservers from any terminal:
dig NS yourdomain.com +short
The answer tells you who is authoritative: names like *.ns.cloudflare.com mean Cloudflare; *.registrar-servers.com means Namecheap; *.domaincontrol.com means GoDaddy. If you see your VPS provider’s nameservers, DNS lives in the provider’s panel. Alternatively, use an online tool such as MXToolbox’s DNS lookup or whois yourdomain.com and look for the “Name Server” lines.
Edit DNS in exactly one place. If your nameservers point to Cloudflare, records you add at your registrar are ignored — and vice versa. This single misunderstanding causes most “my DNS change did nothing” complaints. Check the NS records first, every time.
Step 2: Create the A Record
An A record maps a hostname to an IPv4 address. You need one for your root domain (sometimes called the apex or naked domain) and, usually, one for www.
In your DNS panel, add:
| Type | Host / Name | Value | TTL |
|---|---|---|---|
| A | @ | YOUR_SERVER_IP | 300 |
| A | www | YOUR_SERVER_IP | 300 |
The @ symbol means “the domain itself” (yourdomain.com). Some panels want the host field left blank instead of @, and some want the full domain — the panel’s own help text usually explains its convention. Replace YOUR_SERVER_IP with your VPS’s public IPv4 address, which you will find in your provider’s control panel or by running curl ifconfig.me on the server.
A TTL (time-to-live) of 300 seconds means DNS resolvers cache the record for five minutes. Short TTLs make future changes propagate fast; the trade-off is slightly more DNS queries, which is negligible for a small site. Once everything is stable you can raise the TTL to 3600 (one hour) to reduce lookups, but there is no rush — many sites run 300 forever.
IPv6: if your VPS has an IPv6 address and your web server listens on it, add an AAAA record with the same host and the IPv6 address. It is optional — IPv4 alone works everywhere — but it improves reachability for the growing share of visitors on IPv6-only networks.
Step 3: Add a CNAME for www (Alternative to a Second A Record)
Instead of a second A record for www, many people use a CNAME record, which points one name at another name rather than at an IP:
| Type | Host / Name | Value | TTL |
|---|---|---|---|
| CNAME | www | yourdomain.com | 300 |
With this setup, www.yourdomain.com resolves to whatever yourdomain.com resolves to. The practical advantage: if your server’s IP ever changes, you update one A record instead of two. The disadvantage is one extra DNS lookup, which is too small to matter.
Either approach works. Do not create both an A record and a CNAME for the same hostname — a name can have one or the other, and conflicting records produce unpredictable results.
| Record type | What it does | When to use it |
|---|---|---|
| A | Hostname → IPv4 address | Your root domain and any subdomain pointing at the VPS |
| AAAA | Hostname → IPv6 address | Same, for IPv6 |
| CNAME | Hostname → another hostname | www pointing at the root domain; subdomains pointing at a service |
| MX | Domain → mail server | Email — never point this at your VPS unless you run a mail server |
| TXT | Free-form text | Verification records (Google Search Console, SPF, DKIM) |
| NS | Domain → nameserver | Delegating DNS to another provider |
Step 4: Point Subdomains at the VPS
A subdomain is just another record. To run a second site or service at blog.yourdomain.com, add an A record with host blog pointing at the same IP (or a different server’s IP). To host multiple sites on one VPS, pair these records with virtual hosts — see How to Host Multiple Websites on One VPS.
Common subdomains and what they are for:
www— the conventional web prefix.blog,shop,app— separate sites or applications.mail— only if you run your own mail server (most people should not; use a hosted email service instead).staging— a test copy of your site.
Each subdomain is independent: it can point at a different server, and changing one does not affect the others.
Step 5: Wait for Propagation (and Check It Properly)
DNS changes do not take effect everywhere at once. Resolvers around the world cache old records until their TTL expires, so propagation is gradual: your own connection may see the new IP in minutes, while a visitor on another continent may see the old one for hours. With a 300-second TTL, most of the world updates within an hour; the often-quoted “up to 48 hours” is a worst case that assumes long TTLs and stubborn caches.
Check propagation properly — do not just refresh your browser, which has its own cache on top of DNS:
dig yourdomain.com +short
Run that on your computer and on the server. For a global view, use an online propagation checker (whatsmydns.net and dnschecker.org both query resolvers worldwide and show which IP each one returns).
Lower the TTL before a migration. If you are moving an existing site to a new server, set the A record’s TTL to 300 at least 24 hours before you change the IP. That way, when you do switch, old caches expire within five minutes instead of however long the old TTL was (often 3600 seconds or a full day). See How to Migrate WordPress to a VPS for the full migration sequence.
Step 6: Set Up SSL After DNS Resolves
Once the domain resolves to your VPS, install an SSL certificate so visitors reach you over HTTPS. Let’s Encrypt issues free certificates and validates your domain by connecting to it — which only works after DNS points at your server. The full walkthrough is in How to Set Up Free SSL with Let’s Encrypt on a VPS; the short version is:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Run certbot only after dig yourdomain.com +short returns your server’s IP from your own machine. Running it too early fails validation and, if repeated too often, can hit Let’s Encrypt’s rate limits.
Using Cloudflare as Your DNS (and Proxy)
Many VPS owners put Cloudflare in front of their server. The setup: change your domain’s nameservers at the registrar to the two Cloudflare nameservers, then create the same A records inside Cloudflare’s dashboard. Cloudflare offers two modes per record, controlled by the orange/grey cloud icon:
- Proxied (orange cloud): visitors connect to Cloudflare, which forwards traffic to your VPS. Your server’s real IP is hidden, and you get Cloudflare’s caching, DDoS protection and a free SSL certificate between the visitor and Cloudflare. Downside: Cloudflare sees your traffic, and some real-time applications behave differently behind a proxy.
- DNS only (grey cloud): Cloudflare answers DNS queries and nothing else. Visitors connect directly to your VPS. Your IP is public, and you manage your own SSL (see the Let’s Encrypt guide above).
For a typical blog or business site, proxied mode is a good default. For a game server, a VPN, or anything using non-HTTP protocols, use DNS-only mode — Cloudflare’s proxy only handles HTTP and HTTPS traffic on standard ports.
One Cloudflare gotcha: in proxied mode, your server’s logs show Cloudflare’s IP addresses instead of your visitors’. Fix this by installing mod_remoteip (Apache) or setting real_ip_header (Nginx) with Cloudflare’s IP ranges, or simply accept it for a small site.
Reverse DNS (PTR Record)
Reverse DNS maps your IP address back to a hostname. It matters mainly for email servers — receiving mail servers check it — and barely at all for websites. If you do run mail from your VPS, set the PTR record in your provider’s control panel (not your DNS panel), because reverse DNS is controlled by whoever owns the IP range. Set it to match your mail hostname, for example mail.yourdomain.com. For a website-only server you can skip this entirely.
Troubleshooting
“The domain still shows the old site / a parking page.” Almost always propagation or caching. Check with dig and a global propagation tool before changing anything. If the global check shows your new IP everywhere but your browser still shows the old site, clear the browser cache or test in a private window. Also flush your operating system’s DNS cache: sudo resolvectl flush-caches on Ubuntu, ipconfig /flushdns on Windows.
“dig returns nothing / NXDOMAIN.” The record does not exist at the authoritative nameserver. You are probably editing DNS in the wrong place (Step 1) — verify the NS records and edit at the service they point to. Or the record was saved with a typo in the host field.
“dig shows the right IP but the site won’t load.” DNS is working; the problem is on the server. Check that the web server is running (sudo systemctl status nginx), that the firewall allows ports 80 and 443 (sudo ufw allow 'Nginx Full'), and that your provider’s cloud firewall (if any) allows web traffic. Test locally on the server with curl -I localhost — if that works, the issue is network or firewall, not the web server.
“www works but the root domain doesn’t (or vice versa).” One of the two records is missing or wrong. List all records for the domain and compare with the table in Step 2. Remember a hostname cannot have both an A record and a CNAME.
“SSL certificate fails with a DNS error.” Certbot could not reach your server via the domain. Confirm DNS resolves to the right IP, confirm port 80 is open (Let’s Encrypt’s HTTP challenge uses port 80), and if you use Cloudflare in proxied mode, either use DNS-only mode during issuance or use Cloudflare’s DNS challenge instead.
“I changed nameservers and everything broke.” Changing nameservers moves all DNS authority, including email (MX) records. Before switching nameservers — to Cloudflare or anywhere else — copy every existing record (especially MX and TXT records for email) to the new provider first. If email stopped working after a nameserver change, the MX records are the first thing to check.
Frequently Asked Questions
How long does it take for DNS to propagate?
With a 300-second TTL, most resolvers worldwide pick up the change within 5–60 minutes. Full propagation can take up to 24 hours in rare cases, usually because some ISP resolvers ignore short TTLs. If a global propagation checker shows your new IP in most locations, the change has worked — the stragglers will catch up.
Can I point a domain at my VPS if I bought the domain elsewhere?
Yes — the domain registrar and the server provider are independent. You only need access to the DNS settings wherever the domain’s nameservers point. Many people buy domains at a registrar with good prices (Namecheap, Porkbun, Cloudflare Registrar) and host on a completely different provider’s VPS.
Do I need a dedicated IP address for my domain?
No. A standard VPS already includes a dedicated public IPv4 address — that is what the A record points to. “Dedicated IP” is a selling point for shared hosting, where many sites share one IP; on a VPS the IP is yours by default.
What is the difference between nameservers and DNS records?
Nameservers decide where DNS is managed; DNS records are the actual entries (A, CNAME, MX) that map names to addresses. Changing nameservers hands control of all records to a different provider. Changing a record edits one entry. Most VPS setups only need record changes — you touch nameservers only when moving DNS management to a service like Cloudflare.
Can one domain point to two servers?
Yes, in limited ways. Different subdomains can point at different servers freely. For the same hostname, you can create multiple A records with different IPs — DNS returns them in rotation (round-robin), which spreads load but provides no health checking: if one server dies, half your visitors still get its dead IP. Real load balancing needs a load balancer or a managed DNS service with health checks.
Should I use my VPS provider’s DNS or Cloudflare?
Provider DNS (offered by DigitalOcean, Vultr, Linode and others) is simple and free, and keeps everything in one panel. Cloudflare adds a global anycast network, DDoS protection and optional proxying, at the cost of one more service to manage. For a first site, either is fine; Cloudflare is the better choice if you want the proxy features or expect hostile traffic.
The Bottom Line
Find where your DNS actually lives, add an A record for the root domain and a CNAME (or second A record) for www, and wait for propagation — then install SSL. The whole job is ten minutes of work and mostly waiting. When something goes wrong, check the nameservers first: nine times out of ten, the record was edited in the wrong panel.



Leave a Reply