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: