You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jiansen Niu <ao...@gmail.com> on 2008/06/01 02:58:46 UTC
Re: apache + mod_jk + two tomcat instance configuration
Hi John,
Thanks for the comments. I did what you told me, but it does not work. here
is what I did:
workers.properties:
workers.java_home=/usr/lib/jdk1.6.0_04
#List workers
worker.list=worker001,worker002
#Define worker001
worker.worker001.port=8009
worker.worker001.host=localhost
worker.worker001.type=ajp13
worker.worker001.lbfactor=1
#Define worker002
worker.worder002.port=8010
worder.worker002.host=localhost
worker.worker002.type=ajp13
worker.worker002.lbfactor=1
httpd.conf:
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile /etc/httpd/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel warn
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
virtual hosts:
##### for www.domain1.com -- by tomcat6.0.16
<VirtualHost *:80>
ServerAdmin admin@domain1.com
DocumentRoot /usr/servers/apache-tomcat-6.0.16/webapps/www.domain1.com
ServerName www.domain1.com
ErrorLog logs/domain1_error_log
JkMount /*.jsp worker001
JkMount /*.do worker001
</VirtualHost>
##### for cb.domain1.com -- by codebeamer's built in tomcat
<VirtualHost *:80>
ServerAdmin admin@domain1.com
DocumentRoot /home/codebeamer/cb4/tomcat/webapps/cb
ServerName cb.domain1.com
ErrorLog logs/cb_error_log
JkMount /*.* worker002
JkMount /cb/*.* worker002
</VirtualHost>
I have changed AJP1.3 connector's port from 8009 to 8010 in codebeamer's
tomcat server.xml (worker002)
Now, all my PHP applications works correctly from internet by enter their
corresponding URL.
The Java application can be accessed too by www.domain1.com
but cb.domain1.com goes to the Java application under
www.domain1.cominstead of codebeamer, I checked access logs,
cb.domain1.com still forward request to tomcat6.0.16 by worker001.
cb.domain1.com is a subdomain of www.domain1.com.
Any idea why is this?
Thanks again.
Jiansen
On Sat, May 31, 2008 at 7:33 AM, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
> ----- Original Message ----- From: "Jiansen Niu" <ao...@gmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Saturday, May 31, 2008 8:35 AM
> Subject: apache + mod_jk + two tomcat instance configuration
>
>
>
> I have apache2.0 as front end web server, using mod_jk and tomcat 6.0.16
>> serve Java web applications.
>> Now, I have couple PHP web applications and one Java Web application. The
>> Java web application can
>> be accessed by url www.domain1.com, workers.properties has something like
>> this:
>>
>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>> workers.java_home=/usr/lib/jdk1.6.0_04
>> ps=/
>> #List workers
>> worker.list=worker001
>> #Define worker001
>> worker.worker001.port=8009
>> worker.worker001.host=localhost
>> worker.worker001.type=ajp13
>> worker.worker001.lbfactor=1
>>
>> I want to install codebeamer (a java webapplication) to my server,
>> codebeamer use a different version
>> of tomcat as the one I'm using. I have to use its own tomcat since they
>> customized it. I changed its
>> port to 8081, shutdown port to 8006 which are different from my current
>> tomcat server (8080 and 8005).
>>
>> My questions is, is it possible, I add another worker in the same
>> workers.properties file, use different
>> port number say 8010 and integrates my current Apache web server with
>> codebeamer's tomcat, so I
>> can access it by www.domain1.com/codebeamer? If possible what I should do
>> with this line in
>> workers.properties:
>>
>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>>
>
>
> Jiansen, Yes I think so
> Something like this
>
> worker.list=worker1,worker2
> # Set WORKER1
> worker.worker1.port=8009
> worker.worker1.host=machine1domain
> worker.worker1.type=ajp13
> # Set WORKER2
> worker.worker2.port=9009
> worker.worker2.host=machine2domain
> worker.worker2.type=ajp13
>
> The host can just be machine domain names, doesnt have to be the full dns
> domain name
>
> Then in the jk file
>
> <IfModule !mod_jk.c>
> LoadModule jk_module "/path to/Apache2.2/modules/mod_jk.so"
> </IfModule>
>
> # the path to files
> JkWorkersFile conf/jk/workers.properties
> JkLogFile conf/jk/mod_jk.log
>
> JkLogLevel info
>
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
> JkRequestLogFormat "%w %V %T"
>
> # Then heres the link up between workers and servlets/jsps
>
> JkMount /thewebapp/theservletorjsp worker1
> JkMount /thewebapp_othermachine/theservletorjsp worker2
>
> Connectors and Apache config you have done already....
>
> If you add this to workers in the same way
>
> # Set STATUS MONITORING
> worker.jkstatus.type=status
>
> and this to jk
>
> JkMount /jkstatus jkstatus
>
> then you will also see the JK servlet, which help you do stuff, like stop
> and start workers.
>
> Something like the above... have fun
>
>
>
> ---------------------------------------------------------------------------
> HARBOR : http://www.kewlstuff.co.za/index.htm
> The most powerful application server on earth.
> The only real POJO Application Server.
> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
> ---------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: apache + mod_jk + two tomcat instance configuration
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message -----
From: "Jiansen Niu" <ao...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, June 01, 2008 2:58 AM
Subject: Re: apache + mod_jk + two tomcat instance configuration
> Hi John,
>
> Thanks for the comments. I did what you told me, but it does not work.
> here
> is what I did:
>
> workers.properties:
>
> workers.java_home=/usr/lib/jdk1.6.0_04
> #List workers
> worker.list=worker001,worker002
> #Define worker001
> worker.worker001.port=8009
> worker.worker001.host=localhost
> worker.worker001.type=ajp13
> worker.worker001.lbfactor=1
>
> #Define worker002
> worker.worder002.port=8010
> worder.worker002.host=localhost
> worker.worker002.type=ajp13
> worker.worker002.lbfactor=1
>
> httpd.conf:
>
> LoadModule jk_module modules/mod_jk.so
> # Where to find workers.properties
> JkWorkersFile /etc/httpd/conf/workers.properties
> # Where to put jk logs
> JkLogFile /etc/httpd/logs/mod_jk.log
> # Set the jk log level [debug/error/info]
> JkLogLevel warn
> # Select the log format
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
>
> virtual hosts:
> ##### for www.domain1.com -- by tomcat6.0.16
> <VirtualHost *:80>
> ServerAdmin admin@domain1.com
> DocumentRoot /usr/servers/apache-tomcat-6.0.16/webapps/www.domain1.com
> ServerName www.domain1.com
> ErrorLog logs/domain1_error_log
> JkMount /*.jsp worker001
> JkMount /*.do worker001
> </VirtualHost>
> ##### for cb.domain1.com -- by codebeamer's built in tomcat
> <VirtualHost *:80>
> ServerAdmin admin@domain1.com
> DocumentRoot /home/codebeamer/cb4/tomcat/webapps/cb
> ServerName cb.domain1.com
> ErrorLog logs/cb_error_log
> JkMount /*.* worker002
> JkMount /cb/*.* worker002
> </VirtualHost>
I think the mapping it too general....
I think at least include the webapp names... JkMount /thewebapp/*.jsp
worker001
etc
ie JkMount /*.* worker002
and this
JkMount /*.jsp worker001
means Apache just guesses which one you need... maybe ;)
> I have changed AJP1.3 connector's port from 8009 to 8010 in codebeamer's
> tomcat server.xml (worker002)
>
> Now, all my PHP applications works correctly from internet by enter their
> corresponding URL.
> The Java application can be accessed too by www.domain1.com
>
> but cb.domain1.com goes to the Java application under
> www.domain1.cominstead of codebeamer, I checked access logs,
> cb.domain1.com still forward request to tomcat6.0.16 by worker001.
> cb.domain1.com is a subdomain of www.domain1.com.
>
> Any idea why is this?
>
> Thanks again.
>
> Jiansen
>
>
>
> On Sat, May 31, 2008 at 7:33 AM, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
>>
>> ----- Original Message ----- From: "Jiansen Niu" <ao...@gmail.com>
>> To: <us...@tomcat.apache.org>
>> Sent: Saturday, May 31, 2008 8:35 AM
>> Subject: apache + mod_jk + two tomcat instance configuration
>>
>>
>>
>> I have apache2.0 as front end web server, using mod_jk and tomcat 6.0.16
>>> serve Java web applications.
>>> Now, I have couple PHP web applications and one Java Web application.
>>> The
>>> Java web application can
>>> be accessed by url www.domain1.com, workers.properties has something
>>> like
>>> this:
>>>
>>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>>> workers.java_home=/usr/lib/jdk1.6.0_04
>>> ps=/
>>> #List workers
>>> worker.list=worker001
>>> #Define worker001
>>> worker.worker001.port=8009
>>> worker.worker001.host=localhost
>>> worker.worker001.type=ajp13
>>> worker.worker001.lbfactor=1
>>>
>>> I want to install codebeamer (a java webapplication) to my server,
>>> codebeamer use a different version
>>> of tomcat as the one I'm using. I have to use its own tomcat since they
>>> customized it. I changed its
>>> port to 8081, shutdown port to 8006 which are different from my current
>>> tomcat server (8080 and 8005).
>>>
>>> My questions is, is it possible, I add another worker in the same
>>> workers.properties file, use different
>>> port number say 8010 and integrates my current Apache web server with
>>> codebeamer's tomcat, so I
>>> can access it by www.domain1.com/codebeamer? If possible what I should
>>> do
>>> with this line in
>>> workers.properties:
>>>
>>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>>>
>>
>>
>> Jiansen, Yes I think so
>> Something like this
>>
>> worker.list=worker1,worker2
>> # Set WORKER1
>> worker.worker1.port=8009
>> worker.worker1.host=machine1domain
>> worker.worker1.type=ajp13
>> # Set WORKER2
>> worker.worker2.port=9009
>> worker.worker2.host=machine2domain
>> worker.worker2.type=ajp13
>>
>> The host can just be machine domain names, doesnt have to be the full dns
>> domain name
>>
>> Then in the jk file
>>
>> <IfModule !mod_jk.c>
>> LoadModule jk_module "/path to/Apache2.2/modules/mod_jk.so"
>> </IfModule>
>>
>> # the path to files
>> JkWorkersFile conf/jk/workers.properties
>> JkLogFile conf/jk/mod_jk.log
>>
>> JkLogLevel info
>>
>> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
>> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>> JkRequestLogFormat "%w %V %T"
>>
>> # Then heres the link up between workers and servlets/jsps
>>
>> JkMount /thewebapp/theservletorjsp worker1
>> JkMount /thewebapp_othermachine/theservletorjsp worker2
>>
>> Connectors and Apache config you have done already....
>>
>> If you add this to workers in the same way
>>
>> # Set STATUS MONITORING
>> worker.jkstatus.type=status
>>
>> and this to jk
>>
>> JkMount /jkstatus jkstatus
>>
>> then you will also see the JK servlet, which help you do stuff, like stop
>> and start workers.
>>
>> Something like the above... have fun
>>
>>
>>
>> ---------------------------------------------------------------------------
>> HARBOR : http://www.kewlstuff.co.za/index.htm
>> The most powerful application server on earth.
>> The only real POJO Application Server.
>> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
>> ---------------------------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: apache + mod_jk + two tomcat instance configuration
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Jiansen... you actually have stuff configure that you dont need
like
worker.worker001.lbfactor=1
you not load balancing
and
DocumentRoot /usr/servers/apache-tomcat-6.0.16/webapps/www.domain1.com
you dont have to help JK find the webapps
I found an article for you
http://laxmangunjikar.wordpress.com/2008/01/07/multiple-instances-of-tomcat-with-apache/
Hope it helps
----- Original Message -----
From: "Jiansen Niu" <ao...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, June 01, 2008 2:58 AM
Subject: Re: apache + mod_jk + two tomcat instance configuration
> Hi John,
>
> Thanks for the comments. I did what you told me, but it does not work.
> here
> is what I did:
>
> workers.properties:
>
> workers.java_home=/usr/lib/jdk1.6.0_04
> #List workers
> worker.list=worker001,worker002
> #Define worker001
> worker.worker001.port=8009
> worker.worker001.host=localhost
> worker.worker001.type=ajp13
> worker.worker001.lbfactor=1
>
> #Define worker002
> worker.worder002.port=8010
> worder.worker002.host=localhost
> worker.worker002.type=ajp13
> worker.worker002.lbfactor=1
>
> httpd.conf:
>
> LoadModule jk_module modules/mod_jk.so
> # Where to find workers.properties
> JkWorkersFile /etc/httpd/conf/workers.properties
> # Where to put jk logs
> JkLogFile /etc/httpd/logs/mod_jk.log
> # Set the jk log level [debug/error/info]
> JkLogLevel warn
> # Select the log format
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
>
> virtual hosts:
> ##### for www.domain1.com -- by tomcat6.0.16
> <VirtualHost *:80>
> ServerAdmin admin@domain1.com
> DocumentRoot /usr/servers/apache-tomcat-6.0.16/webapps/www.domain1.com
> ServerName www.domain1.com
> ErrorLog logs/domain1_error_log
> JkMount /*.jsp worker001
> JkMount /*.do worker001
> </VirtualHost>
> ##### for cb.domain1.com -- by codebeamer's built in tomcat
> <VirtualHost *:80>
> ServerAdmin admin@domain1.com
> DocumentRoot /home/codebeamer/cb4/tomcat/webapps/cb
> ServerName cb.domain1.com
> ErrorLog logs/cb_error_log
> JkMount /*.* worker002
> JkMount /cb/*.* worker002
> </VirtualHost>
>
> I have changed AJP1.3 connector's port from 8009 to 8010 in codebeamer's
> tomcat server.xml (worker002)
>
> Now, all my PHP applications works correctly from internet by enter their
> corresponding URL.
> The Java application can be accessed too by www.domain1.com
>
> but cb.domain1.com goes to the Java application under
> www.domain1.cominstead of codebeamer, I checked access logs,
> cb.domain1.com still forward request to tomcat6.0.16 by worker001.
> cb.domain1.com is a subdomain of www.domain1.com.
>
> Any idea why is this?
>
> Thanks again.
>
> Jiansen
>
>
>
> On Sat, May 31, 2008 at 7:33 AM, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
>>
>> ----- Original Message ----- From: "Jiansen Niu" <ao...@gmail.com>
>> To: <us...@tomcat.apache.org>
>> Sent: Saturday, May 31, 2008 8:35 AM
>> Subject: apache + mod_jk + two tomcat instance configuration
>>
>>
>>
>> I have apache2.0 as front end web server, using mod_jk and tomcat 6.0.16
>>> serve Java web applications.
>>> Now, I have couple PHP web applications and one Java Web application.
>>> The
>>> Java web application can
>>> be accessed by url www.domain1.com, workers.properties has something
>>> like
>>> this:
>>>
>>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>>> workers.java_home=/usr/lib/jdk1.6.0_04
>>> ps=/
>>> #List workers
>>> worker.list=worker001
>>> #Define worker001
>>> worker.worker001.port=8009
>>> worker.worker001.host=localhost
>>> worker.worker001.type=ajp13
>>> worker.worker001.lbfactor=1
>>>
>>> I want to install codebeamer (a java webapplication) to my server,
>>> codebeamer use a different version
>>> of tomcat as the one I'm using. I have to use its own tomcat since they
>>> customized it. I changed its
>>> port to 8081, shutdown port to 8006 which are different from my current
>>> tomcat server (8080 and 8005).
>>>
>>> My questions is, is it possible, I add another worker in the same
>>> workers.properties file, use different
>>> port number say 8010 and integrates my current Apache web server with
>>> codebeamer's tomcat, so I
>>> can access it by www.domain1.com/codebeamer? If possible what I should
>>> do
>>> with this line in
>>> workers.properties:
>>>
>>> workers.tomcat_home= /usr/local/apache-tomcat-6.0.16
>>>
>>
>>
>> Jiansen, Yes I think so
>> Something like this
>>
>> worker.list=worker1,worker2
>> # Set WORKER1
>> worker.worker1.port=8009
>> worker.worker1.host=machine1domain
>> worker.worker1.type=ajp13
>> # Set WORKER2
>> worker.worker2.port=9009
>> worker.worker2.host=machine2domain
>> worker.worker2.type=ajp13
>>
>> The host can just be machine domain names, doesnt have to be the full dns
>> domain name
>>
>> Then in the jk file
>>
>> <IfModule !mod_jk.c>
>> LoadModule jk_module "/path to/Apache2.2/modules/mod_jk.so"
>> </IfModule>
>>
>> # the path to files
>> JkWorkersFile conf/jk/workers.properties
>> JkLogFile conf/jk/mod_jk.log
>>
>> JkLogLevel info
>>
>> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
>> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>> JkRequestLogFormat "%w %V %T"
>>
>> # Then heres the link up between workers and servlets/jsps
>>
>> JkMount /thewebapp/theservletorjsp worker1
>> JkMount /thewebapp_othermachine/theservletorjsp worker2
>>
>> Connectors and Apache config you have done already....
>>
>> If you add this to workers in the same way
>>
>> # Set STATUS MONITORING
>> worker.jkstatus.type=status
>>
>> and this to jk
>>
>> JkMount /jkstatus jkstatus
>>
>> then you will also see the JK servlet, which help you do stuff, like stop
>> and start workers.
>>
>> Something like the above... have fun
>>
>>
>>
>> ---------------------------------------------------------------------------
>> HARBOR : http://www.kewlstuff.co.za/index.htm
>> The most powerful application server on earth.
>> The only real POJO Application Server.
>> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
>> ---------------------------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org