tomcat 设置默认项目

如果项目名叫yxm

端口为:8080

默认情况下浏览项目应在地址栏输入:127.0.0.1:8080/yxm

下面更改配置,更改后,只需要在地址栏输入127.0.0.1:8080就可以访问项目。

1.   打开配置文件  apache-tomcat-9.0confserver.xml

找到host段

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

          ......

     </Host>

2.   在<host></host>之间加入,如果有,直接修改docBase= "项目名"

<Context path="" docBase="yxm" debug="0" reloadable="true" />

3.   重启服务,浏览时直接在地址栏输入:127.0.0.1:8080 就可以访问了。

如果想直接输入127.0.0.1不加端口,可把端口改为80,但要保证端口不冲突。

原文地址:https://www.cnblogs.com/yangxuming/p/7103139.html