tomcat9控制台远程部署
conf/tomcat-users.xml 配置权限
<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">
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script"/>
</tomcat-users>
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>
默认设置只能本地访问(127.0.0.1),删掉标签value,则所有机器都能访问。
可以指定特定ip访问,如:
- allow=“192.168.10.10”
- allow=“192.168.10.\d+”
webapps/manager/WEB-INF/web.xml 上传文件大小
<servlet>
<servlet-name>HTMLManager</servlet-name>
<servlet-class>org.apache.catalina.manager.HTMLManagerServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<multipart-config>
<!-- 默认50MB max 超过50MB则上传失败, 这里修改成500MB-->
<max-file-size>524288000</max-file-size>
<max-request-size>524288000</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
</servlet>