server {
…
set $no_cache 0;#设置全部缓存
location /my {
set $no_cache 1;#设置不缓存/my目录
rewrite ^(.*)$ /index.php/$1 last;
break;
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info “/”;
if ($uri ~ “^(.+\.php)(/.+)”) {
set $script $1;
set $path_info $2;
}
fastcgi_cache PHPCACHE;
fastcgi_no_cache $no_cache;
fastcgi_cache_bypass $no_cache;
fastcgi_cache_valid 200 302 1h;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_min_uses 1;
fastcgi_ignore_headers Cache-Control Expires;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php?IF_REWRITE=1;
include fastcgi_params;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
原文链接:https://www.cnblogs.com/cnzhangxl/p/4019974.html
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/18150