我已经下载了tomcat7 ZIP文件。解压缩文件夹后,我转到 Tomcat7.0 / conf / 目录,并将 tomcat-users.xml 编辑为:
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="admin" password="admin" roles="manager,tomcat,role1"/>
</tomcat-users>
然后,我启动了我的tomcat,在tomcat网页上,我点击了“ Manager App ”按钮,弹出一个登录对话框。我输入了用户名“ admin ”和密码“ admin ”,但我收到了 401未经授权的错误。为什么?我的 tomcat-users.xml 配置有什么问题?
答案 0 :(得分:3)
根据http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access
,所需角色名为manager-gui
答案 1 :(得分:1)
来自http://localhost:8080/manager/html
<role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/>
请注意,对于Tomcat 6.0.30以上,使用该角色所需的角色 经理应用程序已从单个经理角色更改为 以下四个角色。
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
答案 2 :(得分:0)
您应该将角色名称作为manager-gui ...它将授予访问管理应用页面的权限...
答案 3 :(得分:0)
如果使用Eclipse WTP来管理Tomcat,请小心,因为Eclipse实际上是在Workspace的Server项目中复制配置文件。
答案 4 :(得分:0)
这是因为从Tomcat 7.0开始,您需要将以下四个角色添加到tomcat-users.xml
注意:我使用的是Tomcat 8.5.9
\ CONF \ Tomcat的users.xml中
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user roles="admin-gui,manager-gui,manager-script,manager-jmx,manager-status" username="tomcat" password="******"/>