Point domain to VPS: A records, nameservers and DNS checks

Point domain to VPS step by step: A, AAAA and www records, changing nameservers, keeping email working, checking with dig, and getting SSL right after.

Diagram: a domain's A record pointing to a VPS IP address

Key takeaways

  • The quickest way is A records for @ and www pointing to the VPS's IPv4 address, wherever the domain's DNS is hosted.
  • An A record change usually takes minutes to hours depending on TTL; a nameserver change can take longer.
  • Do not delete MX and TXT records if your email runs somewhere else.
  • Let's Encrypt issues SSL only once the domain resolves to the VPS and port 80 is open.

To point a domain to a VPS, sign in to whoever hosts the domain's DNS (your registrar, Cloudflare or your own DNS server), create A records for @ and www with the VPS's IPv4 address, add AAAA records if the VPS serves over IPv6, then wait for the TTL to expire (usually minutes to a few hours). The alternative is to change the domain's nameservers to a DNS server you control, which is more flexible but slower to take effect. Once the domain resolves to the VPS, install a free SSL certificate.

This point domain to VPS guide covers both methods, explains TTL and "DNS propagation", shows how to check with dig, how to keep email running, the common mistakes, and how to do it in ZoPanel.

A records or nameservers?

A domain's DNS is always answered by exactly one place: wherever its nameservers point. Before you change anything, find out where that is.

Method What you do Pros Cons
Point A records Keep the nameservers; edit A/AAAA records where DNS is hosted now Fast, leaves other records (mail, verification) alone You edit DNS in someone else's dashboard for every change
Change nameservers Move the whole zone to your own DNS server (or Cloudflare) All records in one place; needed for wildcard SSL and private nameservers Can take 24 to 48 hours; every record must be recreated first

For a single website, pointing A records is enough. Changing nameservers suits hosting companies, agencies managing many domains, or anyone who needs wildcard SSL.

Before you point a domain to a VPS

1. Get the VPS's IP address

Your VPS provider's dashboard shows it. On the server itself:

ip -4 -brief address show scope global
ip -6 -brief address show scope global

If the VPS sits behind NAT (some providers assign a private address), use the public IP from the provider's dashboard.

2. Find the domain's current nameservers

dig NS example.com +short

The answer tells you where to sign in: your registrar's nameservers, Cloudflare's (*.ns.cloudflare.com), or your old host's. On Ubuntu or Debian, install dig with sudo apt install dnsutils. On Windows, use nslookup -type=NS example.com.

3. Lower the TTL a day ahead (for a live domain)

TTL (time to live) is how many seconds resolvers may cache the old answer. If the current A record has a TTL of 86400 (a day), lower it to 300 seconds at least one old TTL before the move. When you then change the IP, visitors pick it up within about five minutes instead of a day.

Method 1: Point A records to the VPS

Sign in to the DNS dashboard (registrar, Cloudflare or current host) and create or edit these records, replacing 203.0.113.10 with your IP:

Type Name Value TTL
A @ 203.0.113.10 300 during the move, then 3600
A www 203.0.113.10 same
AAAA @ the VPS's IPv6 (if any) same
AAAA www the VPS's IPv6 (if any) same

Points that matter:

  • @ is the bare domain (example.com). Some dashboards want the field empty or the full domain instead of @.
  • www can be a CNAME to example.com instead of an A record, but never put a CNAME on the bare domain: under RFC 1912, a CNAME cannot coexist with other records, and the apex always has NS and SOA records.
  • Remove old A/AAAA records for @ and www. With two A records pointing at different IPs, visitors bounce between the old and new servers, and Let's Encrypt validation can fail.
  • Only add AAAA if the VPS really serves the site over IPv6. A wrong AAAA record is a classic cause of "works sometimes" sites and failed SSL.
  • Leave MX and TXT records alone if the domain's email runs elsewhere (Google Workspace, Microsoft 365, your old host). Moving the website to a VPS does not mean moving email.

Method 2: Change the domain's nameservers

If you want to manage all DNS on your VPS or at Cloudflare:

  1. Create the zone at the new place first with every record: A, AAAA, www, MX, SPF, DKIM, DMARC and verification TXT records (Google, Microsoft and so on). Anything missing stops working the moment the nameservers change.
  2. Change the nameservers at the registrar to the new ones (for example ns1.yourcompany.com and ns2.yourcompany.com, or the two Cloudflare assigns).
  3. If the nameservers are under your own domain (such as ns1.yourcompany.com), create glue records (host records) at the registrar of yourcompany.com pointing ns1 and ns2 to your DNS server's IP. See how to create private nameservers.
  4. Wait. Nameserver changes go through the top-level domain's servers (.com, .net…), where NS records often carry long TTLs, so allow up to 24 to 48 hours.

Check that the domain points to the VPS

Use dig to ask several DNS servers directly:

# Your default resolver
dig +short example.com A
dig +short www.example.com A

# Google and Cloudflare public DNS
dig +short example.com A @8.8.8.8
dig +short example.com A @1.1.1.1

# The authoritative nameserver itself (no caching in between)
dig +short example.com A @$(dig NS example.com +short | head -n1)

If the authoritative nameserver already returns the new IP but your computer still sees the old one, it is only a cache that has not expired. You can:

  • flush your local DNS cache: Windows ipconfig /flushdns; macOS sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; Ubuntu with systemd-resolved resolvectl flush-caches;
  • ask Google Public DNS to drop its cached answer on Google's Flush Cache page.

Test the site on the VPS before changing DNS so there is no downtime:

curl -I --resolve example.com:80:203.0.113.10 http://example.com/

Or add 203.0.113.10 example.com www.example.com to your computer's hosts file (/etc/hosts on Linux and macOS, C:\Windows\System32\drivers\etc\hosts on Windows), check in a browser, then remove the line.

After pointing: SSL for the domain

Let's Encrypt validates domains over HTTP, so two things must be true: the domain resolves to the VPS and port 80 is open (in the server's firewall and in any provider firewall or security group). That is why you point DNS first, then create the site and request the certificate. Our free SSL with Let's Encrypt guide covers the details.

Point domain to VPS with ZoPanel

DNS at your registrar or Cloudflare

  1. Create A records for @ and www with the server's IP, as above.
  2. In ZoPanel, go to Websites → New website, enter the domain and keep Free SSL (Let's Encrypt) on.
  3. If DNS already points to the server, the certificate is issued when the site is created. If not, you do not need to come back: every hour ZoPanel checks DNS and issues the certificate once the domain resolves only to this server. To issue it right away, click Issue certificate on the SSL tab.

Step by step in Your first website and SSL certificates.

ZoPanel's own DNS server

ZoPanel can run an authoritative DNS server (PowerDNS) so you and your customers manage zones next to the sites that use them:

  1. Choose nameserver names such as ns1.yourcompany.com and ns2.yourcompany.com, and create glue records at the registrar.
  2. Open DNS, enter the Nameservers and click Install DNS server (port 53 TCP/UDP is opened in the firewall).
  3. Under DNS zones, choose the site's domain and click Add zone. A new zone already has A records for @ and www, a CAA record allowing only Let's Encrypt, and the mail records if email is already enabled for the domain.
  4. At the registrar, set the nameservers ZoPanel lists.

With the zone on your server you can turn on DNSSEC and request wildcard *.example.com certificates. See the DNS documentation.

Sites proxied through Cloudflare

With Cloudflare's proxy on (the orange cloud), the domain resolves to Cloudflare's IPs rather than your VPS, so automatic SSL does not pick it up. Click Issue certificate on the SSL tab, or install a Cloudflare Origin certificate under Custom certificate, then set Cloudflare's SSL mode to Full (strict). Also turn on Websites behind Cloudflare under Security so logs, statistics and Fail2ban see real visitor IPs.

Common mistakes when pointing a domain to a VPS

Symptom Usual cause Fix
Others see the new server, you still see the old one Local or ISP DNS cache Flush DNS, try another network, wait out the TTL
Site works on and off An old A record left behind, or a wrong AAAA Remove the extra records; check dig AAAA too
DNS changes have no effect Edited somewhere that is not the active nameserver Re-check dig NS and edit in the right place
Email stops after changing nameservers New zone is missing MX, SPF or DKIM Add the mail records to the new zone
SSL will not issue DNS not pointed yet, port 80 closed, or CAA blocking Check with dig; open port 80 in the provider firewall too
Bare domain works, www does not No record for www Add an A or CNAME record for www

Conclusion

Pointing a domain to a VPS is only a few DNS records, but doing them in the right order avoids downtime: lower the TTL, test the site on the VPS through your hosts file, edit the A records in the right place, keep the mail records, then install SSL. If your VPS has no panel yet, ZoPanel's Free plan installs with one command and issues SSL as soon as the domain points to it:

curl -fsSL https://get.zopanel.net | sudo bash

See pricing when you need more than 10 websites.

Frequently asked questions

How long does it take to point a domain to a VPS?

An A record change usually takes effect within minutes to a few hours, depending on the old record's TTL. A nameserver change can take up to 24 to 48 hours because the top-level domain's servers must update. Lowering the TTL a day ahead makes the switch faster.

Will pointing my domain to a VPS break my email?

No, as long as you only change the A and AAAA records and leave MX, SPF, DKIM and DMARC as they are. Email is affected only if you change nameservers and the new zone lacks the mail records, or if you change the MX records.

Should I use an A record or a CNAME?

Use an A record for the bare domain, because the apex cannot be a CNAME. For www and other subdomains, either an A record or a CNAME to the bare domain works; a CNAME is convenient because an IP change then needs editing in only one place.

Do I need an IPv6 (AAAA) record?

Only if the VPS has IPv6 and the site actually serves over it. A wrong AAAA record locks out visitors on IPv6 networks and can make SSL issuance fail. Without AAAA, the site still works for everyone over IPv4.

Can one VPS host several domains?

Yes. Point each domain's A record to the same IP; the web server tells the sites apart by the domain name in each request. With a control panel, you just create a website per domain, each with its own SSL certificate.