2012-10-22 14:10:26| 分类: apache_tomcat |字号 订阅
配置好 Tomcat 7.0 后,在 tomcat-users.xml 中配置用户角色来访问 localhost:8080 的这样三个按钮总出现问题:
Server Status
Manager App
Host Manager
要么是三个都不能访问,要么是只能访问其中一个,或者两个。
后来发现是角色没有添加全,特别是针对第三个按钮“Host Manager”
其实解决点在这样两个症结上:
前两个按钮和manager相关,具体角色名为
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
第三个按钮和admin相关,具体角色名为
admin-gui - allows access to the HTML GUI and the status pages
admin-script - allows access to the text interface and the status pages
所以在 tomcat-users.xml 如果不注重安全性,只是测试用的话,对应部分可以简单地写成下面这个样子:
---------------------------------
<role rolename="admin"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
---------------------------------
很多网页没说到第三个按钮针对的角色。不添加admin-gui和admin-script的话,第三个按钮就会出现访问被拒绝的问题(access denied ....)。
详细说明可以参考 Tomcat 的文档(http://tomcat.apache.org/migration.html#Manager_application):
Manager application
The Manager application has been re-structured for Tomcat 7 onwards and some URLs have changed. All URLs used to access the Manager application should now start with one of the following options:
<ContextPath>/html for the HTML GUI
<ContextPath>/text for the text interface
<ContextPath>/jmxproxy for the JMX proxy
<ContextPath>/status for the status pages
Note that the URL for the text interface has changed from "<ContextPath>" to "<ContextPath>/text".
The roles required to use the Manager application were changed from the singlemanager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.
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
The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection:
users with the manager-gui role should not be granted either the manager-script ormanager-jmx roles.
if the text or jmx interfaces are accessed through a browser (e.g. for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session.
The roles command has been removed from the Manager application since it did not work with the default configuration and most Realms do not support providing a list of roles.
Host Manager application
The Host Manager application has been re-structured for Tomcat 7 onwards and some URLs have changed. All URLs used to access the Host Manager application should now start with one of the following options:
<ContextPath>/html for the HTML GUI
<ContextPath>/text for the text interface
Note that the URL for the text interface has changed from "<ContextPath>" to "<ContextPath>/text".
The roles required to use the Host Manager application were changed from the singleadmin role to the following two roles. You will need to assign the role(s) required for the functionality you wish to access.
admin-gui - allows access to the HTML GUI and the status pages
admin-script - allows access to the text interface and the status pages
The HTML interface is protected against CSRF but the text interface is not. To maintain the CSRF protection:
users with the admin-gui role should not be granted the admin-script role.
if the text interface is accessed through a browser (e.g. for testing since this inteface is intended for tools not humans) then the browser must be closed afterwards to terminate the session.
分享到:
相关推荐
在使用Tomcat 9 进行Web应用部署时,可能会遇到一种较为常见的问题:即配置完成后,虽然能够正常访问Web应用,但在尝试访问后台管理界面(如Server Status、Manager App、Host Manager)时却收到“403 Access Denied...
本篇文章将深入探讨Tomcat 7和8之间的差异以及它们各自的特点。 **Tomcat 7** Tomcat 7是Apache Tomcat的一个重要版本,发布于2012年,主要支持Java EE 6规范。以下是Tomcat 7的一些关键特性: 1. **Java EE 6支持...
在"tomcat-redis-session-manager-tomcat-7"项目中,Redis被用作Tomcat的会话存储,这样每个服务器都可以访问和更新会话数据,而不局限于特定的服务器实例。 集成过程主要包括以下几个步骤: 1. **安装和配置Redis...
- **管理界面**:通过访问`http://localhost:8080/manager/html`和`http://localhost:8080/host-manager`,可以使用Tomcat Manager和Host Manager进行应用管理。 **4. 进阶配置** - **日志配置**:通过修改conf/...
2. 集成Tomcat集群:修改Tomcat的server.xml文件,配置Engine、Host和Cluster元素,使用适当的集群策略如DeltaManager或ReplicatedManager。 3. 安装Redis Session Manager:将"tomcat-cluster-redis-session-...
tomcat-redis-session-manager-2.0.0.jar jedis-2.5.2.jar commons-pool2-2.2.jar 2.修改 conf 目录下的 context.xml 文件 <Valve className="com.orangefunction.tomcat.redissessions....
通过以上步骤,我们就完成了Redis与Tomcat7的整合,实现了session的共享和持久化。这样,即使在多台Tomcat服务器之间,或者服务器重启后,用户session也能被正确处理,提高了应用的可用性和可扩展性。同时,由于...
"tomcat-redis-session-manager"是一个解决方案,它将用户的Session信息存储在Redis缓存服务器中,从而实现跨服务器的Session共享。本篇文章将深入探讨这个话题,包括它的原理、配置以及实际应用。 **一、Session...
4. **日志和错误管理**:Tomcat的日志文件位于`logs`目录下,包括catalina.out、host-manager、manager、localhost_access_log.*等,这些文件有助于调试和监控服务器的运行状态。 5. **webapps目录**:这是部署Web...
- **管理界面**: 启用`Manager App`和`Host Manager`,通过浏览器访问`http://localhost:8080/manager/html`和`http://localhost:8080/host-manager`进行管理。 - **JMX监控**: 可通过JMX(Java Management ...
Tomcat7支持多种方式部署Web应用,如通过webapps目录下的WAR文件自动部署,或者通过管理工具(如Manager App)进行远程部署。此外,还提供了热部署功能,允许在运行时更新应用。 五、Tomcat7的安全性 Tomcat7提供...
7. **安全性**:Tomcat提供了基本的安全特性,包括SSL/TLS支持、 Realm配置(用于身份验证)和角色为基础的访问控制。用户可以通过修改`server.xml`和`context.xml`文件来加强服务器的安全性。 8. **部署与更新**:...
tomcat-redis-session-manage-tomcat7.jar commons-pool2-2.2.jar jedis-2.5.2.jar 编辑${TOMCAT_HOME}/conf/context.xml,在context中加入 <Valve className="com.orangefunction.tomcat.redissessions....
综上所述,"适配与Tomcat7、8、9的redis session共享jar包"提供了一种有效的方法,解决了在多台Tomcat服务器之间共享session的挑战,利用Redis的高效存储和检索能力,提高了Web应用的可扩展性和用户体验。...
- 提供了管理工具,如Manager和Host Manager应用,用于管理应用程序和服务器配置。 - 配置文件如`server.xml`、`web.xml`等,用于定义服务器和应用程序的行为。 - `conf`目录包含所有可配置的文件。 - `bin`目录...
默认情况下,Tomcat管理界面(Manager App和Host Manager)是开放的,需要在`$CATALINA_HOME/conf/tomcat-users.xml`中配置用户名和密码,并在`server.xml`中启用管理应用,但生产环境中应限制访问,防止未授权访问...
5. **安全性**:Tomcat的安全配置主要涉及用户认证、角色管理和访问控制,这些都可在conf/tomcat-users.xml和conf/web.xml中进行设置。 6. **日志管理**:Tomcat的日志文件位于logs目录下,包括catalina.out、host-...
Tomcat Manager是Tomcat服务器内置的一个管理工具,允许用户通过Web界面或命令行接口对部署在Tomcat上的应用进行操作,包括部署、卸载、重新加载和查看应用状态等。下面我们将详细探讨如何配置和使用Tomcat Manager...