zhuangjinxin / blog

:notebook: 个人博客 技术分享 整理笔记
http://blog.zhuangjinxin.top
7 stars 0 forks source link

Ubuntu14.04安装配置Tomcat8.5 #25

Closed zhuangjinxin closed 6 years ago

zhuangjinxin commented 7 years ago

Tomcat Manager配置

权限:

Example

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>

角色: manager-gui ,用户名:tomcat, 密码:s3cret

用户配置好了之后,访问"Manger App"此时还是报错“403 Access Denied ”! 其中有一句提示:

By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file.

Google翻译:
默认情况下,Manager只能从与Tomcat相同的计算机上运行的浏览器访问。 如果要修改此限制,则需要编辑Manager的context.xml文件。

配置$CATALINA_BASE/webapps/manager/META-INF/context.xml:

<?xml version="1.0" encoding="UTF-8"?>

<Context antiResourceLocking="false" privileged="true" >
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>

0:0:0:0:0:0:0:1后追加允许远程访问的IP,如:

<?xml version="1.0" encoding="UTF-8"?>

<Context antiResourceLocking="false" privileged="true" >
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|1\.202\.150\.3" />
</Context>

此时,大功告成,可以在这个远程IP上访问“Manager App”了!

官方文档:http://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html