配置好 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 7 访问 Manager 和 Host Manager的更多相关文章

  1. Tomcat7/8访问Server Status、Manager App、Host Manager出现403 forbidden

    在配置好Tomcat7/8后,我们往往需要访问Tomcat7/8的Manager以及Host Manager.就需要在tomcat-users.xml中配置用户角色来实现.在地址栏输入:localho ...

  2. Tomcat 访问 Manager App,Host Manager

     1.启动tomcat,在浏览器输入:http://localhost:8080/ 2.配置tomcat-users.xml 文件 在主目录的cong文件夹下找到tomcat-users.xml 文件 ...

  3. tomcat如何登录Server Status、Manager App、Host Manager

    启动tomcat后,访问127.0.0.1会进入如下页面 版权声明:本文为博主原创文章,未经博主允许不得转载. 原文地址:https://www.cnblogs.com/poterliu/p/9602 ...

  4. tomcat 登录主页成功 点击Manager App 401 等问题

    1.将项目部署在tomcat的安装路径webapps下(如果报404,查下该应用是否在tomcat的webapps下部署着) 2.启动tomcat成功,http://127.0.0.1:8080成功, ...

  5. asterisk manager api 配置 (manager.conf)

    http://blog.csdn.net/niino/article/details/5748805 要激活AMI,需要在/etc/asterisk/manager.conf中,[general]块下 ...

  6. Nginx服务器之Nginx与tomcat结合访问jsp

    本文使用linux centos系统 本文概述: JSP是一种动态网页技术标准.使用的方式是在HTML文件中插入程序段和JSP标记,而形成JSP文件.使用JSP开发WEB应用可以跨平台开发.但jsp需 ...

  7. 配置Tomcat的访问日志格式化输出

    博客搬家,本文新地址:http://www.zicheng.net/article/9   本文描述如何配置tomcat的访问日志,按我们的要求输出指定的日志格式. 且在Nginx+Tomcat的配置 ...

  8. Android SDK Manager和AVD Manager使用

    Android SDK Manager和AVD Manager使用(win7_64bit下测试) 目录 1.概述 2.本文用到的工具 3.安卓开发基础工具包下载 4.Android SDK Manag ...

  9. 搭建Tomcat服务器访问本地资源

    目标,搭建Tomcat服务器,使同网络段下其他电脑可以访问分享的文件 下载安装Tomcat 如下图,在官网http://Tomcat.apache.org/下载对应版本的Tomcat,解压安装即可 启 ...

随机推荐

  1. [转] ubuntu 一些常用软件的安装

    首先说明一下 ubuntu 的软件安装大概有几种方式: 1. deb 包的安装方式deb 是 debian 系 Linux 的包管理方式, ubuntu 是属于 debian 系的 Linux 发行版 ...

  2. 域名地址默认跳转到www(301重定向)

    要做这个操作之前,你首先必须肯定要有一个域名..... 然后域名指向了某一个外网主机地址,能正常访问网站 IIS7之后版本的看客继续往下看,IIS7之前的版本,请止步,我没有对之前的版本做过 首先确认 ...

  3. Netty实例-简单的服务端-client实现,凝视具体

           书籍推荐:                                       实例代码 :http://download.csdn.net/detail/jiangtao_st ...

  4. C++ multimap 的插入,遍历,删除

    #include <iostream> #include <map> #include <string> using namespace std; int main ...

  5. js+css实现模态层效果

    在做web前端的时候,有些时候会涉及到模态层,在此提供一种实现思路.希望对大家实用.先贴效果吧: 模态层效果 以下说说在写模态层的时候的思路:通过可配置的參数width,height,title以及c ...

  6. MongoDB 的 MapReduce 大数据统计统计挖掘

    MongoDB虽然不像我们常用的mysql,sqlserver,oracle等关系型数据库有group by函数那样方便分组,但是MongoDB要实现分组也有3个办法: * Mongodb三种分组方式 ...

  7. AAM(Active Appearance Model)算法介绍

    前面介绍ASM算法(http://blog.csdn.net/carson2005/article/details/8194317)的时候,笔者提到,ASM是基于统计形状模型的基础上进行的,而AAM则 ...

  8. .net中将DataTable导出到word、Excel、txt、htm的方法

    dt:DataTable strFile:fileName strExt:type private void GridExport(DataTable dt, string strFile, stri ...

  9. 原生js获取body

    1. doucumnet.body 2. document.getElementsByTagName("body")[0]

  10. Oracle语句块PL/SQL循环判断

    - --pl/sql Procedural Language /sql --被数据库编译保存,由用户调用 --程序块 /* 语法 Declare – 声明变量 --声明变量 Age int; //没有 ...