Skip to content

Instantly share code, notes, and snippets.

@paveltimofeev
Created July 14, 2016 13:28
Show Gist options
  • Select an option

  • Save paveltimofeev/892d3d20c09e422cf4061f06820d2d52 to your computer and use it in GitHub Desktop.

Select an option

Save paveltimofeev/892d3d20c09e422cf4061f06820d2d52 to your computer and use it in GitHub Desktop.
Nginx hints, tips & tricks

Nginx hints, tips & tricks

Reverse Proxy with Caching

nginx.com example
nginx-caching

http {
    proxy_cache_path  /data/nginx/cache  levels=1:2  keys_zone=STATIC:10m  inactive=24h  max_size=1g;
    server {
        location / {
            proxy_pass             http://1.2.3.4;
            proxy_set_header       Host $host;
            proxy_cache            STATIC;
            proxy_cache_valid      200  1d;
            proxy_cache_use_stale  error timeout invalid_header updating
                                   http_500 http_502 http_503 http_504;
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment