HostName setup for IPs windows and linux
Table of Contents
We can access any application through hostname instead IP address in local system. Generally local system application can be accessed though localhost or 127.0.0.1 because both default hostname and IP address.
So we can customize the hostname according to our convient. For this we need to edit the hosts file in windows and linux.
Host file location in windows
C:\Windows\System32\drivers\etc File name: hosts
Host file location in linux
/etc/ File name:hosts
Open the hosts file in Notepad++, and edit the as per following.
127.0.0.1 openam.example.com 127.0.0.1 agent1.sample.com 127.0.0.1 opendj.example.com 127.0.0.1 openidm.example.com 127.0.0.1 postgresql.example.com 127.0.0.1 www.example.com 127.0.0.1 mongodb.example.com 127.0.0.1 nginx.openam.com 127.0.0.1 lb.example.com 127.0.0.1 openam1.example.com 127.0.0.1 openam2.example.com 127.0.0.1 openam3.example.com
Edit the file and then save the file but here we need administratior previleges. Now we can access any application by using any of the host name instead IP address like as follows
So you will be feel like as accessing application as a through real website name. In this we are are talking about only IP but not PORT and Context Path. So whatever port / context path you are using for the application that will be same.
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development.
I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.