Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.
share|improve this question
1  
Why do you think you might want to use mod_jk? Is what worth using mod_jk? –  beans Mar 3 '11 at 2:56

1 Answer 1

up vote 1 down vote accepted

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]
share|improve this answer
    
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 '11 at 1:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.