fastdfs nginx 生成缩略图
nginx搭配fastdfs生成实时缩略图,并加水印
1,需要image_filter模块
2,添加反向代理的upstream模块
3,配置适配fastdfs访问的group正则表达式
4,增加_P1.jpg这种放置刷新方式
5,调试的时候,如果出现莫名奇妙的错误,请试试将location放置到server中的第一处
6,这种生成缩略图采用nginx自带模块,采用GD压缩,也可以使用GM模块,这种需要使用nginx支持lua模块,然后自己写lua表达式
location配置
location ~* /group(\d+)\/M00\/(\w+)\/(\w+)/(.+)\.(jpg|png|jpeg|bmp|tiff|gif|tif|PNG|JPG|JPEG|BMP|TIFF|GIF|TIF)\_P1\.(jpg|png|jpeg|bmp|tiff|gif|tif|PNG|JPG|JPEG|BMP|TIFF|GIF|TIF)$ { proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_cache http-cache; proxy_cache_valid 200 304 12h; proxy_cache_key $uri$is_args$args; proxy_pass http://fdfs_group$1; expires 7d; #ngx_fastdfs_module; #set $w $6; #set $h $7; rewrite /group(\d+)\/M00\/(\w+)\/(\w+)/(.+)\.(jpg|png|jpeg|bmp|tiff|gif|tif|PNG|JPG|JPEG|BMP|TIFF|GIF|TIF)\_P1\.(jpg|png|jpeg|bmp|tiff|gif|tif|PNG|JPG|JPEG|BMP|TIFF|GIF|TIF)$ /group$1/M00/$2/$3/$4.$5 break; # image_filter resize $w $h; image_filter_buffer 20M; image_filter_interlace on; image_filter_jpeg_quality 95; image_filter watermark; image_filter_watermark_width_from 50; image_filter_watermark_height_from 50; image_filter_watermark "/home/image/water/c.png"; image_filter_watermark_position center-center; image_filter resize 238 193; }
upstream 配置
upstream fdfs_group1 { server 10.192.168.0.1:8888 weight=1 max_fails=2 fail_timeout=30s; }
相关推荐
zongyuewang 2019-03-01
黑夜流星 2020-06-28
jollyhope 2020-05-10
cbao 2020-02-14
稳哥的小灶 2019-12-27
cherayliu 2019-12-22
TinyDolphin 2019-12-11
gongzhiyao0 2011-08-16
ruizhenggang 2011-08-13
易辰Android 2011-08-10
ChibiMarukoChan 2015-11-18
python的学习之路 2019-04-30
0bytes 2019-04-30
LoveLifeLoveTech 2019-04-30
liuwendao 2018-07-14
xiongli 2019-03-27
Purgatory00 2019-04-12
HuangXiaoChuan 2016-03-14
齐天 2019-03-18