DNS/Setup/

How to Map a domain name with a Linux server using public IP?

Published on

How to Map a domain name with a Linux server using public IP?
If you want to access your website with a domain name rather than an IP address which is difficult to remember. We need to purchase a domain name from a provider (eg: GoDaddy) and link the domain with the public IP address on which you currently host your website files using DNS Settings.

Introduction:

If you have not changed any DNS settings after purchasing your domain. Then by default, your domain name will be in a parked state. That means when you visit your domain name it will redirect to some sample page without showing a blank page.

To change the state of your domain name from Parked state to Live state. You have to delete an A record ( with fields mentioned as Parked on it ) from the DNS settings. To read more about DNS records click here.

Flow Diagram:



flow diagram

Prerequisites:

  • Purchased domain name

  • Linux server with public IP address

Steps:

Step 1: Retrieve the public IP address of the Linux server.

Navigate to the dashboard of your Linux server and get the public IP address of the server.

Step 2: Navigate to the DNS settings of the respective domain name.

  • Login to the domain provider account

  • Navigate to the DNS settings of the respective domain name.

Note:* In this article, Godaddy is used as a domain name provider.

 

godaddy

Step 3: If your newly purchased domain is parked by default, delete the A record.

 

  • Delete the A record ( with fields mentioned as Parked on it ) from the DNS settings.

  • For your reference an example screenshot is given below, In this example the domain name provider is Godaddy.


godaddy

Note:* In this article, Godaddy is used as a domain name provider.

  • To link your domain name with the Linux server IP. Create an A record, as shown in the below screenshot.

Type: A

Name: @

Value: 0.0.0.0 ( Enter your Linux server IP address, eg: 53.253.23.125 )

TTL: Default


godaddy


Result:

Note:* To Check whether the domain name is linked to the Linux server IP, please follow the below steps.

  • install Nginx on Ubuntu

1sudo apt update 2sudo apt install nginx -y

 

  • Check Nginx status by executing the below command, If the status is running you’re ready to go.

1systemctl status nginx

An example output screenshot is given below.


screenshot


  • Check your domain name is linked to the Linux server, by visiting the domain name from a web browser.

  • An example output screenshot is given below.


website

Comments