tomcat的监听端口
2013-04-23tomcat启动4个端口,你都知道他们的作用吗?
1、tomcat会启动4个端口
netstat -ntlp | grep java
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 1512/java
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 1512/java
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1512/java
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1512/java
2、8005端口
Shell> telnet localhost 8005
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
SHUTDOWN
Connection closed by foreign host.
Shell> ps -ef|grep java
tomcat被关闭了。
因为默认监听的是127.0.0.1,只能本地访问,所以不用担心远程攻击,不过还是建议修改SHUTDOWN为其他词汇。比如:
改成-1关闭8005端口:
3、8009端口
第二个连接器监听8009端口,负责和其他的HTTP服务器建立连接。在把Tomcat与其他HTTP服务器集成时,就需要用到这个连接器。
比如apache连接tomcat:
a)httpd.conf
Include conf/mod_jk.conf
b)mod_jk.conf
JkWorkersFile conf/workers.properties
c)workers.properties
# Define the first node...
worker.server99.port=8009
worker.server99.host=192.168.1.254
worker.server99.type=ajp13
worker.server99.lbfactor=1
#worker.server99.local_worker=1
worker.server99.cachesize=1
worker.server99.cache_timeout=600
worker.server99.socket_keepalive=1
worker.server99.socket_timeout=0
#worker.server99.reclycle_timeout=300
#worker.server99.retries=3
改成-1关闭端口
4、HTTP8080端口,可以改成默认80端口
参考:
http://wenku.baidu.com/view/da601cc6aa00b52acfc7cab4.html