mirror of
https://github.com/yanue/nginx-lua-GraphicsMagick.git
synced 2025-11-26 23:35:33 +08:00
support fastdfs
This commit is contained in:
35
vhost/fastdfs.conf
Normal file
35
vhost/fastdfs.conf
Normal file
@@ -0,0 +1,35 @@
|
||||
server{
|
||||
listen 80;
|
||||
server_name static.saleasy.net static.isaleasy.com static.estt.com.cn;
|
||||
|
||||
location ~* ^(\/pic\/M00(.+\.(jpg|jpeg|gif|png))_(\d+)+x(\d+)+\.(jpg|jpeg|gif|png))$ {
|
||||
root /opt/fastdfs/thumb; # 这里必须设置,否则根目录,即 $document_root 会是 Nginx 默认的 Nginx Root/html,在 Lua 中会得不到期望的值
|
||||
set $thumbnail_root /opt/fastdfs/thumb;
|
||||
set $fdfs_group_root /opt/fastdfs/pic/store0/data;
|
||||
set $file $thumbnail_root$uri;
|
||||
|
||||
if (!-f $file) { # 如果文件不存在时才需要裁剪
|
||||
set $request_filepath $fdfs_group_root$2; # 设置原始图片路径,如:/document_root/1.gif
|
||||
set $img_width $4; # 设置裁剪/缩放的宽度
|
||||
set $img_height $5; # 设置裁剪/缩放的高度
|
||||
set $img_ext $3; # 图片文件格式后缀
|
||||
content_by_lua_file /etc/nginx/lua/img.lua; # 加载外部 Lua 文件
|
||||
}
|
||||
}
|
||||
|
||||
location /pic/M00 {
|
||||
alias /opt/fastdfs/pic/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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user