Is there any point in using proxy_cache for static files when they reside on the same disk ?
Nope, none. It's disk access to static files either way.
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 ?
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:
#Caching parameters
fastcgi_cache one;
#I use host here to account for the fact that I have multiple WP instances
fastcgi_cache_key $scheme$host$request_uri;
fastcgi_cache_valid 200 302 304 30m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 5m;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
This ties into the additions I've made within the http block:
# configure cache log
log_format cache '$remote_addr - $host [$time_local] '
'"$request" $status $upstream_cache_status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
# Configure cache and temp paths
fastcgi_cache_path /var/cache/nginx levels=1:2
keys_zone=one:100m
inactive=7d max_size=10g;
fastcgi_temp_path /var/cache/nginx/tmp;
Best Answer
If your box can handle the entire cache on its own, memcache will only slow you down. APC is shared memory. Used right it will blow away memcached. Nginx fast cgi cache will make all dynamic php pages scream. Even if you set the cache to just 10 seconds, this makes it such that that max hit rate to any given php page will be once every 10 seconds. Makes it impossible to crash a page with load. I run a bunch of websites on a single small box that gets millions of people per month. All you need is nginx caching and APC at this point.
Memcache comes into the picture only when you have to scale your cache beyond a single box.