All articles

How to Point a Domain to Your VPS

By Harborvm7 min read

How to Point a Domain to Your VPS

Key takeaways

  • To point a domain to a VPS, create an A record for your IPv4 address and an AAAA record for your IPv6 address at your domain registrar.
  • Use a CNAME to alias one name to another, such as www to your root domain; never point a CNAME at a bare apex domain.
  • DNS changes are governed by each record's TTL. Lower the TTL before a move so caches refresh faster, and allow up to 48 hours for stragglers.
  • Let's Encrypt certificates are valid for 90 days, so set up automatic renewal rather than issuing them by hand.

To point a domain to a VPS, you log in to your domain registrar, create an A record that holds your server's IPv4 address (and an AAAA record for IPv6 if you have one), then wait for DNS to refresh. That is the whole job in one sentence. The rest of this guide explains each record type, shows you where to find your VPS IP, walks through the registrar settings, and finishes with free HTTPS once the name resolves.

The work splits into five short steps: understand the record types, find your IP, edit DNS at the registrar, wait out propagation and verify, then add SSL. None of it requires special software. You need access to your registrar's control panel and a terminal on your VPS.

The DNS records you use to point a domain to a VPS

A domain name does not know anything about your server on its own. DNS is the lookup table that maps a name like example.com to an address your computer can connect to. Three record types cover almost everything you need when you point a domain to a VPS.

  • A record: maps a hostname to an IPv4 address, for example 203.0.113.10. In the DNS standard this is record type 1, defined in RFC 1035 and listed in the IANA DNS parameters registry.
  • AAAA record: maps a hostname to an IPv6 address, for example 2001:db8::10. This is record type 28. Add it only if your VPS has an IPv6 address.
  • CNAME record: points one name at another name rather than at an IP. A common use is making www.example.com an alias of example.com, so you only maintain the IP in one place.

One rule saves a lot of confusion: do not put a CNAME on your apex (root) domain, the bare example.com with no subdomain. The standard does not allow a CNAME to coexist with other records at the apex, and every domain needs certain records there. Point the apex at an IP with an A or AAAA record, and use CNAMEs for subdomains like www or blog.

Network cables connected to switch ports in a server rack

A typical setup for a single site looks like this:

HostTypeValue
@ (apex)Ayour VPS IPv4
@ (apex)AAAAyour VPS IPv6 (if any)
wwwCNAMEexample.com

The @ symbol is shorthand most registrars use for the apex domain.

Finding your VPS IP address

You need the server's public IP before you can create any record. If you bought the VPS from us, the address is shown in the Harborvm control panel next to the server, so you can copy it straight from there. You can also read it from inside the VPS over SSH.

Connect with your key, then ask the server for its public address:

# Show the IPv4 address the internet sees
curl -4 ifconfig.co

# Show the IPv6 address, if the server has one
curl -6 ifconfig.co

If curl is not installed, use ip addr to list the interfaces and read the address bound to your public network interface.

One point to be honest about: Harborvm does not hand out a dedicated public IPv4 per VPS. Your server sits on a private address behind the host's public IP, and you expose services through forwarded ports (up to 10 of them). For pointing a domain, this means your A record holds the server's public IPv4, and the forwarded ports decide which services answer on it. For a standard website you forward ports 80 and 443, which is exactly what the HTTPS step below expects.

If you are still deciding where the site should live before you wire up DNS, our guide on how to host a website on a VPS covers the web server setup that sits behind the domain.

Updating DNS at your registrar

Your registrar is wherever you bought the domain. The labels differ slightly between providers, but the DNS editor always offers the same fields: host (or name), type, value (or data or target), and TTL.

Follow these steps:

  1. Log in to your registrar and open the DNS or Nameservers section for your domain. Make sure you are editing DNS records, not transferring the domain or changing nameservers.
  2. Delete or edit any parked A record the registrar created by default. Many point the domain at a placeholder page.
  3. Add an A record. Host @, value your VPS IPv4. Save it.
  4. If your VPS has IPv6, add an AAAA record. Host @, value your IPv6 address.
  5. Add a CNAME for www. Host www, value example.com (your apex). This makes the www version follow the apex.
  6. Set the TTL. Lower it to 300 seconds (five minutes) before any move so changes take effect quickly, then raise it back to an hour or a day once things are stable.

