Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: mod_proxy moc_proxy_ajp issue |
|
Author |
|
tk
Joined: 27 Jun 2006 Posts: 10
|
Posted: Wed 28 Jun '06 11:33 Post subject: mod_proxy moc_proxy_ajp issue |
|
|
Ok, for starters Thank You to Steffen for pointing me towards mod_proxy. I'm embarrassed to admit that I spent three days trying to get mod_jk to work and came up empty. I've never felt so stupid in all my life. But, at least with mod_proxy I now at least have a functional basis. Having read through the Apache docs on mod_proxy and mod_proxy_ajp I'm still left with a few questions that I hope can be answered here.
I'm currently using a simple ProxyPassReverse at the directory level ie
ProxyPassReverse /jsp-examples ajp://xxx.x.x.x:8009/jsp-examples
And that works very well. What I would like to do is to simply forward all .jsp files to the tomcat server but I'm at a loss as to how. It seems that the only solution offered by mod_proxy is to actually put the files on the tomcat server. The problem then becomes one of a site with some .htm or .php files, and some .jsp files. I would, essentially, have to use tomcat for all of these at which point there is no reason to have Apache at all. I guess what I'm looking for is some sort of AddType type of thing that would allow me to have my .jsp files stored in htdocs with all of my other pages, but still have them compiled and executed by tomcat. I've tried various incarnations of
ProxyPassReverse /.jsp ajp://xxx.x.x.x:8009/.jsp
but, unless I misunderstand mod_proxy entirely what this is saying is that when a user requests somefile.jsp from Apache it just forwards the request to tomcat, which then looks for somefile.jsp in it's own webapps directory. Not at all what I need. So the question, I guess, is how to store my .jsp files in htdocs and have them compiled and executed by tomcat. This was, if I understand correctly, the whole purpose of mod_jk in the first place. |
|
Back to top |
|
Jorge
Joined: 12 Mar 2006 Posts: 376 Location: Belgium
|
Posted: Wed 28 Jun '06 11:52 Post subject: |
|
|
I'm going to take a stab in the wild here...
Make tomcats document root the same as apache's and try if
ProxyPassReverse *.jsp ajp://xxx.x.x.x:8009/
works... not sure if it will though can't hurt to try. |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Wed 28 Jun '06 12:20 Post subject: |
|
|
mod_rewrite is the way to achive this.
An example to reverse proxy all .jsp file with mod_rewrite you can try:
RewriteEngine on
RewriteRule /(.*).jsp ajp://%{HTTP_HOST}:8009/$1.jsp [P,L]
Did not tested it, but it should you point in the good direction.
Steffen |
|
Back to top |
|
tk
Joined: 27 Jun 2006 Posts: 10
|
Posted: Wed 28 Jun '06 14:39 Post subject: |
|
|
Steffen,
I just have to say thank you very much for your help. This did indeed point me in the right direction and all is right with the world now. Well, all is right with my servers anyway. This forum has been a godsend for someone like me who has some programming experience but is new to dealing with the servers themselves. I can't tell you how many bad, poorly written, and just plain wrong tutorials are out for Apache / Tomcat, and to find a place where people actually answer your questions and know what they are doing has been great. Thanks again.
T |
|
Back to top |
|
|
|
|
|
|