After purchasing a VPS and a domain, many users face the question: how do you correctly connect the two so the website starts working? In this article, you’ll find a simple, step-by-step guide to connecting a domain to your VPS via DNS and configuring it using Nginx or Apache. This guide is written specifically for beginners, without complicated technical jargon.

What You’ll Need:

To connect a domain to your VPS, you will need:

  • A registered domain name (e.g., from our site). This is the unique address of your site on the Internet.
  • An active VPS server with an installed operating system (e.g., Ubuntu, Debian, CentOS). You can view VPS plans on Server.ua.
  • Access to the domain control panel where you registered the domain.
  • SSH access to the server (to manage it via command line).

Step 1: Set Up DNS Records

DNS (Domain Name System) is the internet’s “phone book,” converting domains (e.g., example.com) into the corresponding IP address.

  1. Log in to your domain registrar’s control panel
  2. Find the “DNS Records” or “DNS Management” section
  3. Create or update the following records:
    • A Record: Points your domain to the IP address of your VPS (e.g., example.com -> 192.0.2.123)
    • CNAME (optional): To redirect www.example.com to example.com

DNS changes may take time to propagate — from a few minutes to several hours, sometimes up to 24 hours.

Step 2: Configure Your Web Server (Nginx or Apache)

A web server is software that processes requests to your website. The most common ones are Nginx (lightweight and fast) and Apache (flexible with lots of modules).

Install the Web Server:

On Debian/Ubuntu:

sudo apt update
sudo apt install nginx   # or apache2

Create a Configuration File for Your Domain

For Nginx:

File: /etc/nginx/sites-available/yourdomain.com

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/yourdomain.com;
    index index.html index.htm index.php;

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

Then activate the config:

sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
sudo systemctl restart nginx

For Apache:

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/yourdomain.com

    <Directory /var/www/yourdomain.com>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Enable the site:

sudo a2ensite yourdomain.com.conf
sudo systemctl restart apache2

Make sure the folder /var/www/yourdomain.com exists and contains an index.html file — otherwise, you’ll get an error.

Step 3: Set Up SSL (HTTPS)

An SSL certificate encrypts the data between your visitor’s browser and your website. HTTPS is the current standard for web security.

You can purchase an SSL certificate from Server.ua and install it manually on your server or follow instructions to integrate it with your web server.

Having an SSL certificate boosts user trust and positively impacts your website’s SEO ranking.

Done!

Your domain is now connected to your VPS and served by your web server. You can now:

  • install a CMS (e.g., WordPress);
  • create a blog or online store;
  • set up email, databases, or API services.

Additional Tips:

  • Use VPS with NVMe drives for maximum site speed
  • Make regular backups of your project
  • Configure a firewall (e.g., ufw) to protect from attacks
  • Install fail2ban to protect against brute-force login attempts

Frequently Asked Questions (FAQ)

What if the site doesn’t open after setup?

  • Check if the A record is correct
  • Ensure your web server is running
  • Clear your browser’s cache

Can I connect multiple domains to one VPS?
Yes! Each domain has its own Nginx/Apache config, but can be hosted on the same server.