GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Tomcat + Apache first time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat + Apache first time" Watch "Tomcat + Apache first time" New topic
Author

Tomcat + Apache first time

Keith Fiske
Greenhorn

Joined: Jun 27, 2007
Posts: 23
Trying to get Apache and Tomcat set up together for the first time. I've used them separately with different projects before without problems, but now I've got to get things set up so all web pages are served through Apache.

I've downloaded mod_jk and been trying to follow the instructions on Apache's website for getting them working together but not having much luck. I think I'm just not understanding how to configure the URI mappings to point specific websites/files in Apache to Tomcat. I've got quite a few php websites set up with Virtual Hosting in Apache already and they're working fine. All my website data is in /var/www/ and I'd like to keep the sites requiring JSP in the same location instead of $TOMCAT_HOME/webapps.

I'm running Ubuntu 6.06 LTS Server and am using the Debian mod/conf file configuration they've adopted. My configuration files are below. I just copied the sample configuration files that came with the mod-jk source code and modified them for my site. Currently whenever I try and load a JSP page, I'm getting redirected to the Tomcat server properly, but I'm getting 404 errors saying the files don't exist when I know they do.

Any help getting me on the right track would be appreciated!

My files:

mod-jk.load:
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

-----------
mod-jk.conf:
# Where to find workers.properties
JkWorkersFile /etc/apache2/mods-enabled/workers.properties

# Where to put jk shared memory
JkShmFile /var/run/apache2/jk.shm

# Where to put jk logs
JkLogFile /var/log/apache2/mod_jk.log
# [debug/error/info]
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"

-----------
workers.properties:
# workers.properties.minimal -
#
# This file provides minimal jk configuration properties needed to
# connect to Tomcat.
#
# The workers that jk should create and work with
#

worker.list=wlb,jkstatus

#
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009

#
# Defining a load balancer
#

worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w

#
# Define status worker
#

worker.jkstatus.type=status


-----------
uriworkermap.properties
# uriworkermap.properties
#
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]

/*.jsp=wlb
/!*.html=wlb

#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkmanager=jkstatus

-----------
Line added to my Virtual Host config file for this site in Apache:

JkMountFile /etc/apache2/mods-enabled/uriworkermap.properties
 
GeeCON Prague 2014
 
subject: Tomcat + Apache first time