Articles

29/07/2026

DOMAIN AND VPS GUIDE 2026

How to Point a Domain to Your VPS: Complete DNS and Web Server Guide

Learn how to connect a domain name to a VPS using DNS records, configure Nginx or Apache, activate HTTPS, verify DNS propagation, and troubleshoot common domain connection problems.

Written by Hamza

What Does Pointing a Domain to a VPS Mean?

A virtual private server is normally identified by a public IP address, such as 192.0.2.10. Although visitors can sometimes access a website by entering its IP address, using a memorable domain name is more professional and practical.

Pointing a domain to a VPS means configuring the domain’s Domain Name System records so that requests for the domain are directed to the public IP address assigned to the server.

For example, when someone enters example.com in a browser, DNS translates that domain into the VPS IP address. The visitor’s browser then connects to the server, where Nginx, Apache, Caddy, or another web server delivers the website.

Connecting the DNS record is only the first part of the process. The VPS must also be configured to recognize the domain, accept web traffic, serve the correct website, and provide a valid HTTPS certificate.

Quick Summary

  • Domain: The human-readable address visitors use to reach your website.
  • VPS IP address: The public network address assigned to your virtual server.
  • A record: Connects a domain or subdomain to an IPv4 address.
  • AAAA record: Connects a domain or subdomain to an IPv6 address.
  • CNAME record: Points one hostname to another hostname.
  • Web server: Nginx, Apache, or another service that responds to website requests.
  • SSL certificate: Encrypts traffic and activates HTTPS.
  • DNS propagation: The time required for DNS changes to become visible across different networks.

How the Domain-to-VPS Connection Works

When a visitor opens your domain, several systems work together. DNS identifies the destination IP address, the browser connects to the VPS, and the web server selects the website configuration associated with the requested domain.

Visitor enters example.com

DNS looks up the domain

DNS returns the VPS IP address

The browser connects to the VPS

Nginx or Apache identifies the domain

The website is delivered to the visitor

What You Need Before Starting

Registered Domain

You need access to the DNS management panel provided by your registrar or DNS hosting service.

Public VPS IP

Obtain the server’s public IPv4 address and, when available, its public IPv6 address.

SSH Access

Administrative access is needed to install and configure the web server and firewall.

Website Files

Prepare your HTML files, application, CMS, container, or reverse-proxy destination.

STEP 1

Find the Public IP Address of Your VPS

The VPS provider normally displays the public IP address in the server dashboard, welcome email, control panel, or network settings.

You can also connect to the server through SSH and check its public IPv4 address with a command such as:

curl -4 ifconfig.me

To check the public IPv6 address, use:

curl -6 ifconfig.me
Important:
Use the VPS public IP address, not a private address beginning with values such as 10.x.x.x, 172.16.x.x, or 192.168.x.x.

STEP 2

Open Your Domain’s DNS Management Panel

Sign in to the company that currently manages your domain’s DNS. This may be the domain registrar, a hosting company, or a dedicated DNS provider.

Look for a menu named DNS Management, DNS Zone, Manage Records, Zone Editor, or Advanced DNS.

Before changing anything, review the existing records. Deleting MX, TXT, DKIM, SPF, or verification records can interrupt email delivery and third-party services.

DNS Records Used to Connect a Domain to a VPS

Record Purpose Example Value
A Connects a hostname to an IPv4 address. 192.0.2.10
AAAA Connects a hostname to an IPv6 address. 2001:db8::10
CNAME Makes one hostname an alias of another hostname. www → example.com
MX Controls where email for the domain is delivered. mail.example.com
TXT Stores verification, SPF, DKIM, DMARC, and other text data. Service-specific value

STEP 3

Create an A Record for the Root Domain

Create an A record that points the root domain to your VPS IPv4 address.

Field Recommended Value
Type A
Name or Host @
Value or Points To Your VPS IPv4 address
TTL 300 seconds, automatic, or the provider default
Example:
Type: A
Host: @
Value: 192.0.2.10
TTL: 300

STEP 4

Configure the WWW Version of the Domain

The root domain and the www version are separate DNS hostnames. Creating a record for example.com does not always make www.example.com work automatically.

A common configuration is to create a CNAME record for www:

