1、默认的项目都在目录:apache-tomcat-9.0.0.M22\webapps\ROOT下
2、该目录下有一个index.jsp是tomcat的默认主页,如下
3、现在需要修改这个默认主页,改成自己的主页
(1)修改配置文件server.xml(在conf目录下),找到如下代码:
1 2 3 |
<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,访问的根目录就是刚刚设置的目录文件了
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有