Tomcat中更改网站根目录和默认页的配置方法
1.tomcat原来的默认根目录是http://localhost:8080,如果想修改访问的根目录,可以这样:
找到tomcat的server.xml(在conf目录下),找到:
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false"></Host>
在</Host>前插入:
其中D:/eclipse3.3/jb51.net/tomcat/就是我想设置的网站根目录,然后重启tomcat。
再次访问http://localhost:8080时,就是直接访问D:/eclipse3.3/jb51.net/tomcat/目录下的文件了。
2.tomcat的web.xml(在conf目录下),在该文件中找到
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这是tomcat默认的3个文件,当你输入指定路径后,tomcat会自动查找这3个页面。如果你想让tomcat自动找到自己的页面,比如main.jsp。可以修改上面信息为:
<welcome-file-list>
<welcome-file>main.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这样就可以了。
相关文章
tomcat8中startup可以启动tomcat8w无法启动的问题分析
这篇文章主要介绍了tomcat8中startup可以启动,tomcat8w无法启动的问题,根本原因是windows 服务内没有tomcat服务,所以无法启动,本文给大家分享解决方法,需要的朋友可以参考下2022-08-08IDEA2021 tomcat10 servlet 较新版本踩坑问题
这篇文章主要介绍了IDEA2021 tomcat10 servlet 较新版本踩坑问题,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2021-04-04
最新评论