在conf/server.xml 有以下内容
8005是Tomcat的管理端口,默认监听在127.0.0.1上。无需认验,就可发送SHUTDOWN这个字符串,tomcat接收到后就会关闭此Server。这个管理功能建议禁用,改shutdown为一串猜不出的字符串,比如以下示例
范例:修改8005/tcp端口管理命令
[root@centos8 ~]#ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 100 *:8080 *:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 1 [::ffff:127.0.0.1]:8005 *:* LISTEN 0 100 *:8009 *:* [root@centos8 ~]#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@centos8 ~]#ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* [root@centos8 tomcat]#vim conf/server.xml其它配置[root@centos8 tomcat]#systemctl start tomcat [root@centos8 tomcat]#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@centos8 tomcat]#ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 100 *:8080 *:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 1 [::ffff:127.0.0.1]:8005 *:* LISTEN 0 100 *:8009 *:* [root@centos8 tomcat]#telnet 127.0.0.1 8005 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. magedu Connection closed by foreign host. [root@centos8 tomcat]#ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* [root@centos8 tomcat]#
conf/server.xml中可以配置service,connector, Engine,Host等
service配置
一般情况下,一个Server实例配置一个Service,name属性相当于该Service的ID。
连接器配置
redirectPort,如果访问HTTPS协议,自动转向这个连接器。但大多数时候,Tomcat并不会开启HTTPS,因为Tomcat往往部署在内部,HTTPS性能较差
引擎配置
defaultHost 配置
defaultHost指向内部定义某虚拟主机。缺省虚拟主机可以改动,默认localhost。



