| Author |  | 
| doyledp 
 
 
 Joined: 20 Jul 2006
 Posts: 3
 
 
 | 
|  Posted: Thu 20 Jul '06 18:25    Post subject: Problem with mod_jk.so |   |  
| 
 |  
| Hi. 
 I have just set up a new configuration
 
 Windows XP SP2
 Apache 2.2.2
 PHP 5.2.0-dev
 Apache Tomcat 5.5.17
 
 I am new to configuring apache and tomcat. But I wan't to use the mod_jk approach to not having to use port numbers in requests for tomcat. In other words use:
 http://localhost/jsp-examples/jsp2/el/basic-arithmetic.jsp
 instead of
 http://localhost:8080/jsp-examples/jsp2/el/basic-arithmetic.jsp
 I got this working fine by:
 
 
 
1. Adding mod_jk.so to C:\Program Files\Apache Software Foundation\Apache2.2\modules.
 
 2. Add the following to the end of Apache httpd.conf file.
 
 Include "C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\auto\mod_jk.conf"
 
 4. Add the following line to the server.xml file before “<Host name=”localhost” appBase=”webapps” in C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf.
 
 <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
 
 <Listener className="org.apache.jk.config.ApacheConfig" modJk="C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_jk.so" />
 
 5. Create a new text file called workers2.properties and paste the following into it. Save this file in the following directory:
 
 C:\Program Files\Apache Software Foundation\Apache2.2\conf
 [logger]
 level=DEBUG
 file=C:/Program Files/Apache Software Foundation/Apache2.2/logs/jk2.log
 [config]
 file=C:/Program Files/Apache Software Foundation/Apache2.2/conf/workers.properties
 debug=0
 debugEnv=0
 
 
 [shm]
 file=C:/Program Files/Apache Software Foundation/Apache2.2/logs/jk2.shm
 size=1048576
 
 # socket channel
 [channel.socket:localhost:8009]
 port=8009
 host=127.0.0.1
 
 # worker for the connector
 [ajp13:localhost:8009]
 channel=channel.socket:localhost:8009
 
 [status:status]
 
 [uri:/status/*]
 worker=status:status
 
 [uri:/jsp-examples/*]
 worker=ajp13:localhost:8009
 
 [uri:/*.jsp]
 worker=ajp13:localhost:8009
 
 
 The problem occurs when I use a domain name. For example if I use
 http://name.homeip.net/jsp-examples/jsp2/el/basic-arithmetic.jsp
 I see the original jsp source, however if I use
 http://name.homeip.net:8080/jsp-examples/jsp2/el/basic-arithmetic.jsp
 It works fine.
 
 I have tried loads of things including adding the following to my workers2.properties file.
 
 [uri:donal.homeip.net/jsp-examples/*]
 worker=ajp13:donal.homeip.net:8009
 
 [uri:donal.homeip.net/*.jsp]
 worker=ajp13:donal.homeip.net:8009
 
 In case it might make a difference my computer is a home computer. And I am using dyndns to map the url donal.homeip.net to my ip address. The requests are being forwarded through a Linksys WRT54GS Router, by enabling port forwarding for ports 80 and 8080 to the internal ip of my pc.
 |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 |  | 
| Back to top |  | 
| doyledp 
 
 
 Joined: 20 Jul 2006
 Posts: 3
 
 
 | 
|  Posted: Thu 20 Jul '06 18:49    Post subject: |   |  
| 
 |  
| Thanks for the prompt reply. 
 I have enabled the mod_proxy_ajp by changing the line
 #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 to
 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 in httpd.conf.
 
 Can restart apache then.
 
 Where would I add the following lines to my configuration
 
 ProxyPass /jsp-examples ajp://127.0.0.1:8009/jsp-examples
 ProxyPassReverse /jsp-examples ajp://127.0.0.1:8009/jsp-examples
 
 If I add it to httpd.conf, apache can't restart
 |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 | 
|  Posted: Thu 20 Jul '06 18:56    Post subject: |   |  
| 
 |  
| When you run Apache in a DOS box you can see the startup-errors. 
 Did you enable: LoadModule proxy_module modules/mod_proxy.so ?
 |  | 
| Back to top |  | 
| doyledp 
 
 
 Joined: 20 Jul 2006
 Posts: 3
 
 
 | 
|  Posted: Thu 20 Jul '06 19:04    Post subject: |   |  
| 
 |  
| Got it working. 
 The problem was that I forget to enable LoadModule proxy_module modules/mod_proxy.so
 
 Thanks a million for your help. Have been looking all over the web for hours. Was looking for the wrong things. Learnt a lot today.
 
 Is there any security issues I should consider as a result of using the proxy method?
 |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 | 
|  Posted: Thu 20 Jul '06 19:21    Post subject: |   |  
| 
 |  
| A million ? So much donation ?   
 Be sure to set: ProxyRequests Off
 
 Indeed using mod_jk can be a hassle. Mod_proxy_ajp is new in Apache 2.2 .
 
 Steffen
 |  | 
| Back to top |  | 
| mphare 
 
  
 Joined: 12 May 2006
 Posts: 43
 Location: Texas
 
 | 
|  Posted: Thu 20 Jul '06 19:34    Post subject: |   |  
| 
 |  
| I'll have to check out mod_proxy_ajp. 
 I'm using Apache 2.2.2 with Tomcat 5.5.17 using mod_jk.
 
 This is my addition to httpd.conf
 
  	  | Code: |  	  | <IfModule !mod_jk.c> LoadModule jk_module modules/mod_jk.so
 JkWorkersFile "C:/Programs/ApacheGroup/Apache2.2/conf/workers.properties"
 JkMount /jsp-examples/* worker1
 JkMount /servlets-examples/* worker1
 JkMount /axis2/* worker1
 JkMount /exist/* worker1
 </IfModule>
 
 | 
 
 Here is my workers.properties
 
  	  | Code: |  	  | # Define 1 real worker using ajp13 worker.list=worker1
 # Set properties for worker1 (ajp13)
 worker.worker1.type=ajp13
 worker.worker1.host=localhost
 worker.worker1.port=8009
 worker.worker1.lbfactor=50
 worker.worker1.cachesize=10
 worker.worker1.cache_timeout=600
 worker.worker1.socket_keepalive=1
 worker.worker1.recycle_timeout=300
 
 | 
 
 I don't believe I had to modify any other file (server.xml)
 
 I haven't noticed any problems using domains.
 |  | 
| Back to top |  | 
| Jorge 
 
 
 Joined: 12 Mar 2006
 Posts: 376
 Location: Belgium
 
 | 
|  Posted: Thu 20 Jul '06 19:44    Post subject: |   |  
| 
 |  
| would 
  	  | Code: |  	  | <FilesMatch *jsp> ProxyPass / ajp://127.0.0.1:8009/
 ProxyPassReverse / ajp://127.0.0.1:8009/
 </FilesMatch>
 | 
 
 Work aswel ? to only forward *.jsp files?
 |  | 
| Back to top |  |