Pivotal Knowledge Base

Follow

Configuring a Tomcat/tc Server for multiple, name-based virtual hosts (2008011)

Configuring a Tomcat/tc Server for multiple, name-based virtual hosts (2008011)

Purpose

This article provides information on configuring Tomcat/tc Server for multiple, name-based virtual hosts. Each virtual host should serve only its own set of Web applications.

Resolution

Virtual hosting enables a single web server to serve multiple domain names.  For Tomcat/tc Server, you can do this by configuring multiple, name-based virtual hosts in the server.xml file. Each of these name-based virtual hosts can have its own root web application deployed in its application base. 
 
This is an example configuration for three name-based virtual hosts:
 
 <Host name="ns_tomcat_vhost1"  appBase="webapps-vhost1"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="ns_tomcat_vhost1_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
    </Host>
    <Host name="ns_tomcat_vhost2"  appBase="webapps-vhost2"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="ns_tomcat_vhost2_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
    </Host>
    <Host name="ns_tomcat_vhost3"  appBase="webapps-vhost3"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="ns_tomcat_vhost3_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
    </Host>

See Also

©VMware 2013

Comments

Powered by Zendesk