Tomcat: Virtual Hosting and Web App
November 2nd, 2008 by jeremychoneTo map a domain name to a “war” web application.
File: [tomcat-path]/conf/server.xml
<Service>….
<Service>….
<Engine>…
<Host name="www.yourdomain.com" appBase="webapps/webappname" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="."/>
<Alias>yourdomain.com</Alias>
</Host>
</Engine>
</Service>
</Server>
<Service>….
<Engine>…
<Host name="www.yourdomain.com" appBase="webapps/webappname" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="."/>
<Alias>yourdomain.com</Alias>
</Host>
</Engine>
</Service>
</Server>
Note: This obviously assumes that this domain name is mapped to the specific tomcat instance.