/etc/nginx/nginx.conf
fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=MYAPP:6000m inactive=720m;
fastcgi_cache_key $scheme$request_method$host$request_uri;
default.server.conf
set $skip_cache 1;
if ($request_uri ~* "^/i/[0-9]+$" ) {
set $skip_cache 0;
}
location ~ .php {
fastcgi_pass 127.0.0.1:9008;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param PATH_INFO $request_uri;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 40m;
fastcgi_ignore_headers Expires ;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header X-nx-Cache "$upstream_cache_status - $upstream_response_time";
}