Modify the default port of Tomcat 6 (UbuntuServer, CentOS)

Source: Internet
Author: User
UbuntuServer12.04 install tomcat 6 and mysql $ sudoapt-getinstallsysv-rc-conftomcat6mysql-server $ sudoufwallow80/tcp $ sudosysv-rc-conftomcat6on modify tomcat port, we seem to know that here we change 8080 to 80: $ sudovi/etc/tomca

Install Tomcat 6 and mysql on Ubuntu Server 12.04

$ 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 know that we should change 8080 to 80:
$ Sudo vi/etc/tomcat6/server. xml
ConnectionTimeout = "20000"
URIEncoding = "UTF-8"
RedirectPort = "8443" type = "regxph" text = "yourobjectname"/>

Many articles on the Internet are finished here, but after the change, tomcat does not work at all. The TCP listening port does not contain 80, and it is easy to use when it is restored to 8080. Originally, from Ubuntu 10.04, the port below 1024 is disabled by default, and the following files need to be modified:

$ Sudo vi/etc/default/tomcat6
# If you run Tomcat on port numbers that are all higher than 1023, then you
# Do not need authbind. It is used for binding Tomcat to lower port numbers.
# NOTE: authbind works only with IPv4. Do not enable 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 50 127.0.0.1: 3306 *:*
LISTEN 0 100 *: 80 *:*
LISTEN 0 128: 22 :::*
LISTEN 0 128 *: 22 *:*
LISTEN 0 1 fig: 8005 *:*
$
Now.

Reference http://www.linuxidc.com/Linux/2012-07/66265.htm

For CentOS6, the system does not allow tomcat users to use ports lower than 1024. Therefore, in addition to modifying/etc/tomcat6/server. xml, this file is also available:

# Vi/etc/tomcat6/tomcat6.conf
# What user shoshould run tomcat
TOMCAT_USER = "tomcat"

# Connector port is 8080 for this tomcat6 instance
CONNECTOR_PORT = "8080"

Change the preceding two rows
TOMCAT_USER = "root"
CONNECTOR_PORT = "80"
You can. But it is still unclear about the security. I think the ideal solution is the integration of Tomcat and Apache HTTPD. If you are interested, search for it.

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.