Ok, so I want to get a webapp running in tomcat (5.5) to run behind apache 2 (2.2.3 to be precise) serving from the root of the site (i.e. without the context), with static content being served via apache.
So if the app is running under "/myapp
" on tomcat I want to use apache (plus mod_rewrite
) to make it behave as if it's running under "/
" instead.
Mod_jk
is setup and working ok. I can access the app from "/myapp
", but I can't quite get the last bit working. Below is the config I've got for mod_rewrite
to try and get this working. It correctly gets rewrites /static/
urls to get apache to serve them from the unpacked webapp and if I enable the rewrite log I see that it does attempt to pass through all other requests to /myapp
via mod_jk
. However it seems that mod_jk is not processing the request afterwards.
JkMount /myapp/* worker1
RewriteEngine On
# ensure static stuff gets served by apache
RewriteRule ^/static/(.*)$ /var/lib/tomcat5.5/webapps/myapp/static/$1 [L]
# everything else should go through tomcat
RewriteRule ^/(.*)$ /myapp/$1 [L,PT]
When I've done this with apache 1 in the past I've had to make sure mod_jk
get's loaded before mod_rewrite
, but I can't seem to achieve this under apache 2. Any thoughts? How do other people usually do this?