HostName setup for IPs windows and linux

HostName setup for IPs windows and linux

 

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

 

windows hosts

windows hosts

 

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

http://openam.example.com:8080/openam

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.

 

 

 

 

Leave a Reply