Linux 下Tomcat配置远程访问管理端
1:修改Tomcat默认端口号,将默认的8080修改为8081
apache-tomcat-8.5.31\conf\server.xml
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
2:配置管理台用户权限信息,注意username与password
apache-tomcat-8.5.31\conf\tomcat-users.xml
<?xml version="1.0" encoding="UTF-8"?> <tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0"> <role rolename="admin-gui"/> <role rolename="admin-script"/> <role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="test" password="test" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> </tomcat-users>
3:配置manager
apache-tomcat-8.5.31\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" /> --> <!-- <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>--> </Context>
4:重启Tomcat服务。