tomcat 配置虚拟路径

tomcat配置虚拟路径的两种方法:

第一种:1、在server.xml文件的的host节点增加如下内容:

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>

		<Context path="/TestTtt" docBase="D:\testVir\TestTomcat" reloadable="true" debug="0"></Context> 
	  </Host>

 其中path中的/TestTtt对应浏览器上url上的项目名:localhost:8181/TestTtt/test1.html,docBase则对应这个项目在磁盘中的目录;

第二种:

在D:\tomcat7\conf\Catalina\localhost 目录中添加 sitecc.xml文件,文件内容如下:

 

<Context path="/TestTtt" docBase="D:\testVir\TestTomcat" reloadable="true" debug="0">
</Context> 

 注意文件名对应浏览器url中的项目名 localhost:8181/sitecc/test1.html

 

posted @ 2017-06-03 11:31  devin.ding  阅读(352)  评论(0编辑  收藏  举报