This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat + Apache first time" Watch "Tomcat + Apache first time" New topic

Tomcat + Apache first time

Keith Fiske

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:

LoadModule jk_module /usr/lib/apache2/modules/

# Where to find
JkWorkersFile /etc/apache2/mods-enabled/

# 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"

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


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

# Defining a load balancer


# Define status worker


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


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

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

JkMountFile /etc/apache2/mods-enabled/
I agree. Here's the link:
subject: Tomcat + Apache first time
It's not a secret anymore!