这里用的是tomcat9,理论上适用于所有现行版本。
简单粗暴版
server.xml
当中搜索8080
端口
直接替换即可修改总端口。
然后搜索appBase当中。
将
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
改为
<Host name="localhost" appBase="D:\soft\apache-tomcat-9.0.30\webapps\anquanchu"
unpackWARs="true" autoDeploy="true">
<Context docBase="D:\soft\apache-tomcat-9.0.30\webapps\anquanchu\public" path=""/>
总体上更改结果:
<Host name="localhost" appBase="D:\soft\apache-tomcat-9.0.30\webapps\anquanchu"
unpackWARs="true" autoDeploy="true">
<Context docBase="D:\soft\apache-tomcat-9.0.30\webapps\anquanchu\public" path=""/>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>