Tomcat virtual server addition

Hi

I have Tomcat v5 installed running on port 80 which is my production version.  I wanted to run another version of tomcat on port 8080 for a development version of my code on the same box.

How can I create a virtual server to accomplish this?
fareedakhanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ramazanyichConnect With a Mentor Commented:
add following line into your server.xml just after <Connector port="80"...../> element:
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

Your server will listen then in ports 80 and 8080
0
 
fareedakhanAuthor Commented:
Thanks!

How can I direct the different ports to different webapp folders?
0
 
ramazanyichCommented:
Ok. Now it is more clear.
So you have following config for a moment (I show only part which is important):
<Server .....>
..
    <Service name="Catalina">
    <Connector port="80"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />
    <Engine name="Catalina" defaultHost="localhost" debug="0">
     ....
      <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        ....
        </Host>
     </Engine>
    </Service>
</Server>

It means that you have a Service which has connector on port 80 and invokes applications for host with appbase on webapps dir.

If you want to have another listener for another appBase directory you should copy element (and subelements) <Service> and change port number of conenctor, name of service and appBase for <Host> element. Example:

   <Service name="Catalinadev">
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />
    <Engine name="Catalinadev" defaultHost="localhost" debug="0">
     ....
      <Host name="localhost" debug="0" appBase="webappsdev"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        ....
        </Host>
     </Engine>
    </Service>

In that eample appBase will be webappsdev.

 
0
All Courses

From novice to tech pro — start learning today.