以OSPod官方网站部署为例,OSPod官方网站包括www.ospod.com一级域名,还包括forum.ospod.com/blog.ospod.com两个二级域名。
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="" docBase="/app/ospod/cms"
debug="5" reloadable="true">
<Resource name="jdbc/ecms" auth="Container" type="javax.sql.DataSource"
maxActive="60" maxIdle="30" maxWait="10000"
username="root" password="mysql" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql:///ecms?zeroDateTimeBehavior=convertToNull"/>

</Context>

</Host>
打开Tomcat的安装目录下的conf/server.xml,进行修改。
找到<Engine name="Catalina" defaultHost="localhost"部分,在<Engine></Engine>中间添加一级域名配置:














forum.ospod.com二级域名配置:
<Host name="forum.ospod.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/app/ospod/forum"
debug="5" reloadable="true">
<Resource name="jdbc/eforum" auth="Container" type="javax.sql.DataSource"
maxActive="60" maxIdle="30" maxWait="10000"
username="root" password="mysql" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql:///eforum?zeroDateTimeBehavior=convertToNull"/>
</Context>
</Host>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/app/ospod/forum"
debug="5" reloadable="true">
<Resource name="jdbc/eforum" auth="Container" type="javax.sql.DataSource"
maxActive="60" maxIdle="30" maxWait="10000"
username="root" password="mysql" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql:///eforum?zeroDateTimeBehavior=convertToNull"/>
</Context>
</Host>