Last active
August 22, 2016 10:35
-
-
Save s-chizhik/c539f715d464b2624620727b9f2a8347 to your computer and use it in GitHub Desktop.
Nginx caching proxy conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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