Tomcat 的 8005 端口说明
1、启动 Tomcat,并查看端口
[root@Tang ~]# systemctl start tomcat.service
[root@Tang ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 100 :::8009 :::*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
2、查看 server.xml 中关于 8005 端口的配置
[root@Tang ~]# cat /etc/tomcat/server.xml | grep 8005
<Server port="8005" shutdown="SHUTDOWN">
3、登陆 8005 端口,输入 SHUTDOWN,停止 Tomcat 服务
[root@Tang ~]# telnet 127.0.0.1 8005
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
SHUTDOWN
Connection closed by foreign host.
[root@Tang ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
4、为了安全,建议修改 shutdown 的执行代码
[root@Tang ~]# vim /etc/tomcat/server.xml
[root@Tang ~]# cat /etc/tomcat/server.xml | grep 8005
<Server port="8005" shutdown="Nao1001Tabf">
[root@Tang ~]# systemctl start tomcat.service
[root@Tang ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 100 :::8009 :::*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
[root@Tang ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 100 :::8009 :::*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
[root@Tang ~]# telnet 127.0.0.1 8005
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Nao1001Tabf
Connection closed by foreign host.
[root@Tang ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
5、为了安全,同时使 other 用户对 server.xml 没有可读写操作权限
[root@Tang ~]# ll /etc/tomcat/server.xml
-rw-r--r--. 1 root tomcat 6616 Nov 4 13:44 /etc/tomcat/server.xml
[root@Tang ~]# chmod o-r /etc/tomcat/server.xml
[root@Tang ~]# ll /etc/tomcat/server.xml
-rw-r-----. 1 root tomcat 6616 Nov 4 13:44 /etc/tomcat/server.xml