DNS stands for Domain Name System and it is a collection of all the domain/website names on the internet such as google.com, facebook.com 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 google.com, without the need to remember the IP addresses.
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:
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.
This is used for creating an alias and maps one hostname to another hostname.
So when someone enters
www.example.com 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:
CNAMErecord for your website