Table of Contents

Tomcat Config

Config port 80

When we need change the port, most of the time, it just need edit server.xml <pre> <Connector port=“8080” protocol=“HTTP/1.1” connectioTimeout=“20000” URIEncoding=“UTF-8”

             redirectPort="8443" />

</pre>

But when I want to change it to 80, the tomcat can't start successfully. The tomcat doesn't support the port lower than 1024, so it need do some special work

vim /etc/default/tomcat6 
AUTHBIND=yes

But this also not work on my vps, maybe the memory is not enough.

So the last solution is redirect to request on port 80 to 8080

sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Horray, then it works.

refer to:http://stackoverflow.com/questions/4756039/how-to-change-the-port-of-tomcat-from-8080-to-80

Config directory

/var/lib/tomcat7/

/etc/tomcat7/

user config

  <role rolename="tomcat"/>
     <role rolename="role1"/>
     <role rolename="manager"/>
     <role rolename="admin"/>
     <role rolename="admin-gui"/>
     <role rolename="admin-script"/>
     <role rolename="manager-gui"/>
     <role rolename="manager-script"/>
     <role rolename="manager-jmx"/>
     <role rolename="manager-status"/>
     <user username="admin" password="passwodxxx" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
     <user username="userxxx" password="passwordxxx" roles="tomcat,admin,manager-gui,manager"/>