Ngnix caching

Cache control Headers:

  • Do not store any kind of cache at all
  • Store the cahche but verify with webserver whether file is modified
  • Store the cache for 24h
  • ...

various cache control headers:

  • Cache-Control: no-store
  • Cache-Control: no-cache
  • Cache-Control: no-store, no-cache must-revalidate
  • Cache-Control: public
  • Cache-Control: private
  • ...

Cache-Control: no-cache

server {
    # ...
    location / {
        proxy_cache my_cache;
        proxy_cache_revalidate on;
        proxy_cache_min_uses 3;
        proxy_cache_use_stale error timeout updating http_500 http_502
                              http_503 http_504;
        proxy_cache_background_update on;
        proxy_cache_lock on;

        proxy_pass http://my_upstream;
    }
}