Tomcat 8 配置访问Host-Manager在线部署war包

2022-09-29 10:00:27 浏览数 (1)

0、安装JDK

1、下载tomcat8.5

官网:Apache Tomcat® - Apache Tomcat 8 Software Downloads

下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.54/bin/apache-tomcat-8.5.54.tar.gz

centos 下载命令:curl -O https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.54/bin/apache-tomcat-8.5.54.tar.gz

解压:tar -zxvf apache-tomcat-8.5.54.tar.gz

2、配置xml

 进入conf文件夹配置tomcat-users.xml:

<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"/>

配置host-manager远程访问:

在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" />

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!!!

 配置完成,适用于8.5

0 人点赞