首頁 > 後端開發 > php教程 > nginx fastcgi_cache

nginx fastcgi_cache

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-07-28 08:25:45
原創
1221 人瀏覽過

參考 

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教程有興趣的朋友有所幫助。

相關標籤:
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
tp6中runtime/cache/下的資料夾
來自於 1970-01-01 08:00:00
0
0
0
nginx能否實現對POST請求的按內容Cache?
來自於 1970-01-01 08:00:00
0
0
0
關於 `nginx` 的 `cache` 的問題
來自於 1970-01-01 08:00:00
0
0
0
angular.js - Web應用,單頁面應用Cache 問題
來自於 1970-01-01 08:00:00
0
0
0
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板