通过yum安装的nginx 加载image_filter方式方法:
yum install -y gd-devel libgd gcc libgd
yum install -y nginx-module-image-filter
在 nginx.conf 中最上方写入
load_module modules/ngx_http_image_filter_module.so;
在conf.d/default.conf 写入
location ~* /image/(.*)_(\d+)j(\d+)\.jpg$ {
root /;
set $s $1;
set $w $2;
set $h $3;
image_filter resize $w $h;
image_filter_buffer 10M;
rewrite ^/image/(.*)$ /mypath/$s.jpg break;
}