[代码] 以下的内容就是在Tomcat的webapps目录下新建一个www文件夹作为www.oschina.net这个域名的主目录
1 <Host name="www.oschina.net" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
2 <Context path="" docBase="www" debug="0" reloadable="true" crossContext="true"/>
3 <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="oschina_log." suffix=".txt"
4 timestamp="true"/>
5 </Host>
[代码] 以下内容的意思就是在C盘test文件夹下面建立一个www文件夹作为www.oschina.net这个域名的主目录
1 <Host name="test.5sai.net.cn" debug="0" appBase="C:\\test\www" unpackWARs="true" autoDeploy="true">
2 <Context path="" docBase="."/>
3 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="oschina_log."
4
5 suffix=".txt" pattern="common" resolveHosts="false"/>
6 <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="oschina_log." suffix=".txt" timestamp="true"/>
7 </Host>
[代码] 如果是linux系统的/var/www作为www.oschina.net这个域名的主目录的话内容如下:
1 <Host name="www.oschina.net" debug="0" appBase="/var/www" unpackWARs="true" autoDeploy="true">
2 <Context path="" docBase="."/>
3 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="oschina_log."
4
5 suffix=".txt" pattern="common" resolveHosts="false"/>
6 <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="oschina_log." suffix=".txt" timestamp="true"/>
7 </Host>
[代码] 域名www.oschina.net的主目录为/var/www 该站点的所有访问LOG放在/ar/log/tomcat里面
01 <Host name="www.oschina.net" debug="0" unpackWARs="true">
02 <Valve className="org.apache.catalina.valves.AccessLogValve"
03 directory="/var/log/tomcat" prefix="www_5sai_access_log." suffix=".txt"
04 pattern="common"/>
05 <Logger className="org.apache.catalina.logger.FileLogger"
06 directory="/var/log/tomcat" prefix="oschina_log." suffix=".txt"
07 timestamp="true"/>
08
09 <Context path="" docBase="/var/www" debug="0" reloadable="true"/>
10 </Host>
[代码] 同时写多个主机
1 <Host name="www.oschina.net" debug="0" appBase="D:\Tomcat50\webapps\www.oschina.net">
2 <Context path="" docBase="." debug="0"/>
3 </Host>
4 <Host name="my.oschina.net" debug="0" appBase="D:\Tomcat50\webapps\my.oschina.net">
5 <Context path="" docBase="." debug="0"/>
6 </Host>
http://www.oschina.net/code/snippet_12_2034