support for img which has query params

This commit is contained in:
yanue
2016-04-22 14:07:51 +08:00
parent e2da08e460
commit f4abae8fd9
2 changed files with 26 additions and 19 deletions

View File

@@ -37,25 +37,21 @@ server{
}
location /pic/M00 {
# add support for img which has query params,
# like: xxx.jpg?a=b&c=d_750x750.jpg
if ($args ~* "^([^_]+)_(\d+)+x(\d+)+\.(jpg|jpeg|gif|png)$"){
set $w $2;
set $h $3;
set $img_ext $4;
# rewrite ^\?(.*)$ _${w}x${h}.$img_ext? last;
rewrite ([^.]*).(jpg|jpeg|png|gif)$ $1.$2_${w}x${h}.$img_ext? permanent;
}
alias /opt/fastdfs/pic/store0/data;
ngx_fastdfs_module;
}
location /chat/M00 {
alias /opt/fastdfs/chat/store0/data;
ngx_fastdfs_module;
}
location /avatar/M00 {
alias /opt/fastdfs/avatar/store0/data;
ngx_fastdfs_module;
}
location /media/M00 {
alias /opt/fastdfs/media/store0/data;
ngx_fastdfs_module;
}
location = /favicon.ico {
log_not_found off;
access_log off;