首页 > Web开发 > 详细

Tomcat中更改网站根目录和默认页的配置

时间:2015-10-31 21:22:34      阅读:273      评论:0      收藏:0      [点我收藏+]

1.tomcat原来的默认根目录是http://localhost:8080,如果想修改访问的根目录,可以这样:

找到tomcat的server.xml(在conf目录下),找到:

<Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false"></Host>

 

</Host>前插入:

<Context path="" docBase="根目录" debug="0"/>
然后重启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>

Tomcat中更改网站根目录和默认页的配置

原文:http://www.cnblogs.com/ax7399/p/4926195.html

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