Skip to content

Instantly share code, notes, and snippets.

@lfalcao
Created July 14, 2015 03:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfalcao/d1e0ae9ac267605967ff to your computer and use it in GitHub Desktop.
Save lfalcao/d1e0ae9ac267605967ff to your computer and use it in GitHub Desktop.
nginx caching thumbor webp/jpg
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
proxy_cache_key "$host$request_uri-$format";
server {
listen 999;
server_name _;
set $format jpg;
if ( $http_accept ~* 'webp' ) {
set $format webp;
}
location / {
proxy_cache my_zone;
proxy_pass http://localhost:9000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment