Tomcat 修改根目录

来源:互联网 发布:ae cs6 mac 编辑:程序博客网 时间:2024/05/21 19:23

 修改tomcat根目录的指向。

=============tomcat 根目录/conf/server.xml原来信息==============

<Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
======================修改后========================

    <Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
<!-- 添加如下标签-->
<Context path="" docBase="F:/tomcat/projecet/helloworld" debug="0" reloadable="true" crossContext="true" />
</Host>

***************************
很多方法都说改变appBase=""的路径,其实那样改不了的。
如果path=""(注意不是path="/"),则相当于是这个Host的虚拟根目录,docBase则指出了物理目录的位置(可以是绝对也可以是相对于Host的appBase的位置),如果你访问http://localhost/ 则会使用F:/tomcat/projecet/helloworld里的内容。
原创粉丝点击