Friday, 18 August 2017

Access web application with domain name instead of localhost/ipaddress

Whenever you deploy an application on tomcat server, your url starts with http://localhost:8080/{your application name}.

In this post, I am going to show you, how to replace localhost with some domain name. For example, I am going to replace localhost with myExample.com.

By modifying local dns settings, we can point the localhost (or) 127.0.0.1 to some domain name.

We need to modify the hosts file.

Operating system
Host file location
UNIX
/etc/hosts
Windows
C:\Windows\System32\drivers\etc\hosts

I am going to show the demo in windows operating system, procedure is same for UNIX.


Let’s say, I deployed ‘HelloWorld’ application.
As you see above image, my application is running on localhost.

Now open hosts file and add below statement to it.

127.0.0.1 myExample.com

Hit below url, you can able to access HelloWorld application using domain name.
You may like



No comments:

Post a Comment