Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain name for tomcat

Tags:

tomcat

dns

I want to set a DNS name for Tomcat 6.0. I tried it by editing the server.xml file in Tomcat 6.0.My requirement is a valid domain name, instead of localhost. Usually, http://localhost:8080 is used for accessing the tomcat manager page. I tried to change it but I can't. Please help me to set a domain name.

like image 737
Vinoth Vijayabaskar Avatar asked Nov 23 '12 10:11

Vinoth Vijayabaskar


2 Answers

If the host of tomcat don't have public domain name, you should edit the host file. If your OS is unix-family (i.e, Linux, MacOSX, etc) you can see the host file in /etc/hosts. You can add the following line:

127.0.0.1 your.host.name

If your OS is windows, you can find your hosts file in

C:\Windows\System32\drivers\etc\hosts

After edit the hosts file, restart tomcat. Then you can access your tomcat by entering http://your.host.name:8080 in the browser's address field.

like image 72
ntalbs Avatar answered Oct 20 '22 11:10

ntalbs


step1>open notepad as administrator
step2>in notepad open C:\Windows\System32\drivers\etc and select hosts file.
step3>replace # 127.0.0.1 localhost to 127.0.0.1 www.yourdomain.com and save the file.
note: not click on save as. don't forget to remove #
step4>add your application to webapp folder
step5>open tomcat and search server.xml and open it. and then change http port no to 80
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

step6>under <Engine> tag add the following
<Host name="www.yourdomain.com"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">
        <Context path="" docBase="your project name"/>
        </Host>
adn save the file.
note: Make Sure that you have welcome file config.. in web.xml

step7>now restart tomcat server
step8>open browser and type www.yourdomain.com
...........................................................
like image 40
sudeep biswas Avatar answered Oct 20 '22 11:10

sudeep biswas