tomcat增加了admin管理,配制了管理用户,http://localhost:8080/admin后出现管理页面,输入用户和口令后,结果页面就变成了
HTTP
Status 403 - Access to the requested resource has been denied
$TOMCAT_HOME/webapps/manager/WEB-INF/web.xml
1。在<web-app>和</web-app>之间加入
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire
Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<!--
NOTE: This role is not present in the default users file -->
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration
for this Application -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>TEST
ACCESS CONTROL</realm-name>
</login-config>
//如果存在就不用加了,注意下面的东东
2。然后在$TOMCAT_HOME/conf/tomcat-users.xml中加入
<tomcat-users>
<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>
</tomcat-users>
roles的名字和web.xml中的相对应
本文介绍了解决Tomcat管理页面403错误的方法。通过在web.xml中增加安全约束,并在tomcat-users.xml文件中定义管理员角色及用户,实现对管理页面的正常访问。
924

被折叠的 条评论
为什么被折叠?



