Configuring mod_jk for Apache and Tomcat

James oscartheduck at gmail.com
Tue Feb 19 01:07:17 UTC 2008


On Tue, 2008-02-19 at 10:54 +1000, Da Rock wrote:
> I'm trying to setup a tomcat server using Apache as the frontend. As
> usual, I'm having trouble (which is why I haven't bothered before, and
> given Tomcat apps a wide berth). Can someone let me know where I'm going
> wrong? I have setup inclusions in the httpd.conf file to use similar
> settings to other modules, etc. Therefore my worker.properties and
> mod_jk.conf is under /extras.
> 
> I know something works because they are reflected when I navigate
> to /webapps on the Apache server.
> 
> mod_jk.conf:
> # Replace jsp-hostname with the hostname of your JSP server, as
> # specified in workers.properties.
> #
> <IfModule mod_jk.c>
>         JkWorkersFile etc/apache22/extra/workers.properties
>         JkLogFile  /var/log/jk.log
>         JkShmFile  /var/log/jk-runtime-status
>         JkLogLevel error
> 
>         # Sample JkMounts.  Replace these with the paths you would
>         # like to mount from your JSP server.
>         JkMount /*.jsp localhost
>         JkMount /servlet/* localhost
>         JkMount /examples/* localhost
> </IfModule>
> 
> # Map encoded urls
> <Location *;jsessionid=>
>         SetHandler jakarta-servlet
> </Location>
> 
> # Map subdirectory
> <Location /webapps/>
>         SetHandler jakarta-servlet
> </Location>
> 
> 
> 
> workers.properties:
> # Incredibly simple workers.properties file, intended for connecting
> # to one host, via AJP13.  See the tomcat documentation for
> # information on more exotic configuration options.
> #
> # Change jsp-hostname to the hostname of your JSP server.
> #
> worker.list=localhost
> workers.tomcat_home=/usr/local/apache-tomcat6.0
> workers.java_home=/usr/local/diablo-jdk1.5.0
> worker.localhost.port=8009
> worker.localhost.host=localhost
> worker.localhost.type=ajp13
> worker.localhost.lbfactor=1
> 
> 
> I figured I didn't need to worry about the setenv variable as I'm only
> testing currently and only need one connector atm.
> 
> Any ideas why I shouldn't be seeing the index.jsp found in the Tomcat
> directories?
> 
> I also tried navigating directly using port 8009 with no result either
> (And yes, Tomcat has been started- I checked the port using nmap).
> 


The two things I always screw up: permissions and DNS. If
your /etc/hosts isn't set up properly, and/or hosts.conf's URL entries
aren't correct, weird weird errors can happen. If something is set to
444 instead of 755 (as appropriate), other weirdnesses occur.

Are you using a www user? Make sure they're added as appropriate for the
file. 

I know *none* of this may be helpful, but I always check those and I've
usually screwed one up. Otherwise, is there anything
in /var/log/httpd-error?



More information about the freebsd-questions mailing list