Tomcat中更改网站根目录和默认页的配置方法中更改网站根目录和默认页的配置方法
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=”D:/eclipse3.3/jb51.net/tomcat/” debug=”0″/>
其中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>
这样就可以了。
您可能感兴趣的文章您可能感兴趣的文章:修改Tomcat默认访问根目录的方法实现将Web应用部署到Tomcat根目录的三种方法Tomcat 中如何给
web 项目配置虚拟目录的方法tomcat之目录映射_动力节点Java学院整理tomcat目录结构简介_动力节点Java学院整理Tomcat
之web应用的目录组成结构_动力节点Java学院整理详解Tomcat服务器绑定多域名和虚拟目录的方法Windows系统下安装
Tomcat服务器和配置虚拟目录的方法不让tomcat显示目录文件列表的配置方法Tomcat目录结构详细介绍
评论10