Blog VPSChoice guides

How to point a domain to a VPS

Four steps to connect a domain name to your server.

What you need

You need a running VPS with a public IPv4 address, a web server such as Nginx or Apache that listens on port 80, and a domain name that you control. Find the IP address in your VPS control panel.

Step 1: Open your DNS settings

Log in to the client area, open your domain and choose DNS management. If your domain is registered somewhere else, open the DNS settings there. See how to transfer a domain if you want everything in one account.

Step 2: Create an A record

Add an A record with the host @ (the root domain) and set the value to your VPS IPv4 address. Add a second A record for www, or a CNAME from www to your root domain. If your VPS has IPv6, add an AAAA record with the IPv6 address too.

Step 3: Wait for DNS to update

DNS changes can take from a few minutes to a few hours to spread. Lower the TTL to 300 seconds before a migration so that the change is quick. You can check progress with dig or nslookup, or an online DNS checker.

Step 4: Configure the web server

Tell Nginx or Apache about the new domain by creating a server block or virtual host with the server_name set to your domain, and reload the service. Make sure the firewall allows ports 80 and 443.

Step 5: Add HTTPS

Install Certbot and request a free Let’s Encrypt certificate for your domain and the www name. Certbot can edit the Nginx configuration and renew the certificate automatically. Redirect HTTP to HTTPS and test the site.

Troubleshooting

If the domain still shows the old site, clear your local DNS cache and try another network. If you see a default web server page, the server block does not match the domain. If the browser times out, check the firewall and that the web server is running. If you see a certificate warning, make sure the certificate covers both names.

FAQ

Frequently asked questions

How long does DNS take to update?

Often a few minutes, and up to a few hours in some cases. Lowering the TTL before the change helps.

Should I use an A record or a CNAME?

Use an A record for the root domain. Use a CNAME for www if you want it to follow the root domain.

Why does my domain show the wrong site?

Your web server may not have a server block for the domain, or DNS has not updated yet. Check both.

Do I need a dedicated IP address?

Your VPS already has its own IP address, so you can point as many domains as you like to it.

Put it into practice

Deploy a VPS in the location closest to your users.

View VPS plans →