Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2022 12:28
What would you like to do?
# 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