Skip to content

Instantly share code, notes, and snippets.

@jiceb
Created July 24, 2011 16:09
Show Gist options
  • Save jiceb/1102773 to your computer and use it in GitHub Desktop.
Save jiceb/1102773 to your computer and use it in GitHub Desktop.
ngnix.conf - On-Demand Image Creation and Static Delivery with NGINX
# somewhere in the server section of any nginx config
# http://www.marceleichner.de/blog/on-demand-image-creation-and-static-delivery-with-nginx/
location ~* \.(png|gif|jpg|jpeg)(\?[0-9]+)?$ {
# try existing files, or put request to index.php
try_files $uri /thumbnailer.php?image=$uri;
# old method when try_files did not exist
# if (!-f $request_filename) {
# rewrite ^/(.*)$ /thumbnailer.php?image=$1 last;
# break;
# }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment