首页 > 其他 > 详细

修改TOMCAT默认主页

时间:2018-09-13 13:28:36      阅读:184      评论:0      收藏:0      [点我收藏+]

1、默认的项目都在目录:apache-tomcat-9.0.0.M22\webapps\ROOT下

2、该目录下有一个index.jsp是tomcat的默认主页,如下

技术分享图片

3、现在需要修改这个默认主页,改成自己的主页

(1)修改配置文件server.xml(在conf目录下),找到如下代码:

<Host name="172.18.0.5"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
<Context path="" docBase="C:\apache-tomcat-9.0.0.M22\webapps\ROOT"/>

 修改第三行为<Context path="" docBase="C:\apache-tomcat-9.0.0.M22\webapps\ROOT\1" debug="0"/>

其中C:\apache-tomcat-9.0.0.M22\webapps\ROOT\1就是你想设置的网站根目录,我这里的根目录就是1

(2)修改配置文件web.xml,找到如下代码:

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

在第一行添加上指定文件,如<welcome-file>work_detail.html</welcome-file>,注意:work_detail.html是目录1下的文件

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

4、重启tomcat,访问172.18.0.5:8080

技术分享图片

OK,访问的根目录就是刚刚设置的目录文件了

 

修改TOMCAT默认主页

原文:https://www.cnblogs.com/ermao0423/p/9639806.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!