How to run different apps on single Tomcat instance behind different ports

Suppose  you want to configure Tomcat so that it run in root context behind separate ports for example

add below lines to server.xml file in tomcat_home/conf directory.

<Service name="myapp1 ">
   <Connector port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" 
           connectionTimeout="20000" 
           redirectPort="8443" />
   <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="myapp1"
        unpackWARs="true" autoDeploy="true">
      </Host>
   </Engine>
</Service>
<Service name="myapp2 ">
   <Connector port="8082" protocol="org.apache.coyote.http11.Http11NioProtocol" 
           connectionTimeout="20000" 
           redirectPort="8444" />
   <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="myapp2 "
        unpackWARs="true" autoDeploy="true">
      </Host>
   </Engine>
</Service>
Advertisements
This entry was posted in Tomcat. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s