February 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728  

Categories

February 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728  

Configuring multiple domains or sub-domains in tomcat

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.

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=""> <s> <strike> <strong>