What Is DNS and How to Connect a Domain to a VPS
Your website is already running on the server, but the domain still opens the old page. It is frustrating to spend time on the launch and stop one step short of the result.
We will explain what DNS is, which records to change and how to connect a domain to a VPS. We will go from the IP address to checking the answer without touching your existing email.
What DNS and a DNS server are
DNS is the Domain Name System. It lets you find data about a domain, including the address of the server where the website runs. People find names convenient, while the network needs an IP address.
When you type a domain into a browser, your device may use its cache — a stored answer. If there is no current answer, a recursive resolver joins the lookup: a service that queries DNS on your behalf.
If needed, the resolver contacts the root servers and then the servers of the domain zone, such as .com. This is how it finds the authoritative DNS server that stores the records of the domain in question.
For example, your blog has moved to another VPS. The domain stays the same, but the address in DNS has to be replaced. You do not need to install your own DNS server for this: you can use the service of your registrar or another DNS provider.
“A clear address helps people find the way to your idea.”
Start with two things: have your domain name and the public address of your VPS ready.
Which DNS records you need
Every record has a name, a type and a value. The name shows which domain or subdomain the record applies to, and the type defines what data it holds.
| Type | Value | Purpose |
|---|---|---|
| A | IPv4 address | Point the domain to the VPS |
| AAAA | IPv6 address | Add verified access over IPv6 |
| CNAME | Another domain name | Make www an alias of the main domain |
| MX | Mail server name and priority | Define where email is received |
| TXT | Text value | Verify the domain or configure email |
In control panels, the @ sign usually means the main domain, for example example.com. The www field refers to www.example.com. The interface may ask for the full name or an empty field instead of @ — follow your provider's hint.
A CNAME record contains a domain name, not an IP or an address with https://. It does not create an HTTP redirect: the browser will not change the address bar because of a CNAME alone.
For a simple website, an A record for the main domain and a CNAME for www are enough. If you do not need the www subdomain, you can skip it. Check these two names before making changes.
How to connect a domain to a VPS
We will show a scenario in which you keep your current NS servers and edit only the records you need. NS records indicate which servers are responsible for the DNS zone; they are not the address of the website itself.
To get started, prepare:
- access to the panel where the active DNS zone is stored;
- the public IPv4 address of your VPS;
- a copy of the current records, especially the email ones;
- access to the server or an administrator's help for the next stage.
Save your current settings before editing. This will help you restore the previous values if you make a mistake.
Find the IP and the DNS zone
Take the VPS IP address from the service details in your provider's panel. You need a public address: a local one such as 192.168.1.10 will not make the website reachable from the internet.
If the server has not been created yet, you can choose a cloud VPS for your website at FOTBO. After launch, check the address against the details of the exact server that hosts the website.
The domain and DNS can be with different companies. For example, the domain was bought from a registrar, but its NS records point to Cloudflare. In that case, edit the records in Cloudflare, not in the registrar's inactive zone.
Check the current NS in the domain settings and compare them with the servers of your chosen DNS provider. If you keep this service, you do not need to change NS to connect the VPS.
Add A and CNAME records
Open the active zone and find the address record of the main domain. In the example below, 203.0.113.10 is an address reserved for documentation, and example.com is a placeholder domain. Replace them with your own data; the example is not a working server.
@ A 203.0.113.10 TTL 300
www CNAME example.com TTL 300If @ already has an A record with the old IP, change it. Do not add a second A record at random: several addresses can be an intentional setup, but in our scenario an extra record may send some requests to the old server.
For www, choose one approach: a CNAME to the main domain or an A record with the VPS address. A regular CNAME must not coexist with A or AAAA for the same name. Use an A record for the zone apex; special ALIAS or flattening options depend on the provider.
Add an AAAA record only if IPv6 is configured and the website is reachable at that address. An old AAAA record may send some visitors to another server even when the A record is correct.
Do not delete MX and TXT email records. If email works through mail.example.com, check its address records too: they may be tied to the server you are changing.
Save the changes and check the name, type and address once more. A single extra character can send the request somewhere else entirely.
When DNS records update
DNS TTL sets how long a resolver may keep an answer in its cache. A value of 300 means 300 seconds, or five minutes. This does not guarantee that every visitor will see the new address in exactly five minutes.
If the previous TTL was 14,400 seconds, an answer already received may stay in the cache for up to four hours. Lowering the TTL while changing the IP does not cancel the old lifetime for copies that are already stored.
For a planned migration, lower the TTL in advance and wait out the previous caching period. If your provider does not allow 300, use the available value and account for it in your plan.
A new record may also not appear everywhere at once: a resolver can cache an earlier answer saying that the record does not exist. Changing NS has its own timing and is not the same as editing an A record.
Instead of waiting blindly, check the answer at the source and through a resolver. This shows exactly where the old data has remained.
How to check DNS records
To check DNS records, use dig in a terminal or nslookup. The commands below only request data and do not change any settings. Replace example.com with your own domain.
dig example.com A +short
dig www.example.com CNAME +short
dig example.com AAAA +short
dig example.com NS +shortIn our placeholder example, the first query should return 203.0.113.10. The second should return example.com., where the trailing dot marks a fully qualified domain name. An empty AAAA answer is normal if IPv6 is not configured for the website.
A CNAME alone does not confirm the final address of www. Also run dig www.example.com A +short and check the returned IP: the answer may contain both the alias and the address.
To query a specific public resolver, run dig @1.1.1.1 example.com A +short. If the result differs from the local one, the cause may be caching. To understand an error, repeat the query without +short and read the status field.
Next, take the name of an authoritative server from the NS answer and use it instead of ns1.provider.example:
dig @ns1.provider.example example.com A +norecurseLook for the aa flag and the required record in the ANSWER section. Check every active authoritative server: one correct answer does not prove that all of them already return the same data.
If dig is not available, try nslookup -type=A example.com. Look for the domain's address in the answer block, not in the Address field next to the DNS server's name. To query NS, run nslookup -type=NS example.com.
If a CDN proxy is enabled, the answer may contain the proxy's address rather than the VPS. In that case, check the target IP in your DNS provider's panel. Compare the results with your connection setup in mind.
Why the domain does not open the website
A correct DNS answer confirms the address, not that the website works. The web server still has to accept requests for your domain, and HTTPS requires a valid certificate.
“Every next step is easier when the previous one has already been checked.”
If you see NXDOMAIN, check the spelling of the domain, its registration, the NS delegation and whether the name exists in the active zone. If you see SERVFAIL, the authoritative servers or DNSSEC may have problems; this is a different situation from a missing A record.
If the IP is correct but the connection times out, check that the web server is running, the network rules and the required ports. Plain HTTP uses TCP 80, and HTTPS uses TCP 443.
The default Nginx page or a different website often points to which web server configuration was selected. In Nginx, the domain must match the server_name of the right block; changing the A record alone will not configure this.
Errors 403 and 404 are also checked at the web server and application level: access permissions, file paths, routes and logs. Do not change DNS again if you have already confirmed the correct address.
For a preliminary HTTP check, you can run curl --resolve example.com:80:203.0.113.10 http://example.com/. Replace the domain and IP with your own: the command sends this request to the chosen server, bypassing the usual address lookup.
After DNS, set up the website with the guide “How to Install Nginx on Ubuntu and Launch a Website on a VPS”. Then move on to “How to Set Up HTTPS on a VPS with Let's Encrypt and Certbot”.
The next step after DNS
Now you know what DNS is and how to connect a domain to a VPS: find the active zone, update the A record, add www if needed and compare the servers' answers.
Save the working values and the date of the changes. Once the DNS server returns the right address, you can calmly move on to the web server and HTTPS — and open the website to visitors under your own domain.

SIMILAR ARTICLES




