Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i'm using image_filter resize in nginx to resize a bunch of images that are in Amazon S3. I want to be able to save the resized image so that for the 2nd and subsequent request for the image it doesn't need to get resized. I have worked out how to cache the original image in Nginx so at least the image isn't continuously retrieved from S3 but i can't work out how to cache the resized image on the nginx server. Is this possible?

here's the relevant part of my nginx config (all this server does is resize images):

location / {

    try_files $uri @resizer; # directive to tell it to first look locally, then look @resizer
    root   /var/www/nginx-default/images/;
    image_filter   resize  400 300;
        image_filter_buffer 2048M;
        image_filter_jpeg_quality 75;
        image_filter_transparency off;
        error_page     415   = /empty;
    }

        location @resizer { 
            proxy_pass http://my-s3-bucket;
            proxy_store on;
        proxy_temp_path /var/www/nginx-default/cache$uri;
        proxy_store_access  user:rw  group:rw  all:r;
        image_filter   resize  400 300;
        image_filter_buffer 2048M;
        image_filter_jpeg_quality 75;
        image_filter_transparency off;
        root   /var/www/nginx-default/images/;
            error_page     415   = /empty;
                }

        location = /empty {
                empty_gif;
          }

Anyone any ideas...?

share|improve this question
add comment

2 Answers

See this forum post replied by Igor Sysoev and this entry from Foswiki.

share|improve this answer
add comment

I recommend my article http://adw0rd.com/2012/django-nginx-image/en/. You can take out a configuration file and apply it, Django does not necessarily need

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.