Tomcat8配置tomcat-users.xml配置

默認tomcat-user.xml中的角色和用戶配置示例以下:html

<!--web

  <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"/>apache

-->tomcat

若是僅把上述內容去掉並修改密碼,重啓tomcat後訪問http://localhost:8081/manager/html,會報403 Access Denied沒法登陸管理界面。app

正確的配置以下:webapp

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="111111" roles="manager-gui,manager-script,manager-jmx,manager-status"/>ui

 

可是tomcat8.5 更改以後,仍然訪問拒絕。xml

還需步驟以下: 
vi /usr/local/tomcat/apache-tomcat-8.5.9/webapps/manager/META-INF/context.xmlhtm

 

緣由是tomcat8中定義瞭如下4種角色,因此配置文件中的角色名稱是不能任意填寫的。blog

    • manager-gui - allows access to the HTML GUI and the status pages
    • manager-script - allows access to the text interface and the status pages
    • manager-jmx - allows access to the JMX proxy and the status pages
    • manager-status - allows access to the status pages only
相關文章
相關標籤/搜索