nginx启用proxy cache 代理缓存

nginx.conf中的
http {
下面加

proxy_cache_path /data/nginxcache levels=1:2 keys_zone=my_cache:500m max_size=10g inactive=30d use_temp_path=off;

某个站点的配置文件中增加以下配置:

location / {

proxy_cache my_cache;
proxy_cache_revalidate on;
#proxy_cache_valid 200 206 304 301 302 30d;
proxy_cache_valid any 30d;
proxy_ignore_headers "Set-Cookie";
proxy_ignore_headers "Expires";
#proxy_ignore_headers "Age";
proxy_cache_key $scheme$proxy_host$uri$is_args$args;

proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;

nginx启用proxy cache 代理缓存
标签: