设为首页收藏本站
开启辅助访问
切换到宽版

创星网络[分享知识 传递快乐]

 找回密码
 立即注册

QQ登录

只需一步,快速开始

用新浪微博登录

只需一步,快速搞定

搜索
查看: 3788|回复: 0
打印 上一主题 下一主题

Tomcat虚拟主机配置Manager是tomcat-users.xml怎么配?

[复制链接]

我玩的应用:

跳转到指定楼层
楼主
发表于 2012-12-15 22:33:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
问题:举例来说,现在Tomcat有两个Host,一和hostA,一个hostB,都给他们了Manager程序,在tomcat-users.xml中写了两个具有manager角色的用户,一个是userA,给hostA使用,另一个是userB,给hostB使用,让他们可以分别登录各自的Manager程序,管理自己的应用。但是,经测试发现,hostB完全可以使用userB进入到hostA的Manager中,反过来也一样,请问高手们这个问题怎么解决啊??

或者说哪位高手有更好的Tomcat虚拟主机配置方案?

本人正在尝试多Tomcat实例的方案,正在调试中,希望有高人可以给以指点,不胜感激!

回答:

在你的hostA里manager的web.xml
  1. 〈!-- Define a Security Constraint on this Application --〉

  2. 〈security-constraint〉

  3. 〈web-resource-collection〉

  4. 〈web-resource-name〉Entire Application〈/web-resource-name〉

  5. 〈url-pattern〉/manager/*〈/url-pattern〉

  6. 〈/web-resource-collection〉

  7. 〈auth-constraint〉

  8. 〈role-name〉your-role〈/role-name〉

  9. 〈/auth-constraint〉

  10. 〈/security-constraint〉

  11. 〈!-- Define the Login Configuration for this Application --〉

  12. 〈login-config〉

  13. 〈auth-method〉BASIC〈/auth-method〉

  14. 〈realm-name〉Application〈/realm-name〉

  15. 〈/login-config〉

  16. 〈!-- Security roles referenced by this web application --〉

  17. 〈security-role〉

  18. 〈description〉

  19. The role that is required to log in to the Manager Application

  20. 〈/description〉

  21. 〈role-name〉your-role〈/role-name〉

  22. 〈/security-role〉
复制代码
把your-role替换成你的tomcat-users.xml定义的用户就行了。

from:http://go.cxweb.com.cn/hvwe7
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|创星网络 ( 苏ICP备11027519号|网站地图  

GMT+8, 2024-9-22 06:50 , Processed in 0.090526 second(s), 29 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表