栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java > Tomcat

tomcat-常见配置详解

Tomcat 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

tomcat-常见配置详解

常见配置详解 端口8005/tcp 配置管理

在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。


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/10415.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号