然后就是context节点,这个节点主要是配置虚拟主机里的访问项目的,默认访问的项目是context里属性path=“”的项目,一个虚拟主机里不能同时设置两个项目为path=“”,如果这样的话,tomcat将启动不了。path主要是指定访问时的项目web名,而docBase即指定的是物理路径名称了。
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="web1" reloadable="true" crossContext="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 -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
</Host>
<Host name="paper" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="web2" docBase="web2" reloadable="true" crossContext="true" />
</Host>
<Host name="test.jb51.net" appBase="E:webrootjsp" uppackWARs="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="E:webroot" debug="0" reloadable="true"/>
</Host>
</Host>