tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Apache 2.2.3 Tomcat 5.5.20 - mod_jk or proxy?
Date Thu, 16 Nov 2006 14:28:02 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael,

michael@trollope.org wrote:
> All I can say is that I googled around extensively, trying to learn
> how to set up Tomcat 5.5 with Apache 2.2 as the front end, and found
> many sites saying to stay away from mod_jk, along with mailing list
> messages about the problems people were having with it.

I have no idea why so many people have problems with mod_jk. I have
never had a single problem with it. It's stupid simple to install:

1. Download and untar (gnu tar!)
2. $cd native
3. ./configure --with-apxs=/path/to/apxs
4. make
5. make install (as root)

It works for me every time. Setup is slightly more complex, because you
need to have a "workers" file (but you can avoid that in recent versions
of mod_jk) which trips some folks up.

> It goes
> without saying, that when you have to depend on mailing list messages
> for documentation of any problem, you have a high likelihood of
> getting it wrong.

This list is highly active, and with Rainer Jung on the list (who knows
more than anyone really should about mod_jk ;) ), you should always be
able to get good advise.

> Especially when you are under the gun and trying to
> complete a project and not wanting to spend all this time figuring out
> how to do what ought to be quite straightforward.

Agreed. At this point, since it's been a few days, you have probably
tried something already. What did you try and how did it go?

> The Apache Software Foundation produces some of the best and most
> useful software in the world.  They simultaneously produce some of the
> worst user documentation for that software.

I completely agree. Many software developers are simply terrible
writers. It's not their fault, it's just the truth. Most folks who get
into OSS are coders because, well, software is the name of the game.
There aren't too many professors of literature on these projects ;)

> If you want to achieve a
> shortlived feeling of amazement, go to http://www.apache.org and
> search for the expression mod_jk.  You'll get four hits for
> mod_proxy.  Now search for "mod_jk" (with quotation marks).  You'll
> get two mailing list messages from the httpd mailing list.  I can but
> shake my head.

Aah. I think the problem is that you were searching www.apache.org,
instead of the Tomcat-related pages. Yes, mod_jk is an Apache httpd
module, but it's a non-standard module (that is, it isn't bundled with
the source or binary distributions). It should be considered a 3rd-party
module.

Essentially all information about mod_jk is available through the Tomcat
website, not www.apache.org. Sorry about that. :(

> Well, good luck.  I wanted to set up Apache 2.2 with Tomcat 5.5, to
> proxy user directories (/home/user/public_html) with Apache to serve
> static content and Tomcat to serve JSP/servlets.  Nothing.
> Zip. Nada.  I know I'm not the only person that ever wanted to do
> this.  But I could not find documentation anywhere.  Hell, I'd buy the
> book if there was one available.

I had the same experience. One of the engineers on my team decided to
install all the latest versions of everything on his dev environment
instead of matching production. That meant using Apache httpd 2.2
instead 2.0, and he pointed out that somewhere, there was the wild-ass
claim that mod_proxy_ajp was the way to connect to Tomcat in 2.2.

Well, we looked for documentation on how to connect them and it just
doesn't exist. Just a lot of people saying "yeah, yeah... use
mod_proxy_ajp". mod_proxy_ajp has (or at least had) no documentation
whatsoever and so you have to read all about mod_proxy. No problem. You
read all about mod_proxy and it's all about proxying HTTP, not ajp13.
So, on a hunch, I simply changed the example do something like this:

Proxy /someURI ajp13://localhost/someOtherURI

and it worked. Lucky guess without any indication from the mod_proxy
documentation that this was even possible.

After getting that simple thing set up, we tried some of our more exotic
configuration settings. For instance, we have /most/ of our webapp's
URIs going to one worker (Tomcat running our app), but some of them need
to go to another worker (Cocoon running in a separate Tomcat instance).
It appears that mod_proxy only supports blindly proxying everything in a
particular URL space, so we were out of luck.

Not to be beaten by mod_proxy, we came up with a solution that involved
re-writing the URIs using mod_rewrite so that the URL was outside of the
URI space of the webapp, and then proxying it appropriately. Something
like this (forgive the completely incorrect syntax):

RewriteRule /myApp/something/special -> /outside/something/special

Proxy /myApp ajp13://localhost:8185/myApp
Proxy /outside ajp13://localhost:8285/myApp

Since we had like a dozen special URIs like this, we had re-writes all
over the place. When we looked at the final configuration, we both
nearly vomited and just went back to using mod_jk, which does patch
matching.

I hope this gives you some more insight into why I prefer mod_jk and why
I think doesn't deserve the bogeyman reputation it has.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFXHVy9CaO5/Lv0PARAgSLAJ9eYM4vZjMrQXTY5HX7hDMmUHY9swCgrAgh
N6+ycSaSQYeg7bhNbee0cQQ=
=c+ce
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message