转载:原文地址:https://my.oschina.net/u/2338224/blog/1793153

操作系统:

   Linux version 2.6.32-696.10.1.el6.x86_64 (mockbuild@c1bl.rdu2.centos.org)

   (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) )

    #1 SMP Tue Aug 22 18:51:35 UTC 2017

tomcat:

tomcat: apache-tomcat-8.5.30

JAVA版本:

 java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

新增admin Manager
三个步骤,缺一不可!!!!!!!!!!

  1. 在server.xml里面的<tomcat-users> 标签内新增 ,除了密码 ,一个字都别改

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="admin" password="123456" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
2.

到tomcat目录下找到content.xml

cd /opt/apache-tomcat-8.5.24/webapps/host-manager/META-INF/

修改 content.xml

修改

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

为:

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="\d+.\d+.\d+.\d+|::1|0:0:0:0:0:0:0:1" />

如果不执行这步. 则只能localhost访问manager!!!
3.

配置远程访问manager:

tomcat目录/conf/Catalina/localhost/下 添加manager.xml

<Context privileged="true" antiResourceLocking="false"

docBase="${catalina.home}/webapps/manager">

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />

</Context>
如果不执行这步. 则只能localhost访问manager!!!