[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to connect Apache2 to Tomcat4?



On Mon, Mar 01, 2004 at 02:04:15PM -0800, Joe Emenaker wrote:
> Is anyone else using Apache2 with Tomcat4?
> 
> I've been trying to find an appropriate connector to use between them. 
> I've found references on Google to things like libapache2-mod-jk2, 
> libapache2-mod-webapp, or libapache2-mod-jk, but I haven't been able to 
> find any of them in stable or unstable... and I can't even find anything 
> at www.apt-get.org.
> 
> It seems that my only two options are to:
> 1 - Tell Apache to do a Redirect for anything involving .jsp to 
> Tomcat's HTTP port (which, if it didn't cause other problems, would 
> cause my Apache logs to be missing most of the webapp traffic... since 
> the logs would have the initial redirect, but not the traffic after that).
> 2 - Go compile libapache-mod-jk2 or libapache-mod-webapp by hand, which 
> is likely to be a bigger pain in the butt than I want to bother with.
> 
> I'm eagerly waiting for a third option.

Option 3: Use Apache2's mod_rewrite and mod_proxy to act as a proxy
between the 2.  Generally I set up tomcat to listen on localhost only,
then using mod_rewrite I pass the headers on to tomcat from apache,
seems to work quite nicely (and tomcat appears to start a heck of a lot
faster without the jk connector).

Very Quick and Dirty Method:
<VirtualHost blah>
RewriteEngine on
ProxyPreserveHost on
RewriteRile ^/(.*\.jsp) http://localhost:8180/$1 [P] [L]
ProxyPassReverse / http://localhost:8180/
</VirtualHost>

Hope that helps,

Cheers
-- 
Brett Parker



Reply to: