为springboot项目,外置tomcat设置不需要项目名访问

将项目打成war包,放入webapp目录下

修改conf目录下server.xml
在这里插入图片描述

将修改host内容,将

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

改为:

<Host name="localhost"  appBase="" unpackWARs="true" autoDeploy="true">
		
<Context docBase="webapps/你的项目名" path="" reloadable="true" source="org.eclipse.jst.jee.server:你的项目名"/>

如下图所示,改之前:
在这里插入图片描述
改之后:
在这里插入图片描述
此时运行tomcat,可以不需要项目路径访问项目,也就是说访问 http://localhost:8080就行了

猜你喜欢

转载自blog.csdn.net/pz641/article/details/85029431