Type: CNAME
Host: www
Target: example.com
TTL: Automatic or 300

Alternatively, you can create another A record for www and point it directly to the same VPS IPv4 address.

Recommended approach:
Use an A record for the root domain and a CNAME record for www. This reduces duplication because www automatically follows the root hostname.

Should You Create an AAAA Record?

Create an AAAA record only when the VPS has a properly configured public IPv6 address and the web server is listening for IPv6 connections.

Example AAAA record:
Type: AAAA
Host: @
Value: 2001:db8::10

Do not create an AAAA record simply because the DNS panel allows it. Some visitors prefer IPv6 when both IPv4 and IPv6 records exist. If IPv6 is not working correctly, those visitors may experience connection failures even though the IPv4 website works.

Safe rule:
When you are unsure whether IPv6 is correctly configured, begin with the A record only and add the AAAA record after testing IPv6 connectivity.

Changing DNS Records vs Changing Nameservers

These are two different operations. You normally do not need to change nameservers just to point a domain to a VPS.

Action What It Changes When to Use It
Edit A or CNAME records Changes where specific hostnames point. Use this when the current DNS provider will continue managing the domain.
Change nameservers Transfers DNS management to another provider. Use this when moving the complete DNS zone to a new DNS service.
Warning:
Changing nameservers without copying the existing DNS zone can break email, subdomains, verification records, and other connected services.

STEP 5

Install a Web Server on the VPS

DNS only directs traffic to the server. The VPS still needs a web server that listens on ports 80 and 443 and delivers the website.

Install Nginx on Ubuntu or Debian

sudo apt update
sudo apt install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx

Check the Nginx Service

sudo systemctl status nginx

After installation, enter the VPS IP address in a browser. The default Nginx page should appear when the service and firewall are correctly configured.

Allow Web Traffic Through the Firewall

The VPS firewall and the provider-level network firewall must allow inbound traffic on the required ports.

Port Protocol Purpose
22 TCP SSH administration
80 TCP Unencrypted HTTP traffic and certificate validation
443 TCP Encrypted HTTPS traffic

For a VPS using UFW, you can allow Nginx web traffic with:

sudo ufw allow OpenSSH
sudo ufw allow ‘Nginx Full’
sudo ufw enable
sudo ufw status
Avoid locking yourself out:
Always allow SSH access before enabling a new firewall configuration.

STEP 6

Configure Nginx for Your Domain

Create a directory for the website:

sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html

Create a simple test page:

nano /var/www/example.com/html/index.html

Add the following HTML:

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>My VPS Website</title>
</head>
<body>
<h1>The domain is connected to the VPS.</h1>
</body>
</html>

Create the Nginx server block:

sudo nano /etc/nginx/sites-available/example.com

Add this configuration and replace example.com with your real domain:

