Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created February 10, 2022 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovshenin/4e10e11eecc5b0b920d2cb20163a3739 to your computer and use it in GitHub Desktop.
Save kovshenin/4e10e11eecc5b0b920d2cb20163a3739 to your computer and use it in GitHub Desktop.
# In the main {} context
map $http_user_agent $imgproxy {
"~imgproxy" 1;
default 0;
}
map $http_accept $webp_suffix {
"~image/webp" "@webp";
default "";
}
proxy_cache_path /var/cache/nginx/imgproxy levels=1:2 keys_zone=imgproxy:100m inactive=1y max_size=4g;
proxy_cache_valid 200 302 2y;
proxy_cache_valid any 10m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504 http_403 http_404 http_429;
proxy_cache_lock on;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment