1

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:

  1. Is it even worth using mod_jk? I don't need load balancing.
  2. 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.
1
  • 1
    Why do you think you might want to use mod_jk? Is what worth using mod_jk?
    – beans
    Mar 3, 2011 at 2:56

1 Answer 1

1

Why are you thinking of using mod_jk?

If it's to use ajp communication, to speed up transfer to tomcat why not look at mod_proxy_ajp?

You'd just change the tomcat rewriute rule to:-

RewriteRule ^/(.*)$ ajp://localhost:8080/$1 [P,L]
1
  • Good suggestion but it doesn't work if you are load balancing between 2 or more instances of JBoss since the AJP port needs to be balanced between servers.
    – djangofan
    May 9, 2011 at 1:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .