使用后端S3在飞行中调整图像Nginx的大小

时间:2015-08-27 07:39:09

标签: nginx amazon-s3

我已经在模块http映像过滤器模块和所有依赖项中安装了nginx。我的nginx版本1.8.0。

这是我的剧本:

server {
        listen 80;
        server_name my.domain.com;

        location ~* / {
                proxy_pass http://mydomain.s3-website-ap-southeast-1.amazonaws.com;
        }

        location ~* ^/resize/([\d\-]+)x([\d\-]+)/(.+)$ {
            alias http://mydomain.s3-website-ap-southeast-1.amazonaws.com/$3;
            image_filter resize $1 $2;
            image_filter_buffer 2M;
            error_page 415 = /empty;
        }

        location ~* ^/crop/([\d\-]+)x([\d\-]+)/(.+)$ {
            alias http://mydomain.s3-website-ap-southeast-1.amazonaws.com/$3;
            image_filter crop $1 $2;
            image_filter_buffer 2M;
            error_page 415 = /empty;
        }

        location = /empty {
            empty_gif;
        }
    }

当我请求http://my.domain.com/some_image.jpg时,它不会返回错误

但是当我尝试使用http://my.domain.com/resize/300x300/some_image.jpg时,它会返回404或找不到

更新#1

我改变了:

location ~* / {

到:

location / {

它修复了我的配置错误。

0 个答案:

没有答案