我将静态存储在 S3 上并使用nginx作为前端。对于从 S3 获取,我使用以下构造:
location / {
try_files $uri @s3;
}
location @s3 {
root /var/www/static.dev;
proxy_pass https://bucket.s3-eu-west-1.amazonaws.com;
proxy_store off; # for test purposes
proxy_store_access all:rw;
proxy_temp_path /dev/shm;
}
这个作品!但我想生成拇指并使用这个位置:
if ( $uri ~ ^/t/ ) {
set $w 182;
set $h 114;
}
if ( $uri ~ ^/m/ ) {
set $w 640;
set $h 1280;
}
if ( $uri ~ ^/l/ ) {
set $w 1024;
set $h 2048;
}
location ~ ^/(?:t|m|l)/(.*\.(?:jpg|gif|png))$ {
rewrite ^/[t|m|l]+/(.*)$ /$1;
image_filter crop $w $h;
}
但这不起作用,nginx return 415 Unsupported Media Type
。怎么了?