Skip to content

Instantly share code, notes, and snippets.

@Freundschaft
Created February 5, 2018 10:57
Show Gist options
  • Save Freundschaft/263447baf970799bfe4d85f1d7b8c9dc to your computer and use it in GitHub Desktop.
Save Freundschaft/263447baf970799bfe4d85f1d7b8c9dc to your computer and use it in GitHub Desktop.
server {
# Internal image resizing server.
server_name localhost;
listen 8888;
location ~* ^.+\.(jpeg|gif|png|jpg) {
image_filter_buffer 20M;
image_filter resize 450 -;
image_filter_jpeg_quality 95;
image_filter_interlace on;
proxy_pass http://example.com;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
}
}
proxy_cache_path /tmp/nginx-images-cache/ levels=1:2 keys_zone=images:10m inactive=24h max_size=100m;
location ~* ^.+\.(jpeg|gif|png|jpg) {
proxy_pass http://localhost:8888;
proxy_cache images;
proxy_cache_valid 200 24h;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment