Tomcat配置

场景:

一台主机:IP

一个域名:www.test.com.cn

2个站点: mainsite 和subsite

mainsite访问方式  http://www.test.com.cn

subsite访问方式 http://www.test.com.cn/subsite

配置如下:

tomcat配置文件Server.xml (tomcat安装目录conf文件下)

<Engine name=”Catalina” defaultHost=”localhost”>

<!–For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) –>
<!–
<Cluster className=”org.apache.catalina.ha.tcp.SimpleTcpCluster”/>
–>

<!– Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack –>
<Realm className=”org.apache.catalina.realm.LockOutRealm”>
<!– This Realm uses the UserDatabase configured in the global JNDI
resources under the key “UserDatabase”. Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. –>
<Realm className=”org.apache.catalina.realm.UserDatabaseRealm”
resourceName=”UserDatabase”/>
</Realm>

<Host name=”www.test.com.cn” appBase=”webapps”
unpackWARs=”true” autoDeploy=”true”>
<!–subsite配置 –>
<Context path=”/test” docBase=”subsite”></Context>
<!–mainsite配置 –>
<Context path=”” docBase=”mainsite”></Context>
<!– 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”
prefix=”localhost_access_log” suffix=”.txt”
pattern=”%h %l %u %t &quot;%r&quot; %s %b” />

</Host>
</Engine>

发表评论

电子邮件地址不会被公开。 必填项已用*标注