1,将xxx.war包拷贝到tomcat的webapps文件夹(我的war名称为 unnamed.war)
2,配置conf中的server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- 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" />
<!--新加-->
<Context path="/unnamed" docBase="unnamed" reloadable="true"/>
</Host>
path: 路径
docBase: war包的路径, 可以直接指定E:/x/xx
默认情况下tomcat的port为8080
image.png
运行bin中的startup.bat或者startup.sh
然后访问http://localhost:8080/unnamed/
网友评论