How to Point Your Domain to a VPS Using Cloudflare (Step by Step)

Learn how to point your domain to a VPS using Cloudflare. Step by step, I’ll show you how to set DNS A and CNAME records, update nameservers, and check propagation with a free Cloudflare account.

pointing domain to vps using cloudflare
When I was still on shared hosting, I never had to worry about connecting domains. The registrar and the hosting were bundled — once I bought hosting, the domain was automatically connected.

But when I moved to a VPS (Hetzner in my case — they even give $20 free credit here), things worked differently. On an unmanaged VPS, you get a blank server with just an IP address. If you want your domain (for example, from Namecheap) to connect to this server, you have to point it manually.

The easiest way I’ve found? Using Cloudflare. Not only is it free, but it also makes it much easier later if you want to add, edit, or delete records.

What You Need Before Starting

  1. A domain name – I bought mine on Namecheap.
  2. A Cloudflare account – totally free to create.
  3. Your VPS IP address – I used Hetzner Cloud (again, with free $20 credit).

Step 1: Add Your Domain to Cloudflare

  1. Go to Cloudflare and log in (or sign up).
  2. Click Add a Site and type your domain (e.g., example-domain.com).
  3. Choose the Free plan.
  4. Cloudflare will scan your current DNS records (from your registrar). You can skip or clean them up later.

Step 2: Update Nameservers on Your Registrar (Namecheap Example)

Cloudflare will give you two nameservers, like:

  • xxxx.ns.cloudflare.com
  • yyyy.ns.cloudflare.com

Go to Namecheap Dashboard → Domain List → Manage → Nameservers, and replace the default with Cloudflare’s nameservers.

Save changes. Now your domain is managed by Cloudflare.

Step 3: Create DNS Records in Cloudflare

Inside your Cloudflare dashboard → DNS → Add Records.

The minimum records you need for a website are:

  1. A Record
    • Name: @
    • IPv4 address: your-VPS-IP
    • Proxy status: Proxied (orange cloud) or DNS only (grey cloud).
    • TTL: Auto
  2. CNAME Record
    • Name: www
    • Target: example-domain.com
    • Proxy status: Proxied
    • TTL: Auto

This setup means:

  • example-domain.com points to your VPS IP.
  • www.example-domain.com redirects to the same domain.

Optional: Add AAAA record if you want IPv6 support (Hetzner usually provides IPv6).

Step 4: Check Propagation

DNS changes take time to spread worldwide. Usually it’s a few minutes with Cloudflare, but it can take up to 24 hours.

To check:

  • Use whatsmydns.net → enter your domain → choose A record → check global propagation.
  • Or run from your terminal:
  • ping example-domain.com

If the response shows your VPS IP, it’s connected.

Why Cloudflare Makes Life Easier

  • Super simple UI for managing DNS records.
  • Free CDN and caching if you enable proxy.
  • Built-in SSL (can combine with Let’s Encrypt later).
  • Flexible for adding subdomains, staging sites, etc.

Conclusion

Before you install WordPress or any web stack on your VPS (whether with CyberPanel or Webinoly), it’s crucial to connect your domain first. With Cloudflare, the process is not only straightforward but also future-proof — you can manage all DNS settings in one place without touching your registrar again.

So now that the domain is pointing to your VPS, the next step is installing your site — WordPress, PHP, or HTML — directly on your server panel.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top