当前位置: 代码迷 >> 综合 >> Tomcat8.5配置manager账号密码
  详细解决方案

Tomcat8.5配置manager账号密码

热度:15   发布时间:2023-11-08 11:57:23.0

文章目录

  • Tomcat8.5配置manager账号密码

Tomcat8.5配置manager账号密码

  1. 安装好tomcat之后,打开tomcat安装目录下的conf目录。在conf目录下编辑tomcat-user.xml文件
a. 在tomcat-user.xml文件的最下方找到角色和用户的配置。
<!--<role rolename="tomcat"/><role rolename="role1"/><user username="tomcat" password="<must-be-changed>" roles="tomcat"/><user username="both" password="<must-be-changed>" roles="tomcat,role1"/><user username="role1" password="<must-be-changed>" roles="role1"/>
-->
b. 将以上代码注释打开,更改为 <role rolename ="manager-gui"/><role rolename ="manager-script"/><user username="you user name" password="you password" roles ="manager-gui,manager-script"/>
c.各个角色说明
manager-gui — Access to the HTML interface.
manager-status — Access to the "Server Status" page only.
manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
manager-jmx — Access to JMX proxy interface and to the "Server Status" page.
  1. 如果需要在远程登录manager,需要进入tomcat安装目录/webapps/manager/META-INF/目录下,编辑context.xml文件
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /><Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>将以上文件的value标签内容注释掉,或者更改您允许的访问地址的正则表达式
  1. 官网参考地址:https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html
  相关解决方案