Linux环境Tomcat访问manager报403

解决办法:

  1. 修改权限
    1. 进入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>

 

  1. 注释掉其中的Valve标签及内容

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

 

  1. 添加用户
    1. 进入到conf/tomcat-users.xml
    2. 在<tomcat-users>标签中添加角色和用户

<role rolename=”tomcat”/>

<role rolename=”manager-gui”/>

<role rolename=”admin-gui”/>

<user username=”andy” password=”123456″ roles=”manager-gui,admin-gui,tomcat”/>

  1. 重启Tomcat
    1. 进入bin目录执行./shutdown.sh 关闭Tomcat
    2. 执行./startup.sh启动Tomcat
0 Comments
Leave a Reply