How to point a Domain to your VM

June 23, 2021

This is a guide on how to point a domain to your VM to serve content with your VM as the host.

You require a DNS server to be set up for you. Usually, most domain provider has that already set up, and you can start pointing. But for this guide, we will be using Cloudflare. Cloudflare offers free DNS service and Wildcard SSL, which is unbelievable.

Signup / Login to your Cloudflare account

Head to Cloudflare to login to your account or signup here: https://dash.cloudflare.com/sign-up if you haven't already.

Click add site on the top right of your Cloudflare account

Add your domain and click add site

Choose the free plan

Set your DNS records

Cloudflare will check your existing DNS record and will request you to check and update your DNS record

You have to add A record to tell Cloudflare to point the domain name to your VM IP

Type : A
Name : Your domain name or @
IPv4 address : Your_VM_IP

Remember to enable the proxy setting, which helps you hide your VM IP to prevent exposing your VM IP, leading to potential DDoS.
Also don't forget to clear any existing duplicate A record and CNAME you have to prevent any potential issues.

Example config:

Remember to also add a Cname record to make sure www.yourdomainname.com will resolve

Type : Cname
Name : www
Target : Your domain name or @


Click save and Continue

Set your Nameserver records

Now you have to change your domain's nameserver record to Cloudflare's nameserver.

Note: Nameserver record differs depending on the provider, contact your domain provider if you have any questions, here are some guides on some popular domain providers.

GoDaddy
NameCheap
Google Domains
Domain.com
eNom

When you are done, click Done, check the nameservers, and you are done pointing your domain to your VM.

Now try visiting your domain on your browser, and the domain will resolve!

Note: It might take a while for the DNS and nameserver to propagate, usually it is instant, but it might take up to 24 hours to propagate, contact your domain provider if it hasn't propagated after 24 hours.

Bonus:

SSL

Configuring SSL usually takes a lot of work and quite complicated.
With cloudflare, simply go to SSL/TLS tab and click on Flexible

With this your website will have a padlock beside the URL and it will be secured, to check, head to https://yourdomainname

Don't forget to enable Automatic HTTPS Rewrites after that so all HTTP traffic will be forwarded to HTTPS traffic.
You can do that by going to Cloudflare > SSL/TLS > Edge Certificates > Automatic HTTPS Rewrites > On

Haven't deployed a VM with Evoxt yet? Deploy a VM now!
Deploy