Mar 02, 2026
Domantas G. & Valentinas C.
6min Read
To use a custom domain name with a virtual private server (VPS), you must make a few DNS changes. Otherwise, your website will become inaccessible since the DNS server can’t resolve your domain into its IP address.
In this tutorial, we’ll show you how to point a domain name to VPS using three methods – changing the A record, configuring Cloudflare, or using custom nameservers.
Before proceeding, purchase a domain name from a registrar. In this example, we will use Hostinger. To future-proof and protect your branding, make sure to consider our Domain Bundle deal as well.
Keep in mind that the steps may differ depending on your domain registrar.

After setting up your Linux VPS, open Hostinger’s hosting control panel, hPanel. Click VPS and select Manage for the server in question. On the VPS information tab, copy your server IP address.
In this section, we’ll explain three methods to point a domain name to your VPS, from the easiest to the most advanced. Since the outcome is the same, choose whichever suits your needs.
Point a domain to VPS using the A record
The easiest way to point your domain is by modifying the A record type in your current DNS zone.
This method will keep your DNS zone file and existing record entries at the current provider. The approach is ideal for beginners or users who don’t want to alter their DNS zone location.
Before proceeding, use a DNS lookup tool to find the NS records and check your domain name’s current pointing location. Alternatively, use the dig command via Terminal:
dig NS +short domain.tld
If you purchased the domain from Hostinger, you can easily change the DNS record entries via hPanel:
Your DNS entries may look different depending on the approach. If you use two A records for the domain and www subdomain, here’s how the entries should look:
| Name | TTL | Type | Address |
| example.com | 14400 | A | 123.12.123.12 |
| www.example.com | 14400 | A | 123.12.123.13 |
Meanwhile, the entries should look like this if you use A and CNAME records setup for the domain and subdomain:
| Name | TTL | Type | Address |
| example.com | 14400 | A | 123.12.123.12 |
| www.example.com | 14400 | CNAME | example.com |
After you point the domain to the virtual private server, check whether the entries were added correctly. Use DNS checkup tools or enter the dig command via Terminal:
dig A +short domain.tld
If configured correctly, Terminal will return your VPS’s IP address as the A record. The DNS propagation time may take up to 24 hours, but flushing DNS can help speed up the process.
Once it’s complete, you will see a default loading page when visiting your domain.
Point a domain to VPS via Cloudflare
Pointing a domain via Cloudflare requires extra steps. Fortunately, the procedure is similar regardless of your VPS hosting control panel.
In addition to changing the A record in DNS settings, you must assign the Cloudflare nameservers to your domain name.
To start, follow these steps to add your domain to Cloudflare:
Now, change the nameservers on your registrar’s domain management panel. Here’s how to do it on Hostinger:
Flush DNS to speed up propagation and wait until your domain becomes accessible. To verify if the DNS records are set up correctly, use a lookup tool or enter dig in Terminal.
Point a domain to VPS using custom nameservers
Pointing a domain via custom nameservers is trickier, as you must set up a new DNS zone on the virtual server. However, it allows you to use hPanel to control the domain for easier management.
This method will switch your DNS zone location to the VPS. This means you can manage all DNS-related settings in the newly created zone. To do so, follow these steps:
After completing the setup of the child nameservers, create a DNS zone on your Hostinger VPS hosting account. Before proceeding, run this command to ensure your VPS has the BIND service:
named -v
If you use Hostinger’s VPS operating system templates, it should be pre-installed. Otherwise, download and install BIND on your Linux machine. Then, follow these steps to set up the DNS zone on your VPS:
cd /etc/bind
mkdir -p zones
cd zones
nano domain.tld
;
; BIND data file for domain.tld
;
$TTL 3h
@ IN SOA ns1.domain.tld. admin.domain.tld. (
1 ; Serial
3h ; Refresh after 3 hours
1h ; Retry after 1 hour
1w ; Expire after 1 week
1h ) ; Negative caching TTL of 1 day
;
@ IN NS ns1.domain.tld.
@ IN NS ns2.domain.tld.
domain.tld. IN MX 10 domain.tld.
domain.tld. IN A 123.12.123.12
ns1 IN A 123.12.123.12
ns2 IN A 123.12.123.13
www IN CNAME domain.tld.
mail IN A 123.12.123.12
ftp IN CNAME domain.tld.cd /etc/bind
nano named.conf.local
zone "domain.tld" {
type master;
file "/etc/bind/zones/domain.tld";
};nano named.conf.options
// forwarders {
// 0.0.0.0;
// };After adding the values, execute this command to check if the DNS zone file syntax is correct:
named-checkzone domain.tld /etc/bind/zones/domain.tld
If the syntax is correct, the output should be similar to:
After ensuring the file is correctly configured, run these commands to restart the DNS bind service:
/etc/init.d/bind9 restart
/etc/init.d/bind9 start
Once the DNS zone is set, change your domain nameservers to the new ones.
To point your domain to Hostinger, go to hPanel → Domains → Domain Portfolio. Click Manage for the domain in question and click Edit next to the nameservers.
Wait for the DNS propagation process and check the status using checkup tools or Terminal. Then, access your domain via a web browser to verify if it’s configured correctly.
You may need to set up a reverse DNS record for various reasons, like tracking users or the origin of an email. It lets the DNS server resolve your VPS IP address to the domain name, not the opposite.
To set up a reverse DNS, Hostinger users can add a pointer (PTR) record to VPS via hPanel. Here are the steps:
You can also ask Kodee, our AI assistant, to create or remove a reverse DNS on your VPS. To do this, simply ask the following, with vpshostname.com and domainname.com being their actual values:
Set up a reverse DNS for my vpshostname.com VPS using the domainname.com domain.
Once added, wait until the DNS servers fully propagate the PTR record.

Pointing your domain name to VPS is essential to make your website accessible online. In this tutorial, we have explained three different methods to do so:
After changing the DNS settings, wait 24 hours until the propagation process is finished. Once the domain starts working, use the VPS to host your website or web applications.
How to Change Hostname on Linux
How to Use Tmux on Linux for Task Management
How to Start Working with Linux Screen
In this section, we will answer several questions about how to point a domain name to VPS. If yours remains unanswered, leave it under the comments section below.
Unlike A records, nameservers automatically match the DNS zone with your VPS hosting IP address. With the A record type, you must reconfigure the IP address whenever it changes. If your server IP address is static, we recommend using the A record to point to your domain name.
You can use an online DNS lookup tool or the dig command via Terminal. Here’s the command’s syntax: dig NS +short domain.tld.
The default nameservers are typically bound to the web hosting provider and contain branding like ns1.hostinger.com. Custom nameservers let you use different DNS servers unrelated to your hosting provider, like ns1.yourdomain.com. It improves branding and makes switching hosting providers easier.
If your DNS records are set correctly, your domain points to the correct IP address and nameservers. Use a DNS lookup tool, run the dig command, or ping the domain to verify if it resolves to the right IP address.