Apache mod_jk replacing mod_rewrite rules
Posted
by
organicveggie
on Server Fault
See other posts from Server Fault
or by organicveggie
Published on 2011-03-03T01:46:00Z
Indexed on
2011/03/03
7:26 UTC
Read the original article
Hit count: 535
We have a slightly complex Apache 2.2 setup in front of a Tomcat 6.0 instance. The main Tomcat webapp is deployed in:
/opt/tomcat/webapps/ROOT
But we also have static content that we update semi-regularly. We didn't want to force a new build and deploy of the webapp, so that's stored separately in folders like:
/opt/tomcat/webapps/css
/opt/tomcat/webapps/foo
/opt/tomcat/webapps/bar
To handle this from Apache, we use mod_rewrite and rules look something like the following:
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/css/(.*)$ - [L]
RewriteCond ROOT/%{REQUEST_FILENAME} -f
RewriteRule ^/css/(.*)$ ROOT/$1 [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.(jpg|png|html|js)$ - [L]
RewriteCond ROOT/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.(jpg|png|html|js)$ - [L]
RewriteRule ^/(.*)$ http://localhost:8080/$1 [P,L]
ProxyPassReverse / http://localhost:8080/
I now think I might want to start using mod_jk and I have two questions:
- Is it even worth using mod_jk? I don't need load balancing.
- Is it even possible to handle the cases I outlined where the static content is referenced as "http://www.example.com/css/foo.css", but we don't know if it's located in the Tomcat webapp or in one of the static folders.
© Server Fault or respective owner