Before your website is reachable at yourdomain.com instead of a raw IP address, you need to configure DNS records pointing the domain to your VPS. This guide covers the full process.
Prerequisites
- A registered domain name
- Your VPS's public IPv4 (and IPv6, if applicable) address
- Access to your domain's DNS management panel
Step 1 — Find Your VPS's IP Address
curl ifconfig.me
Step 2 — Confirm Which DNS Provider Is Authoritative
dig NS yourdomain.com
This shows which nameservers actually control your DNS — make sure you're editing records at that exact provider, not your domain registrar if they differ.
Step 3 — Add the A Record
In your DNS management panel:
Type: A
Name: @ (represents the root domain, yourdomain.com)
Value: YOUR_SERVER_IP
TTL: 3600
Step 4 — Add a Record for the www Subdomain
Either another A record:
Type: A
Name: www
Value: YOUR_SERVER_IP
Or a CNAME pointing to the root domain:
Type: CNAME
Name: www
Value: yourdomain.com
Step 5 — Add an AAAA Record (If Your VPS Has IPv6)
Type: AAAA
Name: @
Value: YOUR_IPV6_ADDRESS
Step 6 — Wait for DNS Propagation
Depending on TTL, this can take anywhere from a few minutes to a few hours. See How to Troubleshoot DNS Propagation Issues if it seems delayed.
Step 7 — Verify
dig +short yourdomain.com
Should return your VPS's IP address.
Step 8 — Configure Your Web Server
Ensure Nginx or Apache has a virtual host/server block configured for this domain — see Nginx Virtual Hosts: Hosting Multiple Websites or Apache Virtual Hosts: Hosting Multiple Websites.
Step 9 — Enable HTTPS
Once DNS resolves correctly:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Common Errors
Domain shows a parking page or registrar default page — the A record wasn't saved correctly, or you edited DNS at the wrong provider; recheck with dig NS.
www works but the root domain doesn't (or vice versa) — confirm both the @ and www records were created, not just one.
"This site can't be reached" — confirm DNS has propagated with dig, and that ports 80/443 are open on the VPS firewall.
Best Practices
- Set a lower TTL (e.g. 300) before a planned change, and raise it back afterward once stable
- Always configure both the root domain and
wwwsubdomain - Verify with
digbefore troubleshooting the web server itself
Continue Reading
- DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained
- How to Troubleshoot DNS Propagation Issues
- How to Install Let's Encrypt SSL with Certbot (Nginx & Apache)
Browse more articles in Networking & DNS.
