Friday, December 14, 2007

Virtual Hosting in Tomcat

Virtual Hosting in Tomcat

We can configure Virtual Hosting in Tomcat by simply adding Hosts in the server.xml file of Tomcat.

Here is the entry in the server.xml that configures Hosts in the Tomat.

 <Host name="www.nitinroman.com" appBase="webapps" unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    </Host>
   
    <Host name="www.sachinroman.com" appBase="webapps" unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    </Host>


After making an entry in the server.xml , restart  the Tomcat.

Finally add an entry in C:\WINDOWS\system32\drivers\etc\hosts file as follows

127.0.0.1    localhost
127.0.0.1    www.nitinroman.com
127.0.0.1    www.sachinroman.com