Effective modification of TOMCAT6 default port (Ubuntu server,centos)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.