Nginx wiki is very vague with explanation as to how to properly setup nginx with php-fpm with fastcgi_caching for sites which have cookies i.e. wordpress, drupal, vbulletin etc.
I downloaded a modified nginx bash shell install script called centmin from http://vbtechsupport.com/796/ and while it installs nginx v1.0.2, php 5.3.6 php-fpm, mariadb 5.2.6 mysql, memcached 1.4.5 servers and siege benchmark automatically via shell script, it lacks the configuration parameters for setting up fastcgi_caching for caching php.
It also lacks setup for caching static files for locally served files. Is there any point in using proxy_cache for static files when they reside on the same disk ?
Anyone got some tips and info links to info to read up on tutorials for proper setup for php (php-fpm) fastcgi_caching as well as for caching locally residing static files ?
thanks
Best Answer
Nope, none. It's disk access to static files either way.
Take a look at the various proxy_caching tutorials out there, especially those that proxy WordPress from Apache -- the fastcgi_caching is very nearly identical, and what works for proxy_caching will almost undoubtedly work just as well for fastcgi_caching.
I actually happen to be working on this exact same problem myself right now. So far I've got it working except for accounting for the cookies, but that's just a simple series of
if
directives to set up additional variables for the fastcgi_cache_key directive. This page should prove very useful for you; just skip down to the proxy_caching configuration and change all those proxy_* directives to fastcgi_* (this is what I've been following, but beware that if is evil and should not reside within a location directive...).When I have my own worked out fully I'll be posting it on my blog (link is in my profile; I'll get in trouble again if I put that link in my post). It's really a shame there aren't, well, any fastcgi_caching guides out there already, so I can't point you to anything except my blog (even though it's not there quite yet...).
Edited to add: Here's my current fastcgi_caching configuration. Like I said, it yet lacks any accounting for cookies, but it is indeed actually functional as-is, for the most part.
Within the location block that processes my .php files, I've added:
This ties into the additions I've made within the http block: