完美解決tomcat8.5+遠端無法登入tomcat問題及jenkins遠端部署問題
tomcat8.5之後配置了使用者名稱密碼之後預設只能本地訪問,遠端是無法訪問的,可用下面方法進行解決
1. C:\Users\Administrator\Desktop\apache-tomcat-8.5.27-windows-x64\apache-tomcat-8.5.27\conf\tomcat-users.xml 中增加
<role rolename="manager-gui"/><user username="admin" password="a123456" roles="manager-gui"/>
2. C:\Users\Administrator\Desktop\apache-tomcat-8.5.27-windows-x64\apache-tomcat-8.5.27\webapps\manager\META-INF\context.xml中註釋掉配置
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
3. 解決部署是war包過大無法上傳的問題【修改/apache-tomcat-8.5.28/webapps/manager/WEB-INF/web.xml】
<multipart-config>
<!-- 500MB max -->
<max-file-size>524288000</max-file-size>
<max-request-size>524288000</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
</servlet>
4. jenkins自動化部署tomcat8.5
5. tomcat訪問host-manager報403錯誤處理方法進入目錄修改 tomcat9091-2/webapps/host-manager/META-INF/context.xml allow 修改為 allow="^.*$"
6. 使用jenkins進行部署時報錯 org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="a123456" roles="manager-gui,admin-gui,manager-script"/>