时间:2021-07-01 10:21:17 帮助过:15人阅读
http://www.cnxct.com/several-reminder-in-nginx-fastcgi_cache-and-php-session_cache_limiter
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache
fastcgi_cache_path /data/files/game/nginxCache/content levels=1:2 keys_z inactive=1d max_size=1G; fastcgi_temp_path /data/files/game/nginxCache/temp; fastcgi_cache_key "$scheme$request_method$host$request_uri$is_args$args"; fastcgi_cache_use_stale error timeout invalid_header http_500; #nocache fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
server{ set $skip_cache 0; #post访问不缓存 if ($request_method = POST) { set $skip_cache 1; } #动态查询不缓存 if ($query_string ~* "nonocache") { set $skip_cache 1; } #后台等特定页面不缓存(其他需求请自行添加即可) if ($request_uri ~* "users") { set $skip_cache 1; } if ($request_uri ~* "reply.php") { set $skip_cache 1; } #对登录后的结果缓存(hehe就是一个判断登录与否的Cookei名称) if ($http_cookie ~* "ECM_ID") { set $skip_cache 1; } fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; add_header X-Cache "$upstream_cache_status From $host"; add_header KCache "$scheme$request_method$host$request_uri$is_args$args"; fastcgi_cache Hpp; fastcgi_cache_valid 200 301 302 1d; }
以上就介绍了 nginx fastcgi_cache,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。