Buying a VPS is the easy part. The moment that trips up most beginners is what comes next: pointing your domain name at that server so visitors can actually reach it. Type yourdomain.com into a browser, and nothing happens — because nothing connects that name to your server's IP address. That connection is DNS, and setting it up takes about 15 minutes once you understand the moving parts.

This guide walks you through the entire process, A to Z: finding your VPS IP, creating the right DNS records, verifying propagation, and locking everything down with HTTPS. It works for any registrar (Namecheap, GoDaddy, Cloudflare, Hostinger, Porkbun) and any VPS provider on Ubuntu 22.04/24.04.

Prerequisites

  • A registered domain name (you can buy one from any registrar for ₹700–₹1,200/year for a .com)
  • A running VPS with a static public IPv4 address (Ubuntu 22.04 or 24.04)
  • SSH access to your VPS, and a web server (Nginx or Apache) already installed and serving a test page
  • Access to your domain's DNS settings — either at your registrar or at your DNS provider (e.g. Cloudflare)

Step 1 — Find your VPS public IP address

Everything starts with your server's public IP. SSH into your VPS and run:

curl -4 ifconfig.me

This queries a public service and returns the IPv4 address the internet sees. Write it down — every DNS record you create will point at this number. If you need the IPv6 address too, run curl -6 ifconfig.me (skip this if your provider didn't assign one).

Also confirm your web server is actually running and reachable, otherwise your domain will point at a dead server:

sudo systemctl status nginx --no-pager | head -5

If Nginx is active, open http://YOUR-IP/ in a browser from your laptop. You should see the default Nginx welcome page. If it doesn't load, fix your firewall first (sudo ufw allow 'Nginx Full') before touching DNS — DNS can't fix a blocked port.

Step 2 — Decide where your DNS is hosted

DNS records live in a "zone" managed by whoever holds your nameservers. You have two common setups:

  1. Registar DNS (simplest): keep the nameservers your registrar gave you and edit records in their DNS panel. Fine for a simple site.
  2. Cloudflare (recommended): sign up free, add your site, and change your nameservers at the registrar to Cloudflare's. You get a nicer DNS panel, free CDN caching, and free SSL certificates.

If you already changed nameservers, remember: DNS records must be edited wherever the nameservers point, not at the registrar. Editing records in the wrong place is the #1 reason "my DNS changes aren't working."

To find where your DNS is currently managed:

dig +short NS yourdomain.com

This lists the authoritative nameservers. They tell you exactly which panel to open.

Step 3 — Create the A record for your root domain

The A record is the core of this entire setup: it maps yourdomain.com to your VPS's IPv4 address. Open your DNS panel and add:

  • Type: A
  • Host / Name: @ (the @ symbol means "the root domain itself" in almost every DNS panel)
  • Value / Points to: your VPS IPv4 address, e.g. 203.0.113.42
  • TTL: 3600 (one hour — fine for a stable site)

While migrating or testing, set the TTL to 300 (5 minutes) instead. TTL controls how long resolvers cache the old value, so a short TTL means your changes take effect in minutes rather than hours. Raise it back to 3600 once everything is stable.

Step 4 — Point www to the same server

Visitors type both yourdomain.com and www.yourdomain.com. Handle the www version with either an A record or a CNAME:

Type:  CNAME
Host:  www
Value: yourdomain.com

A CNAME is an alias: it says "www is just another name for yourdomain.com, look up that one." This is the cleanest choice because if your IP ever changes, you only update the single A record. (Note: you cannot put a CNAME on the root @ — that's why the root gets an A record.)

Step 5 — Add the supporting records (IPv6, mail, verification)

The A and www records are enough for a website, but a complete setup usually includes:

  • AAAA record (IPv6) — only if your VPS has an IPv6 address. Same as the A record but type AAAA with Host @ pointing at your IPv6 address.
  • MX records — only if you want email at your domain (e.g. via Google Workspace or Zoho Mail). Your mail provider gives you the exact MX values; don't add these unless you're setting up email, or mail will break.
  • TXT record for SPF — if you send email from the VPS (contact forms, newsletters), add: v=spf1 ip4:YOUR-IP ~all. This tells receivers your server is allowed to send mail for your domain and drastically reduces spam-foldering.

Skip MX records entirely if you're not doing email. Wrong MX records silently eat your mail.

Step 6 — Wait for (and verify) DNS propagation

DNS changes don't go live instantly. Resolvers around the world cache the old values until the TTL expires. With a 300-second TTL, expect 5–15 minutes; with 3600, it can take up to a few hours (despite what horror stories say, it rarely takes the full "48 hours" anymore).

Check from your own machine first:

dig +short yourdomain.com
dig +short www.yourdomain.com

Both should return your VPS IP. If dig isn't installed on Ubuntu, get it with sudo apt install dnsutils -y. On Windows, use:

nslookup yourdomain.com

Then check global propagation with a tool like dnschecker.org — it queries dozens of DNS servers worldwide and shows you which ones have picked up the new IP. Don't move on until most locations show your VPS address.

Step 7 — Enable HTTPS with a free Let's Encrypt certificate

Once the domain resolves to your VPS, your site loads — but over plain HTTP, which browsers flag as "Not Secure." Fix it free with Let's Encrypt via Certbot:

sudo apt update && sudo apt install certbot python3-certbot-nginx -y

The command installs Certbot and its Nginx plugin. Then request the certificate (replace with your real domain):

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Certbot fetches a free certificate, installs it in your Nginx config, and sets up an automatic HTTP-to-HTTPS redirect. Open https://yourdomain.com — the padlock should be there. Certificates auto-renew via a systemd timer; confirm it with:

sudo systemctl status certbot.timer --no-pager | head -3
Using Cloudflare? You can skip Certbot entirely — Cloudflare's proxy gives you HTTPS at the edge for free. Just set the SSL/TLS mode to "Full (strict)" in the Cloudflare dashboard.

Verify it worked

Run this checklist before calling it done:

  1. dig +short yourdomain.com returns your VPS IP from your machine.
  2. dnschecker.org shows your IP at most worldwide locations.
  3. http://yourdomain.com loads your site and redirects to https://.
  4. https://www.yourdomain.com also loads (both variants work).
  5. Browser shows a valid padlock with no certificate warnings.

Common issues & fixes

1. "Site can't be reached" even though DNS is correct

Your DNS is fine but the server isn't answering. Check the firewall (sudo ufw status — ports 80/443 must be open), confirm Nginx is running, and make sure your VPS provider doesn't have a separate cloud firewall (AWS security groups, DigitalOcean firewalls, Hetzner) blocking the ports.

2. Changes not showing up after hours

You edited records at the registrar, but your nameservers point to Cloudflare (or vice versa). Run dig +short NS yourdomain.com to see where DNS is actually managed, and edit the records there.

3. www works but the root domain doesn't (or reverse)

You added one record but forgot the other. The root @ needs its A record and www needs its CNAME (or A record). Check both with dig.

4. "DNS_PROBE_FINISHED_NXDOMAIN" in the browser

The domain doesn't resolve at all — either the records don't exist yet, or the domain's nameservers were never pointed at the DNS provider. Verify nameservers at your registrar first, then re-check with dig.

5. Certbot fails with "could not connect" or DNS errors

Certbot must reach your server through the domain name. If DNS hasn't propagated yet, or Cloudflare is proxying with a strict firewall rule, validation fails. Wait for full propagation, temporarily set the Cloudflare record to "DNS only" (grey cloud) if needed, then run Certbot again.


Conclusion

Pointing a domain to a VPS is just four things done in order: get the server's IP, add an A record for the root domain, add a www alias, and verify propagation with dig. Once that resolves, HTTPS via Let's Encrypt makes the setup complete and production-ready. The whole job is 15 minutes of clicking once you know which records do what.

Need help setting up a VPS, migrating a site, or fixing stubborn DNS? XpertBees handles server setup, migrations, and managed hosting support — reach out and we'll get your infrastructure right the first time.