Save the records. The registrar writes them to its nameservers within seconds. What takes time is the rest of the internet noticing.

If you are moving an existing site from another host, lower the TTL a day in advance so the cutover is quick. Sequencing the move this way means visitors never hit a dead server during the switch.

Waiting out DNS propagation and verifying

DNS does not update everywhere at once. Each record carries a TTL, a time-to-live value that tells resolvers how many seconds they may cache the answer before asking again. The TTL is a 32-bit field defined in the DNS standard, RFC 1035; a value of zero means do not cache at all. Until a cached record expires, a resolver keeps serving the old answer, which is why you can see the new site while a friend still sees the old one.

A server rack with network cabling in a data center

How long you wait depends on the TTL that was in effect before you made the change, not the new one. If the old record had a one-hour TTL, most resolvers refresh within an hour. Plan for up to 48 hours for the slowest caches worldwide, though in practice most of your traffic sees the change much sooner.

Verify the new record instead of guessing. Query it directly:

# Ask for the A record of your domain
dig +short example.com A

# Check from a specific public resolver, bypassing your ISP's cache
dig +short @1.1.1.1 example.com A

If dig prints your VPS IP, the record is live on that resolver. Still seeing the old value on your own machine? Flush your local cache, or test from your phone on mobile data to reach a different resolver. Checking from two networks tells you quickly whether the issue is global or just your own cache.

Adding SSL once your domain resolves

Once the domain resolves to your VPS, add HTTPS so browsers trust the site and traffic is encrypted. The free and standard route is a certificate from Let's Encrypt, issued by a tool like Certbot. The certificate authority proves you control the domain by checking that the name points at the server making the request, which is exactly why this step comes after DNS is live.

On Harborvm, HTTPS on your own domain is built in with automatic certificates, so for a site hosted the managed way you do not run the commands below yourself. If you are running your own web server directly, a minimal Certbot flow looks like this:

# Install Certbot (Debian/Ubuntu example)
sudo apt update && sudo apt install certbot

# Request and install a certificate for your domain
sudo certbot --nginx -d example.com -d www.example.com

Plan for renewal from day one. Let's Encrypt certificates are valid for 90 days, per the Let's Encrypt FAQ, so you do not want to renew by hand. Certbot installs a timer that renews automatically well before expiry, and the built-in HTTPS on Harborvm renews for you with no action needed.

A few things that commonly block the certificate: port 443 (and port 80 for the initial challenge) must be reachable, so forward both if you run your own server behind forwarded ports, and the domain must already resolve to the right IP. If the issuance fails, recheck the DNS record with dig before touching anything else.

Next step

Create the A record now with a low TTL, confirm it with dig +short @1.1.1.1 yourdomain.com, then add HTTPS once it resolves. If you still need to pick where the site runs, a dedicated vCPU keeps response times steady under load, which matters once the domain is live and real traffic is answering on it.

Frequently asked questions

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

The DNS record itself updates at your registrar in seconds. Resolvers around the world then refresh according to the record's TTL. Most people see the change within a few hours, and you should allow up to 48 hours for every cache to catch up.

Do I need an A record, an AAAA record, or both?

Use an A record for your IPv4 address and an AAAA record for your IPv6 address. Add both if your VPS has both. If it only has IPv4, a single A record is enough.

Can I point a domain to a VPS without a dedicated public IPv4 address?

You still need a reachable IP to point at. On Harborvm you get a private address behind the server's IP with forwarded ports, so you point your A record at the server's public IPv4 and forward the ports your site uses.

Why does my domain still show the old site after I changed DNS?

Your computer or network is caching the old record until its TTL expires. Flush your local DNS cache, test from a different network or phone, or query a public resolver directly to confirm the new value.