nginx fastcgi_cache
This is working method how to cache with fastcgi. I used nginx.org wiki to make it. My nginx.conf looks like this:
fastcgi_cache_path /var/cache/nginx/friendbg levels=1:2 keys_zone=friendbg:10m inactive=5m; fastcgi_cache_path /var/cache/nginx/friendbgssl levels=1:2 keys_zone=friendbgssl:10m inactive=5m; fastcgi_cache_key "$scheme$request_method$host$request_uri";
and my friendbg.conf looks like this:
fastcgi_cache friendbgssl; fastcgi_cache_valid 200 302 1h; fastcgi_cache_valid 301 1d; fastcgi_cache_valid any 1m; fastcgi_cache_min_uses 1; fastcgi_cache_use_stale error timeout invalid_header http_500;
I have two keys_zone : friendbg and friendbgssl because 2 vhosts of the website.
Now i have working nginx cache method and pingdom.com says my site loads 0.4 sec faster than without fastcgi cache.