server {
listen 80;
listen [::]:80;server_name example.com www.example.com;

root /var/www/example.com/html;
index index.html index.htm;

location / {
try_files $uri $uri/ =404;
}
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Configuration test:
Always run sudo nginx -t before reloading Nginx. This helps detect syntax errors that could prevent the web server from restarting correctly.

Apache Virtual Host Alternative

When your VPS uses Apache instead of Nginx, create a virtual host configuration:

sudo nano /etc/apache2/sites-available/example.com.conf

Add:

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.comDocumentRoot /var/www/example.com/html

<Directory /var/www/example.com/html>
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined
</VirtualHost>

Enable the website and reload Apache:

sudo a2ensite example.com.conf
sudo apache2ctl configtest
sudo systemctl reload apache2

STEP 7

Wait for DNS Propagation

DNS changes are not always visible immediately. Resolvers, internet providers, devices, and browsers may temporarily cache the previous DNS result.

Some changes appear within minutes, while others can take several hours. In certain situations, cached records or nameserver changes may take longer.

DNS Change Common Observation
A or CNAME record May update within minutes but can remain cached longer.
Nameserver change Can require more time because the authoritative DNS provider is changing.
Low TTL record Usually refreshes more quickly after existing caches expire.
Important:
DNS propagation does not repair incorrect records. If the domain still points to the wrong IP after caches should have expired, verify the authoritative nameservers and DNS zone configuration.

How to Verify the DNS Records

Use DNS lookup tools to confirm that the domain returns the expected VPS IP address.

Check with Dig

dig example.com A
dig www.example.com
dig example.com AAAA

Check with Nslookup

nslookup example.com

Check the HTTP Response

curl -I http://example.com
curl -I http://www.example.com

Confirm that the returned IP matches your VPS and that the HTTP response comes from the intended web server.

STEP 8

Activate HTTPS with a Free SSL Certificate

After the domain correctly resolves to the VPS and the website works over HTTP, install an SSL certificate to encrypt traffic.

Install Certbot for Nginx

sudo apt update
sudo apt install certbot python3-certbot-nginx -y

Request the Certificate

sudo certbot –nginx -d example.com -d www.example.com

Test Automatic Renewal

sudo certbot renew –dry-run
Certificate requirement:
The domain must already resolve to the VPS, and ports 80 and 443 must be reachable for normal certificate validation and website traffic.

Pointing a Domain to a VPS Application

Applications built with Node.js, Python, Docker, Java, Go, or another platform may run on an internal port such as 3000, 5000, or 8080.

In this situation, Nginx can act as a reverse proxy. Visitors connect to the standard web ports, while Nginx forwards requests to the internal application.

server {
listen 80;
listen [::]:80;server_name app.example.com;

location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Security benefit:
The application port can remain restricted to localhost instead of being exposed directly to the public internet.

How to Point a Subdomain to the VPS

You can use subdomains to host separate websites, applications, dashboards, APIs, control panels, or development environments.

Hostname DNS Record Possible Purpose
app.example.com A record to the VPS IP Web application
api.example.com A record to the VPS IP API endpoint
blog.example.com A or CNAME record Blog or CMS installation
staging.example.com A record to the VPS IP Testing environment

Each subdomain also needs a corresponding Nginx server block, Apache virtual host, reverse-proxy route, or application configuration.

Will Pointing the Domain Affect Email?

Editing the website’s A record does not normally change email delivery when the MX and related TXT records remain intact.

However, deleting the complete DNS zone, replacing nameservers, or removing mail-related records can interrupt email.

  • Keep the existing MX records unless you are intentionally moving email.
  • Preserve SPF, DKIM, and DMARC TXT records.
  • Preserve verification records used by email or business platforms.
  • Check whether the mail hostname depends on the old server IP.
  • Copy the complete DNS zone before changing nameservers.
Best practice:
Export or record the current DNS configuration before making changes. This gives you a reference if a service stops working.

Using a CDN or Reverse Proxy in Front of the VPS

A CDN or DNS-based reverse-proxy service can sit between visitors and your VPS. Supported web traffic is sent through the provider’s network before reaching the origin server.

Caching

Static files may be served closer to visitors, reducing requests to the VPS.

TLS Management

The service may provide visitor-facing HTTPS and additional certificate options.

Traffic Filtering

Selected malicious requests, bots, or unusual traffic may be filtered.

Origin Protection

The public DNS response may show the proxy network instead of the VPS address.

Remember:
A proxy does not automatically protect an origin IP that remains publicly accessible through old DNS records, email headers, other subdomains, or exposed services.

Common Problems and How to Fix Them

Problem Possible Cause Recommended Check
Domain shows the old website Cached DNS or an old proxy configuration Check authoritative DNS records and test through another resolver.
Domain does not resolve Missing record, incorrect nameservers, or expired domain Verify registration status, nameservers, and the DNS zone.
Connection timed out Firewall blocking ports 80 or 443 Review the VPS firewall and provider network firewall.
Default Nginx page appears Server block not enabled or server_name mismatch Check enabled sites and the requested hostname.
www does not work Missing www DNS record or web server alias Create the www record and add www to server_name or ServerAlias.
SSL certificate request fails Incorrect DNS, blocked port 80, or wrong web server configuration Confirm DNS resolution and public HTTP accessibility.
Some visitors cannot connect Broken IPv6 configuration Test the AAAA record or temporarily remove it.
Email stops working MX or TXT records were removed Restore the original mail-related DNS records.

Useful VPS Troubleshooting Commands

Test Nginx configuration

sudo nginx -t
Check listening ports

sudo ss -tulpn
View Nginx errors

sudo tail -f /var/log/nginx/error.log
Check firewall status

sudo ufw status verbose
Test local web response

curl -I http://127.0.0.1
Check service status

systemctl status nginx

Security Checklist After Connecting the Domain

  • Install operating-system and application security updates.
  • Use SSH keys instead of password-only administrative access.
  • Disable unnecessary public ports and services.
  • Install a valid SSL certificate and redirect HTTP to HTTPS.
  • Protect application login pages with rate limiting.
  • Use strong database passwords and restrict database access.
  • Configure automatic off-server backups.
  • Monitor web server, authentication, and application logs.
  • Renew SSL certificates automatically.
  • Keep CMS themes, plugins, frameworks, and dependencies updated.
Important:
Pointing a domain to the VPS makes the service easier to access, but it does not secure the server. DNS, operating-system security, web server configuration, application security, and backups must all be managed separately.

Complete Domain-to-VPS Checklist

  1. Confirm that the domain is active and accessible.
  2. Find the VPS public IPv4 address.
  3. Confirm whether the VPS has working IPv6 connectivity.
  4. Open the authoritative DNS management panel.
  5. Back up or record the existing DNS zone.
  6. Create an A record for the root domain.
  7. Create a CNAME or A record for www.
  8. Add an AAAA record only when IPv6 is properly configured.
  9. Install Nginx, Apache, Caddy, or another web server.
  10. Allow ports 80 and 443 through the firewall.
  11. Create the website directory and server configuration.
  12. Test the web server configuration before reloading it.
  13. Verify DNS resolution with dig or nslookup.
  14. Test both the root domain and www version.
  15. Install a valid SSL certificate.
  16. Redirect HTTP traffic to HTTPS.
  17. Test the website from different devices and networks.
  18. Confirm that email and other DNS-dependent services still work.
  19. Configure monitoring, updates, and automatic backups.

Frequently Asked Questions

Which DNS record points a domain to a VPS?

An A record connects a domain or subdomain to the VPS IPv4 address. An AAAA record is used for a working IPv6 address.

What should I enter in the DNS host field?

Most DNS providers use the @ symbol for the root domain. For a subdomain, enter only the subdomain label, such as app, blog, api, or www.

Do I need to change my domain nameservers?

Not usually. You can edit the A and CNAME records at the current DNS provider. Change nameservers only when you intentionally want another company to manage the complete DNS zone.

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

Some DNS changes become visible within minutes, while cached records may take several hours to refresh. Nameserver changes can take longer.

Why does the IP address work but the domain does not?

The DNS record may be incorrect, the change may still be cached, or the web server may not include the domain in its server_name or ServerAlias configuration.

Can several domains point to the same VPS?

Yes. Multiple domains can use the same VPS IP address. Nginx server blocks or Apache virtual hosts determine which website is served for each requested domain.

Do I need a dedicated IP address?

You need a stable public IP address assigned to the VPS. It does not normally need to be dedicated to only one website because modern web servers can host several domains on one IP.

Should I install SSL before changing DNS?

For standard automated certificate validation, first point the domain to the VPS and confirm that the website is publicly reachable. Then request and install the SSL certificate.

Final Thoughts

Pointing a domain to a VPS involves more than adding an IP address to a DNS panel. A complete configuration connects the root domain and www hostname, prepares the web server, opens the required firewall ports, verifies DNS resolution, and activates HTTPS.

For a standard setup, create an A record that sends the root domain to the VPS IPv4 address and a CNAME record that sends www to the root domain. Add an AAAA record only when IPv6 connectivity has been properly configured and tested.

On the VPS, configure Nginx or Apache to recognize the requested domain, serve the correct website directory, and accept traffic on ports 80 and 443. Once the domain is resolving correctly, install an SSL certificate and redirect visitors to HTTPS.

Finally, test the root domain, www version, subdomains, IPv4, IPv6, SSL certificate, email records, firewall, and application logs. A careful verification process can prevent downtime, incorrect website routing, certificate errors, and broken email services.

Technical note:
DNS interfaces, firewall tools, Linux package names, directory structures, web server configurations, certificate procedures, and provider network settings may differ. Replace example domains and documentation-only IP addresses with your actual information, back up existing configurations, and test changes before using them on an important production website.
Retzor Reviews