gpt4 book ai didi

linux - Tomcat 中的 403 访问被拒绝

转载 作者:IT王子 更新时间:2023-10-29 00:16:17 28 4
gpt4 key购买 nike

我在 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),但是当我输入它们时,我得到:

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

这种行为的原因可能是什么?提前致谢。

最佳答案

要使用 Web 管理图形用户界面,您必须添加 gui role .

[Tomcat 安装路径]/conf/tomcat-users.xml 中,您可以定义角色 并将它们影响到用户。例如:

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

注意:

您可能没有在此处定义任何默认用户名和密码,因此最好花点时间进行此配置,否则在使用集成在 IDE(如 NetBeans)中的 Tomcat 时会遇到问题.事实上,它需要这些凭据才能正确使用它。

关于linux - Tomcat 中的 403 访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11080148/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com