We have a website and it's current architecture is as follows:
There's squid in the front which caches images. Then there is apache httpd with mod_rewrite enabled. httpd then talks to apache tomcat(with mod_jk) for dynamic requests and servers static stuff like js,css on it's own. Apache httpd rewrites clean urls to raw ones(with ugly url params) that tomcat deals with. There are over 100 rewrite rules in the mod_rewrite config. We also have certain php stuff that we hacked together to work with facebook. the php files are served by apache, but the load is significantly less.
So the goal is to able to cache static files(js,css,images) aggressively and give the dynamic stuff directly to tomcat. We need url rewriting(that probably can be done in tomcat itself), gzip/deflate support as well as support for php.
So, given our needs, can a caching server like squid/varnish be placed directly in front of tomcat to make this work or Would we need a web server like nginx/lighttpd in between because we need php ?
why not use apache/lighttpd as a proxy/caching server and php interpreter at the same time?
lighttpd as caching proxy: http://forum.lighttpd.net/topic/4845
apache as caching proxy: http://httpd.apache.org/docs/2.2/caching.html