Skip to content

Commit 012747e

Browse files
committed
support fastdfs
1 parent 5ff3560 commit 012747e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

vhost/fastdfs.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
server{
2+
listen 80;
3+
server_name static.saleasy.net static.isaleasy.com static.estt.com.cn;
4+
5+
location ~* ^(\/pic\/M00(.+\.(jpg|jpeg|gif|png))_(\d+)+x(\d+)+\.(jpg|jpeg|gif|png))$ {
6+
root /opt/fastdfs/thumb; # 这里必须设置,否则根目录,即 $document_root 会是 Nginx 默认的 Nginx Root/html,在 Lua 中会得不到期望的值
7+
set $thumbnail_root /opt/fastdfs/thumb;
8+
set $fdfs_group_root /opt/fastdfs/pic/store0/data;
9+
set $file $thumbnail_root$uri;
10+
11+
if (!-f $file) { # 如果文件不存在时才需要裁剪
12+
set $request_filepath $fdfs_group_root$2; # 设置原始图片路径,如:/document_root/1.gif
13+
set $img_width $4; # 设置裁剪/缩放的宽度
14+
set $img_height $5; # 设置裁剪/缩放的高度
15+
set $img_ext $3; # 图片文件格式后缀
16+
content_by_lua_file /etc/nginx/lua/img.lua; # 加载外部 Lua 文件
17+
}
18+
}
19+
20+
location /pic/M00 {
21+
alias /opt/fastdfs/pic/store0/data;
22+
ngx_fastdfs_module;
23+
}
24+
25+
location /media/M00 {
26+
alias /opt/fastdfs/media/store0/data;
27+
ngx_fastdfs_module;
28+
}
29+
30+
location = /favicon.ico {
31+
log_not_found off;
32+
access_log off;
33+
}
34+
}
35+

0 commit comments

Comments
 (0)