nginx enables proxy cache proxy caching
nginx.conf
http {
Add below
proxy_cache_path /data/nginxcache levels=1:2 keys_zone=my_cache:500m max_size=10g inactive=30d use_temp_path=off;
Add the following configuration to the configuration file for a site:
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;
Leave a Reply