Tomcat virtual host

This mini howto to show how to configure a virtual host on tomcat.
This use HTTP 1.1 feature so with one single IP and one single Tomcat server you can virtually host infinite domains.

Edit the file %TOMCAT_HOME%/conf/server.xml

Under the tag host (the one setted by default for localhost) add the following line:

  1. <host name="[www.mydomain.com]">
  2. <context path="/" docBase="webapps/[mydomainwebsite]" debug="0" reloadable="true"/>
  3. </host>

Obviously you have to change change the [squared] value respectively with the domain of the site and with the directory where there are the web application files.

Errata:
apparently one of 2 sites doesn’t work with the settings above. A working version look like this:

  1. <host name="www.blu-blu.info" appBase="webapps/blublu" unpackWARs="true" autoDeploy="true">
  2.   <context path="" docBase="" debug="0" reloadable="true" />
  3.   </host>

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>