Learn the basics of obtaining a domain and linking it with your server or a virtual machine on the cloud.
In this tutorial, we will learn how to link a domain with our server or a VM instance located on the cloud. We will also learn how to get a free domain for a year using Freenom.
NOTE:- If you are familiar with Google App Engine or AWS Elastic Beanstalk, you must already know that they provide a domain name instead of an IP address. However, this domain name is not easy to remember (E.g. —https://developer-frontend-304619.ew.r.appspot.com/
. Clearly, you would not want this as a domain name). So, you can link a Domain Name with this complex Domain as well. If you do not understand this paragraph, do not worry. It is just a bit of extra information!!!
The Background
Nowadays, there are many platforms that allow us to host our website with the click of a button. Microsoft Azure, Google Cloud Platform, Amazon Web Services are some of these platforms. When we issue ourselves a virtual machine on these platforms, we generally get a public IP (e.g. 35.67.43.XX) using which we can access our website.
However, in today’s world, this looks ugly. Nobody wants to open a website that will only be accessed using an IP address. Also, it is difficult to memorize the IP address for any website. Imagine, every time you needed to do Google Search, you would have to look up its IP address in a notebook.
Here comes the use of Domain Names. Domain names (http://www.google.com
) are nice to look at and easy to remember. But, we have to first issue ourselves a domain name and link it with our IP. There are dedicated public servers (called Domain Name System Servers) on the internet whose sole job is to convert domain names to IP addresses.
Whenever we enter a domain name in the Address Bar of our browser, our browser contacts one of these Domain Name System Servers (DNS Servers) to get the IP address associated with it. Once the browser has the IP address, it then contacts the server for obtaining web pages.
Get a Host on the Cloud
Before we begin, we must have a virtual machine instance on the cloud. Make sure you have a Cloud VM instance with a website deployed on it. You must know its public IP address as well. Also, make sure you are able to access your website with this IP address.
Obtaining a Free Domain from Freenom
So, before we begin, we must issue a domain for ourselves. If you already have the domain, that’s good. You can skip this section. If you do not have it yet, we will show how you can obtain one for free from Freenom. The following steps illustrate:-
STEP 1: Search for the domain
- Go to Freenom’s website — https://www.freenom.com/
- Enter the domain you want. E.g. if you want a domain for your organization/company, just enter the name of the organization/company here and click on check availability. You will get a list of domains that are available for free for one year.
STEP 2: — Select the domain
- Once you have selected a domain of your choice, click on
Get It Now
and then onCheckout
. - Select the Period. The first 12 months are free.
- Do NOT click on continue. We still have to link this domain with our server. We will explain that process in the next section
Linking Domain with our server
So now, we have a domain added to our cart already. We issued it for free from Freenom. If you already had a domain, you may have bought it from some other website. But that does not matter much.
Although we will explain the process of linking domains with our server using Freenom’s website as an example, we can assure you the process is very similar for other domain issuing websites as well.
We will now give an overview of this process and then see how it is actually done using the domain added in our cart on Freenom. Remember, we mentioned DNS Servers whose sole purpose is to convert Domain Names to IP Addresses. So, linking a domain name with an IP Address (or server) means creating a record on one of these servers that contain your domain name and the IP address of your server/Cloud VM. There are many DNS servers worldwide and they constantly talk with each other. So, if you create a record on one of these servers, it will automatically be shared with other DNS Servers as well, although it will take some time to spread to all the DNS servers on the planet.
Now that we know the process and what needs to be done to link our domain with the IP address, let’s see how it is done.
STEP 1: Find the Option to Use DNS
- If you issued domain using Freenom as per the steps mentioned in the last section, you would see the following screen:-
- Find the option that says
Use DNS
. We are not concerned with domain forwarding in this tutorial. If you issued domain using any other Domain-Issuing Website, find a similar option likeConfigure Domain
,Use DNS
,Create a Record
etc. - Click on
Use DNS
. You will now see two options —Use Freenom’s DNS
orUse your own DNS
. As you must have guessed by now, Freenom also provides a DNS server. We can choose to create a record in Freenom’s DNS Server or in our own DNS Server. Since we do not have a DNS server of our own, we will use Freenom’s DNS Server.
NOTE:- Almost every Domain-Issuing Website has a DNS Server of its own. So if you issued your Domain using any other Domain-Issuing Website, try to look for the option Use Website's DNS
STEP 2: Enter HostName and IP Address of your server
- Now, it is time to create a DNS Record for our Domain and our server’s IP Address. As you may have guessed, you can customize the subdomain. (Subdomain refers to the first part of your domain — like www.example.com or
api.example.com
. Herewww
andapi
are the subdomains of the domainexample.com
. - You can assign the same IP address to all the sub-domains you want to have OR you can even assign them different IP addresses as well. Subdomains are basically used to provide separate access to certain web pages of your site without creating a new URL. For example, you might use
www.example.com
to directly use your website andapi.example.com
to use the API interface of your website. - Also, DNS records are of various types. On some websites, you will be asked the type of DNS record, you want to create. To create a record containing the IPv4 address of the server, we have to create
A records
. To create a record containing the IPv6 address of the server, we have to createAAAA records
.
NOTE:-
Remember the Google App Engine and AWS Beanstalk about which we talked at the starting. Instead of an IP address, they provide a very complex domain to you (E.g. — https://developer-frontend-304619.ew.r.appspot.com/ ), which is not easy to remember. To link that complex domain with your elegant and simple domain that you issued, you need to create a CNAME
type of DNS record. Instead of an IP address, you will provide that complex domain in a CNAME record.
- This is the most important step. Even if you are some other Domain-Issuing Website, you need to follow the same steps.
Note:- You can even change these DNS records later.
STEP 3: Continue and complete the process
- After entering the DNS records, click on continue. If you are using Freenom, you will be asked to create an account on Freenom. This will help you in managing this domain later sometimes like changing the DNS records or delete this domain etc. If you are using any other Domain-Issuing Website, remember to create an account on that as well.
- It will take some time for the DNS records to be shared with all the existing DNS server on Earth. It can take up to a maximum of 72 hours to get propagate worldwide. However, it typically takes less than an hour to get propagated.
- After you have entered the records, it would look like this on Google Domain's website
Congratulations !!!
You have now learned how to link your domain with your server. If you are creating an open-source web application, this tutorial will definitely help you in getting a free domain for it :)
Note:-
Generally, the issued domains do not have SSL certificates with them. That means, once you have linked the domain with your server, you should access it using http://www.example.com
and not using https://www.example.com
.
We will soon make a tutorial on how to get an SSL certificate for free for your domain. That way you can access your domain using https://
as well. Until then, GOODBYE!!!
Top comments (0)