Sebastian Urban

How To Point Your Domain Name To Your VPS

Published 03 May 2020 5 min read
image
Image by: EstudioWebDoce

In this post I will show you how to point your domain name to a VPS. In the example below, I have my domain name from Google Domains and a Windows VPS but this tutorial works with any VPS and any domain registrar.

I value your time so if you don't want to read the entire post and just want to get into the nitty-gritty I have included a TL;DR section for you at the bottom of the post.

You should already have a domain name and a VPS but if you don't, just start from Step 1 otherwise skip to Step 3.

It will take the following steps to point your domain name to your VPS:

  1. Get a domain name
  2. Get a VPS
  3. Update A Record in your domain DNS settings
  4. Update CNAME record in your domain DNS settings
  5. Create SSL Certificate
  6. Wait for few minutes or 48h

Step 1. Get a Domain name

There are number of options out there like GoDaddy, Namecheap, eUKHost or Google Domains. I honestly don't think there is much of a difference between any of them, so I would go with whatever is the easiest and cheapest.

Step 2. Get a VPS

In my case, I have a Windows VPS (Windows Server 2016) from eUKHost. I chose a windows VPS because I need support for ASP.NET and since eUKHost allows you to pay monthly and their online support is really good (because I have used their shared servers before) they seemed like a good fit. Your needs may differ so feel free to get whatever works for you. Fear not, this tutorial will work with any VPS.

Step 3: Update A record in your domain DNS settings

The A in the A record stands for Address. The A record is used to assign a more rememberable name to an IP address other than series of numbers seperated by dots. So, instead of having to type 127.0.0.1 for example, we can type localhost in address bar and achieve the same result.

If you work with windows and IIS, you can see this for yourself by viewing the hosts file located in C:\Windows\System32\drivers\etc. You will see that the 127.0.0.1 is mapped to localhost. This means we can access 127.0.0.1 from your web browser with the name localhost instead of the IP address. The reason being is because this file is the first place the machine checks before checking the DNS.

Tip You can think of the A record like the entry in the local hosts file where you assign a domain name to an IP address you would like to use to access specified IP address.

If your domain is with Google Domains, you can amend your custom resource records by going to the following:

  1. Google Domains Account
  2. My Domains
  3. Click the domain you want to update
  4. In the left hand side menu click DNS
  5. Scroll down untill you see area for custom resource records

A Record Details:

# Name Type TTL Data
1 @ A 1H your.vps.ip.address

Step 4: Update CNAME record in your domain DNS settings

CNAME stands for Canonical Name. This record is usually used as an alias for another name. In our case, we will use this record to ensure that we can also access our website via www.your-domain-name.com.

Note When creating a CNAME record, make sure you always point it to another domain name and not directly to an IP address.

CNAME Record Details:

# Name Type TTL Data
1 www CNAME 1H your-domain-name.com

Step 5. Create SSL Certificate

If your domain does not require SSL certificate or for whatever reason you do not want one you can omit this step.

This step is not necessary but I highely recommend doing it. You do not need SSL certficate but many browsers nowadays will either warn a user that the website is not secure or simply refuse to show it completely.

Note If your top-level domain name is encrypted by default, you will not be able to access it without an SSL regardless of the web browser used so you must create a valid certificate.

If you have windows VPS like myself, you can make use of ACME client like win-acme to create free SSL certificates. Their documentation is very clear and easy to follow. Another highely recommended tool by Let's Encrypt is Certbot which is another ACME client but used for unix based operating systems.

Step 6. Wait a few minutes or 48h.

At this stage your job is done. DNS propagation will take place and it may take 24-48h so you won't be able to access your website via the domain name straight away.
In my experience, I was able to access it within 10 minutes or so but mileage will vary.

TL;DR:

Step 1: Get Domain Name & VPS

Step 2: Update A & CNAME record in domain DNS settings

A Record Details:

# Name Type TTL Data
1 @ A 1H your.vps.ip.address

CNAME Record Details:

# Name Type TTL Data
1 www CNAME 1H your-domain-name.com

Step 3. Create SSL Certificate

If your domain does not require SSL certificate or for whatever reason you do not want one you can omit this step.

Step 4. Wait a few minutes or 48h

DNS propagation may take 24-48h so you may not be able to access your website straight away.

Summary

That is it. I hope this was helpful and easy to follow. If you have any questions or would like to add anything let me know on twitter @seburbandev or send me a message.

Disclaimer: Some of the links included in the post are affiliate links. I will receive commision if a purchase is made through the link. I never include links to products I would not use myself.