Configuring mod_jk for Apache and Tomcat

tequnix at frogmi.net tequnix at frogmi.net
Tue Feb 19 16:20:49 UTC 2008


Am Tue, 19 Feb 2008 14:33:35 +1000
schrieb Da Rock <rock_on_the_web at comcen.com.au>:


> OK. Tomcat is working- I managed to find out how to get direct access to
> it (had to uncomment a line in server.xml, web.xml). Still  no Apache /
> Tomcat connector though. If I navigate to /webapps it says 404 -
> although this says the error comes from Apache Tomcat6. Is it the
> connector config I need to play with or the Tomcat? In either case, what
> do I need to change?
> 
> I found through a search that older versions of Tomcat need to have a
> listener line in the server.xml. Is this true for Tomcat6?

There are two separate things to do:
 * configure the connector in tomcats server.xml
 * make apache aware of tomcats contexts (how this needs to be done
depends on which connector you use)

here is the relevant snippet from my server.xml (works with tomcat6
and tomcat5.*):
[..]
  <Service name="Tomcat-Apache">
  
   <Connector address="127.0.0.1" redirectPort="8009" protocol="AJP/1.3" enableLookups="true" debug="1"/>         
    <Engine name="Apache" defaultHost="localhost" debug="3">
                        
    <Host name="localhost" debug="0" appBase="webapps">
    
      <Alias>somename</Alias>
      
      <Context path="/a_wepapp" reloadable="true" 
               docBase="/path/to/that/webapp" />      
           
    </Host>
    </Engine>
  </Service>
[..]


for the httpd.conf and with mod_jk you need something like that:
[..]
JkMount /a_wepapp/* ajp13
[..]

(if you have mappings in your web.xml. if you want to use the
"invoker" servlet and skip mappings in your web.xml, you may remove the
comments around that part in the tomcat/config/web.xml and use
JkMount /a_wepapp/servlet/* ajp13
instead)

some time ago i switched from mod_jk to apaches proxy_ajp modul (as i
find it easier to maintain), the part for the httpd.conf would look like:

[..]
LoadModule proxy_ajp_module   libexec/apache22/mod_proxy_ajp.so

ProxyPass /a_wepapp       ajp://127.0.0.1:8009/a_wepapp
[..]


HTH,
reinhard


More information about the freebsd-questions mailing list