How to setup DNS for a website

What is DNS?

DNS stands for Domain Name System and it is a collection of all the domain/website names on the internet such as, etc.

The servers are targeted through their IP addresses but we humans cannot remember IP addresses for so many websites and therefore DNS translates the domain names into IP addresses so that we can access the websites with the help of a domain name such as, without the need to remember the IP addresses.

DNS records needed for a website

To setup DNS for your website you first need to login to your server provider's website eg. Digital Ocean. Then search for the DNS option.

To setup DNS for your website you need to create the following DNS records on your server:

A record

This allows you to enter the hostname and the corresponding IP address so that the hostname will direct the user to the correct IP address of the server.


CNAME record

This is used for creating an alias and maps one hostname to another hostname.


So when someone enters he will be redirected to

DNS records may take some time to come into effect so depending on your DNS service provider it can take some amount of time.

From this post we learned:

  • What is DNS?
  • How to Setup A record and CNAME record for your website