You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hari Om <ha...@hotmail.com> on 2004/03/24 15:51:42 UTC

[users@httpd] RE: Apache+Tomcat + MOD_JK on different machine

Thanks again Randall and Henry for your reply... appreciate that!

When I try http://my_web_server/abc, it shows "HTTP 400-Bad Request"
BUT when I try http://my_web_server/pqr, it shows "HTTP 404 - File Not 
Found"
BUT when I try http://my_web_server, it works fine...which means that APACHE 
IS NOT SENDING THE REQUEST to TOMCAT....wonder why.

I've added workers.properties in my conf directory on Web Server.
I also have MOD_JK.CONF file there.

--------------------
WORKERS.PROPERTIES
--------------------
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=102.103.103.1
#the above is IP of my App Server
worker.ajp13.type=ajp13

--------------------
mod_jk.conf
--------------------
  Include "conf/mod_jk.conf"
  JkWorkersFile "conf/workers.properties"
  Include "conf/mod_jk.conf"
  JkLogFile "logs/mod_jk.log"
  JkLogLevel debug
  JkMount /examples ajp13
  JkMount /examples/* ajp13
  JkMount /abc ajp13
  JkMount /abc/* ajp13

--------------------
HTTPD.CONF
--------------------
  JkWorkersFile "conf/workers.properties"
  JkLogFile "logs/mod_jk.log"
  JkLogLevel debug
  JkMount /examples ajp13
  JkMount /examples/* ajp13
  JkMount /abc ajp13
  JkMount /abc/* ajp13



	 	From: "Randall Svancara" <rs...@adaweb.net>
To: "Hari Om" <ha...@hotmail.com>,"Tomcat Users List" 
<to...@jakarta.apache.org>
Subject: RE: Apache+Tomcat + MOD_JK on different machine
Date: Tue, 23 Mar 2004 09:21:36 -0700

Your workers.properties should be on your webserver where apache is located. 
  I typically place the workers.properties in the same directory where 
httpd.conf is located.

workers.properties is needed for mod_jk so it makes sense that it needs to 
be in the same machine where mod_jk and apache are installed.  At least far 
as I know anyways. Sometimes apache has a difficult time finding it.  I have 
used this line to tell apache where to find the workers.properties.  You 
might try
including a line like this in your apache configuration file:


<IfModule mod_jk.c>
  JkSet config.file /etc/apache2/conf/workers.properties
  Include /etc/apache2/conf/mod_jk2.conf
</IfModule>

If anyone else has anything to add to this or correct me on, please feel 
free because I am still learning to, but then again who isn't??
I hope that helps.

-----Original Message-----
From: Hari Om [mailto:hari_om@hotmail.com]
Sent: Tuesday, March 23, 2004 8:56 AM
To: tomcat-user@jakarta.apache.org
Cc: Randall Svancara
Subject: RE: Apache+Tomcat + MOD_JK on different machine


Thanks Randall for your reply... appreciate that!

My MOD_JK.CONF file is AUTOGENERATED on my AppServer. I start my App Server
FIRST which AUTOGENERATES "mod_jk.conf" file. So, how can I reference this
file on my HTTPD.CONF ("Include conf/mod_jk.conf") - which is indeed located
on a different machine?

Where should I place my workers.properties? should it be on App Server or
Web Server?

Should I first start App Server or Web Server or it does'nt matter?

In my HTTPD.CONF I have different mount points (example 'abc') so when I
type http://IPADDRESS/abc it shows "HTTP 400 Bad Request" on my browser
Howevere, when I type http://IPADDRESS/lmn it shows "HTTP 404 Page Not
Found" (Note: lmn is not added a JKMount in my Httpd.conf)

My MOD_JK.log file shows it added all the JKMounts.
My ACCESS_LOG file shows:
[23/Mar/2004:08:44:05 -0700] "GET /abc HTTP/1.1" 400 0
[23/Mar/2004:08:50:24 -0700] "GET /lmn HTTP/1.1" 404 301


My ERROR_LOG file shows:
[Tue Mar 23 08:41:46 2004] [notice] Apache/2.0.47 (Unix) mod_jk/1.2.2
configured -- resuming normal operations

Any related information on above is appreciated.

THANKS again!

HARI OM



>From: "Randall Svancara" <rs...@adaweb.net>
>Reply-To: "Tomcat Users List" <to...@jakarta.apache.org>
>To: "Tomcat Users List" <to...@jakarta.apache.org>
>Subject: RE: Apache+Tomcat + MOD_JK on different machine Date: Tue, 23 Mar
>2004 08:15:40 -0700
>
>I would leave your httpd.conf file the same as  you have it shown below.  I
>would also confirm in you logs that everything is working ok.  However,
>Apache should not even startup if the included configuration file,
>mod_jk.conf is not present.
>
>------------------------------
>httpd.conf (on Web Server)
>------------------------------
>LoadModule jk_module modules/mod_jk.so
>ServerName xyz.com
>
>Include conf/mod_jk.conf
>
>JkWorkersFile "conf/workers.properties"
>JkLogFile "logs/mod_jk.log"
>
>JkLogLevel debug
>
>JkMount /examples ajp13
>JkMount /examples/* ajp13
>
>
>The trick here is to make some changes to your workers.properties in order
>to connect to another box.
>It looks as if your are trying to configure a load balancer.  If you are
>connecting to only one instance
>of tomcat this is not necessary.  Also you need to look in your server.xml
>and see that you have the coyote connector
>running on port 8009.  I would exclude the line: worker.ajp13.lbfactor=5
>from this configuration.  Besides, you have not defined
>a worker for load balancer, so i believe this line is not necessary.
>I would probably write your workers.properties files the following way:
>
>------------------------------------
>workers.properties (on Web Server)
>------------------------------------
>
>workers.CATALINA_HOME=/usr/local/tomcat4
>workers.java_home=$(JAVA_HOME)
>ps=/
>
>worker.list=ajp13
>worker.ajp13.port=8009
>worker.ajp13.host=101.102.103.104
>#above is IP address of abc.com
>worker.ajp13.type=ajp13
>#Remove the following line.
>#worker.ajp13.lbfactor=5
>
>
>
>I am going to send you my workers.properties for reference.  IF AND ONLY IF
>you do configure a load balancer, then make sure in your server.xml to
>change following line from:
>  <Engine name="Standalone" defaultHost="localhost" debug="0">
>
>to
>
>  <Engine name="Standalone" defaultHost="localhost" debug="0"
>jvmRoute="worker2" >
>This is necessary for load balancing.  The value of jvmRoute should be
>equal to the worker that you want to connect to that particular instance of
>tomcat.
>
>
>#*****Begin worker.properties*****
>#
>worker.worker2.type=ajp13
>worker.worker1.type=ajp13
>#
>#Specifies the load balance factor when used with a load balancing worker.
>#Note:
>#-----> lbfactor must be > 0
>#-----> Low lbfactor means less work done by the worker.
>#
>worker.worker1.lbfactor=1
>worker.worker2.lbfactor=10
>#
>#Specify the size of the open connection cache.
>#worker.ajp13.cachesize
>#
>#------DEFAULT LOAD BALANCER WORKER DEFINITION-----------
>#
>#The loadbalancer (type lb) worker perform weighted round-robin
>#load balancing with sticky sessions.
>#Note:
>#---> If a worker dies, the load balancer will check its state once
>#in a while. Until then all work is redirected to peer worker.
>#
>worker.loadbalancer.type=lb
>worker.loadbalancer.balanced_workers=worker2,worker1
>#
>#worker.tomcat_home should point to the location where you installed
>#tomcat. This is where you have your conf, webapps and lib directories.
>#Note: Please make sure to enter the appropriate path from your machine.
>#
>worker.tomcat_home=/usr/local/tomcat
>#
>#worker.java_home should point to your Java installation.
>#Normally you should have a bin and lib directories beneath it.
>#Note: Please make sure to enter the appropriate path from your machine.
>#
>worker.java_home=/usr/local/java
>#
>#You should configure your environment slash...ps=\on NT and / on UNIX
>#and may be different elsewhere.
>#
>ps=/
>#-------ADVANCED MODE-------
>#------------------------------
>#
>#
>#-------DEFAULT worker list------
>#----------------------------------
>#
>#The worker that your plugins should create and work with
>#
>worker.list=worker2,loadbalancer, worker1
>#
>#----DEFAULT ajp13 WORKER DEFINITION-----
>#
>#Defining a worker named ajp13 and of type ajp13
>#Note that the name and the type do not have to match.
>#
>worker.worker2.port=8009
>worker.worker2.host=localhost
>worker.worker2.cachesize=100
>worker.worker2.cache_timeout=1000
>worker.worker2.socket_keepalive=3
>worker.worker2.socket_timeout=1000
>
>worker.worker1.port=8019
>worker.worker1.host=216.222.102.252
>worker.worker1.cachesize=100
>worker.worker1.cache_timeout=1000
>worker.worker1.socket_keepalive=3
>worker.worker1.socket_timeout=1000
>
>#
>#*****End worker.properties*****
>
>
>
>
>
>
>
>
>------------------------------------
>workers.properties (on Web Server)
>------------------------------------
>
>workers.CATALINA_HOME=/usr/local/tomcat4
>workers.java_home=$(JAVA_HOME)
>ps=/
>
>worker.list=ajp13
>worker.ajp13.port=8009
>worker.ajp13.host=101.102.103.104
>#above is IP address of abc.com
>worker.ajp13.type=ajp13
>worker.ajp13.lbfactor=5
>
>
>
>-----Original Message-----
>From: Hari Om [mailto:hari_om@hotmail.com]
>Sent: Tuesday, March 23, 2004 7:58 AM
>To: users@httpd.apache.org; tomcat-user@jakarta.apache.org
>Subject: Apache+Tomcat + MOD_JK on different machine
>
>
>SUBJECT: Apache+Tomcat + MOD_JK on different machine
>
>I am using Apache 2.0.47 and Tomcat 4.1.27 on my SuSE Linux. I had
>configured my mod_jk and it works just great! (My Web and App Server were
>on
>same box)
>
>Now I have a Web Server and App Server on a different box and was wondering
>what changes do I have to make to "MOD_JK" for the Integration to work.
>
>My old settings were:
>----------
>httpd.conf
>----------
>LoadModule jk_module modules/mod_jk.so
>ServerName abc.com
>
>Include /usr/local/tomcat4/conf/auto/mod_jk.conf
>
>JkWorkersFile "/usr/local/apa2047/conf/workers.properties"
>JkLogFile "/usr/local/apa2047/logs/mod_jk.log"
>
>JkLogLevel debug
>
>JkMount /examples ajp13
>JkMount /examples/* ajp13
>
>--------------------
>workers.properties
>--------------------
>
>workers.CATALINA_HOME=/usr/local/tomcat4
>workers.java_home=$(JAVA_HOME)
>ps=/
>
>worker.list=ajp13
>worker.ajp13.port=8009
>worker.ajp13.host=101.102.103.104
>#above is IP address of abc.com
>worker.ajp13.type=ajp13
>worker.ajp13.lbfactor=5
>
>
>Now that I have both APACHE and TOMCAT on DIFFERENT Boxes, I was wondering
>what changes do I have to make for the above to work.
>
>My Web Server is "xyz.com" and my App Server is "abc.com". I have mod_jk
>configured in my Web Server.
>
>My new HTTPD.CONF file is:
>My NEW settings are:
>------------------------------
>httpd.conf (on Web Server)
>------------------------------
>LoadModule jk_module modules/mod_jk.so
>ServerName xyz.com
>
>Include conf/mod_jk.conf
>
>JkWorkersFile "conf/workers.properties"
>JkLogFile "logs/mod_jk.log"
>
>JkLogLevel debug
>
>JkMount /examples ajp13
>JkMount /examples/* ajp13
>
>------------------------------------
>workers.properties (on Web Server)
>------------------------------------
>
>workers.CATALINA_HOME=/usr/local/tomcat4
>workers.java_home=$(JAVA_HOME)
>ps=/
>
>worker.list=ajp13
>worker.ajp13.port=8009
>worker.ajp13.host=101.102.103.104
>#above is IP address of abc.com
>worker.ajp13.type=ajp13
>worker.ajp13.lbfactor=5

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org