• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

Mapping different domains to different webapps in TOMCAT

How do you setup a single tomcat instance so that, for example, www.domainname1.com goes to webapp A, and www.domainname2.com goes to webapp B ?

Thanks in advance.
0
Captain-Fantastic
Asked:
Captain-Fantastic
1 Solution
 
sleep_furiouslyCommented:
Use multiple Host elements with the Engine element in server.xml

Note:  One of the Hosts listed must match the defaultHost


For example:

    <Engine name="Standalone" defaultHost="localhost" debug="0">
 
      <Host name="localhost" debug="0" appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Context path="" docBase="ROOT" debug="0"/>
      </Host>

      <Host name="www.domainname1.com" appBase="/home/app1/webapp">
        <Context path="" docBase="."/>
      </Host>


      <Host name="www.domainname2.com" appBase="/home/app2/webapp">
        <Context path="" docBase="."/>
      </Host>


    </Engine>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now