server { listen 80; server_name nsite-proxy; location / { proxy_cache request_cache; proxy_cache_valid 200 60m; proxy_cache_valid 404 10m; proxy_cache_key $scheme$proxy_host$request_uri; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; add_header X-Cache $upstream_cache_status; add_header X-Cache-Status $upstream_status; expires 30d; add_header Cache-Control "public, no-transform"; proxy_set_header Host $host; proxy_pass http://nsite; } # Manual cache invalidation ( cant use proxy_cache_purge ) # location ~ /purge(/.*) { # allow 127.0.0.1; # deny all; # proxy_cache_purge request_cache $scheme$proxy_host$1; # } }