We all know how to create multiple domains in Apache. By adding virtual host etries. But how to configure multiple domains in tomcat? We can do this by adding multiple Host tags in server.xml. Its very simple. See the example below. Edit server.xml under conf directory. Suppose you want to setup three domains domain1.com, domain2.com and domain3.com. Every domain points to same ip address in the server.
<Engine defaultHost=”arnid” name=”Catalina”>
<Host name=”domain1.com” appBase=”/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root1″>
unpackWARs=”true” autoDeploy=”true”
<Alias>www.domain1.com</Alias>
<Context path=”” docBase=”.”/>
</Host>
<Host name=”domain2.com” appBase=”/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root2″>
unpackWARs=”true” autoDeploy=”true”
<Alias>www.domain2.com</Alias>
<Context path=”” docBase=”.”/>
</Host>
<Host name=”domain3.com” appBase=”/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root3″>
unpackWARs=”true” autoDeploy=”true”
<Alias>www.domain3.com</Alias>
<Context path=”” docBase=”.”/>
</Host>
<Engine
Now restart tomcat and everything should be working fine.
Recent Comments