Tomcat中的403访问被拒绝 [英] 403 Access Denied in Tomcat
问题描述
我在tomcat-users.xml
中具有以下内容:
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="aname" password="apassword" roles="admin,manager"/>
</tomcat-users>
如果我转到http://localhost:8080/manager/html
,系统会询问我用户名和密码(据我了解,关于tomcat-users.xml
的用户名和密码),但是当我输入它们时,我会得到:
If I go to http://localhost:8080/manager/html
, I'm asked about username and password (as far as I understand, about these from the tomcat-users.xml
), but when I enter them, I get:
403 Access Denied
You are not authorized to view this page.
If you have already configured the Manager application to allow access and you have used your browsers back button...
这种行为可能是什么原因?预先感谢.
What could be a reason of such a behavior? Thanks in advance.
推荐答案
To use the web administration gui you have to add the gui role
.
在[Tomcat installation path]/conf/tomcat-users.xml
中,您可以定义role
并将其影响到user
.例如:
In [Tomcat installation path]/conf/tomcat-users.xml
you can define role
and affect them to user
. For example :
<tomcat-users>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<user username="name" password="pwd" roles="admin,admin-gui,manager,manager-gui"/>
</tomcat-users>
注意:
Note :
您可能没有在此处定义任何默认用户名和密码,因此花一些时间进行此配置始终是一件好事,否则在使用集成在IDE中的Tomcat(例如NetBeans)时会遇到问题.确实,为了正确使用它,将需要这些凭据.
You may not have any default username and password defined here so it's always good to take the time to do this configuration or you'll encounter issue when using Tomcat integrated in IDE like NetBeans. Indeed it will require these credentials in order to use it properly.
这篇关于Tomcat中的403访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!