Effective modification of TOMCAT6 default port (Ubuntu server,centos)
Ubuntu Server 12.04 installs Tomcat6 and MySQL
$ sudo apt-get install sysv-rc-conf tomcat6 mysql-server
$ sudo ufw allow 80/tcp
$ sudo sysv-rc-conf tomcat6 on
To modify the Tomcat port, we all seem to know here to change 8080 to 80:
$ sudo vi/etc/tomcat6/server.xml
<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
Uriencoding= "UTF-8"
redirectport= "8443"/>
Many articles on the Internet write here on the finished, but in fact, after the completion of Tomcat does not work, TCP Listening port does not have 80, and restore to 8080 is easy to use. Originally, from Ubuntu 10.04, the default is to close 1024 of the following ports, you also need to modify the following files:
$ sudo vi/etc/default/tomcat6
# If you run Tomcat in port numbers that is all higher than 1023 and then you
# do not need authbind. It is the used for binding Tomcat to lower port numbers.
# Note:authbind works with IPV4. Does not enable the it when using IPV6.
# (yes/no, Default:no)
Authbind=no
Change to: Authbind=yes
$ sudo service tomcat6 restart
$ ss-ln
State recv-q send-q Local address:port Peer address:port
LISTEN 0 127.0.0.1:3306 *:*
LISTEN 0 *:80 *:*
LISTEN 0::: $:::*
LISTEN 0 *:22 *:*
LISTEN 0 1 127.0.0.1:8005 *:*
$
It's good now.
In the case of CentOS6, the system does not allow Tomcat users to use ports below 1024. So in addition to modifying/etc/tomcat6/server.xml, there is this file:
# vi/etc/tomcat6/tomcat6.conf
# What user should run Tomcat
Tomcat_user= "Tomcat"
# Connector Port is 8080 for this TOMCAT6 instance
connector_port= "8080"
Change the above two lines to
Tomcat_user= "Root"
connector_port= "80"
You can do it. But the security of how to do it is unclear, I think the more ideal is the integration of Tomcat and Apache httpd, interested in searching it.
This article is from the "Chen blog" blog, make sure to keep this source http://chenshengang.blog.51cto.com/4399161/1629914
Effective modification of TOMCAT6 default port (Ubuntu server,centos)