How to view your website on browser before DNS propagation
If you bought new domain, hosting and you want to view your designed content immediately on web browser before DNS propagation ? If so, its possible by mapping your server IP to domain name into hosts file. If you have hosted your domain using web hosting control panel then no issues, you will have option to view without adding the entry into host file.
1) What is hosts file ?
The hosts file is a computer file used by an operating system to map hostnames to IP addresses.
2) DNS not yet propagated ?
A) How to do it in LINUX
Follow the below steps to done on LINUX.
a1) How to map your IP & domain in Linux
Open the /etc/hosts file with your favourite text editor and add the below colored lines then save & exit. You need to add your server IP and your domain name instead of ours.
$ sudo nano /etc/hosts 127.0.0.1 localhost 127.0.1.1 magesh-desktop # Site mapping before DNS propagation 18.104.22.168 balajeeplacment.com 22.214.171.124 www.balajeeplacment.com
a2) Flush DNS cache ?
After making changes in hosts file, you need to clear your DNS cache. Use the below command to do it. For other DNS cache flush.
$ sudo /etc/init.d/dns-clean start * Restoring resolver state... [ OK ]
a3) Site loading on browser
B) How to do it in WINDOWS
Follow the below steps to done on WINDOWS.
b1) How to map your IP & domain in WINDOWS ?
Navigate to below directory and open the hosts file on text editor and add below colored lines then save & exit. You need to add your server IP and your domain name instead of ours.
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # For example: # # 126.96.36.199 rhino.acme.com # source server # 188.8.131.52 x.acme.com # x client host 127.0.0.1 localhost ::1 localhost 184.108.40.206 balajeeplacment.com 220.127.116.11 www.balajeeplacment.com
b2) Flush DNS cache ?
After makking changes in hosts file, you need to clear your DNS cache. Use the below command to do it.
C:\Users\Administrator>ipconfig /flushdns Windows IP Configuration Successfully flushed the DNS Resolver Cache.
b3) Site loading on browser
Now, its loading on browser without any issues.
We are preparing all articles in-depth to understand by all level/stage Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section.
Please stay tune with us…Good Luck.