Point a domain name to a VPS
A domain name does not magically "point" at a server: it publishes DNS records that give one or more addresses. Until those records are correct, your web server can be perfectly configured and still unreachable by name. Order matters: DNS first, web server next, verify at every step.
Get the addresses
In the VPS panel, note the included IPv6 address and, if enabled, the IPv4 address. Check them on the machine:
ip -6 addr show scope global
ip -4 addr show scope globalA scope global address is public. A fe80:: address is link-local and must never appear in a DNS record.
Create the records
At your registrar or DNS provider, open the domain zone and add:
| Type | Name | Value |
|---|---|---|
A |
votre-domaine.fr |
VOTRE_IPV4 |
AAAA |
votre-domaine.fr |
VOTRE_IPV6 |
A |
www |
VOTRE_IPV4 |
AAAA |
www |
VOTRE_IPV6 |
Do not create a CNAME on the domain root: it conflicts with mandatory records. If you use a CDN proxy, the published addresses are the CDN's, not the VPS's; configure the origin in the CDN instead.
Choose the TTL
The TTL is how long resolvers keep the answer. During setup or migration, use a low value such as 300 seconds so you can fix mistakes quickly. Once stable, raise it to 3600 or more to reduce load and resolution latency. Lower the TTL at least an hour before changing an address.
Verify resolution
dig +short A votre-domaine.fr
dig +short AAAA votre-domaine.fr
dig +short A votre-domaine.fr @1.1.1.1The first command queries your local resolver, the last a public one: both must return the same addresses. If they differ, a cache has not expired yet. dig +trace votre-domaine.fr shows delegation from the root and helps locate a badly delegated zone.
On the web server
DNS only gives the address. The server must then accept the name: in Nginx, server_name votre-domaine.fr www.votre-domaine.fr; inside the server block. Without it, the request arrives but gets the default page. Test with curl -I http://votre-domaine.fr/ then curl -6 -I http://votre-domaine.fr/. If both answer, the name, addresses and server agree.
Advertisement
Was this article helpful?
Read next
- When to add a dedicated IPv4IPv6 included, IPv4 optional: when IPv4 becomes necessary and how to handle dual stack.
- Publish your first page on a VPSInstall Nginx, create a page under /var/www, open port 80 and test over both IPv6 and IPv4.
- Understanding IPv6 on a VPSIncluded public address, service listening, firewall and AAAA DNS record.