Sunday, December 15, 2013

changing tomcat port from 8080 to 80

Advertisements

Tomcat by default runs on port 8080. How to make it  run on port 80? so that you don't have to specify :8080 along with the url. In this post we will see how to change the tomcat port from 8080 to 80 on Ubuntu Linux.

Open the tomcat mail configuration file server.xml. The path to this file may vary depending on your installation path and method.

#sudo vim /var/lib/tomcat7/conf/server.xml

Change the following line 


<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />

to (port 8080 to 80)

<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />

And restart tomcat
#sudo /etc/init.d/tomcat7 restart

In Centos and fedora this is enough. But in Ubuntu and other debian distributions need one more configuration change.

To run on privileged ports(below 1024) you need to modify the following file.
#sudo vim /etc/default/tomcat7

uncomment the #AUTHBIND=no line and set its value to 'yes',

You may need to restart tomcat again.
Open a browser and type localhost, hit enter. You are done.

No comments:

Post a Comment

Be nice. That's all.