美文网首页
tomcat 修改默认ROOT路径

tomcat 修改默认ROOT路径

作者: 幻影翔 | 来源:发表于2019-12-21 22:35 被阅读0次

    实现效果

    通过新建tomcat代理项目路径,使得tomcat默认进入自定义的项目路径,不需要项目名可以直接通过访问 localhost:8080进入你的项目主页

    修改步骤

    1.去掉tomcat默认访问路径 在conf文件夹下web.xml中去掉
    <welcome-file-list></welcome-file-list>中的index.html

     <welcome-file-list>
           <!--  <welcome-file>index.html</welcome-file> -->
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    

    2 server.xml中在 <host></host>内加上 <context path="" docbase="control" debug="0" privileged="true" ></context>
    其中path中的内容即是代理地址,可以为空,即用端口登陆
    docBase是tomcat webapps文件中需要代理的工程名
    默认访问当然工程web.xml中指定的页面

     <Host>
     <Context antiResourceLocking="false" 
              debug="0" 
              docBase="control" 
              path="" 
              privileged="true" 
              reloadable="true" />
     </Host>
    

    3、替换eclipse 项目Server下的文件,不然eclipse启动后会覆盖tomcat修改的文件


    image.png

    相关文章

      网友评论

          本文标题:tomcat 修改默认ROOT路径

          本文链接:https://www.haomeiwen.com/subject/lwdnnctx.html