Skip to content

Instantly share code, notes, and snippets.

@s-chizhik
Last active August 22, 2016 10:35
Show Gist options
  • Save s-chizhik/c539f715d464b2624620727b9f2a8347 to your computer and use it in GitHub Desktop.
Save s-chizhik/c539f715d464b2624620727b9f2a8347 to your computer and use it in GitHub Desktop.
Nginx caching proxy conf
# keys_zone is STATIC
proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=STATIC:50m inactive=365d max_size=1g;
server {
listen *:80;
server_name proxy.localhost;
location / {
proxy_cache_methods GET POST;
proxy_cache STATIC; # keys zone name
proxy_cache_valid 200 400 401 402 403 404 365d;
proxy_cache_key "$request_method|$request_uri|$request_body";
proxy_buffering on;
proxy_set_header Host "host.example.com";
proxy_http_version 1.1;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers Cache-Control;
proxy_ignore_headers Expires;
#proxy_hide_header Set-Cookie Cache-Control Expires;
add_header X-Cache-Status $upstream_cache_status always;
proxy_pass https://0.0.0.0; # nslookup "host.example.com"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment