-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathar.upload.ming.conf
82 lines (76 loc) · 2.97 KB
/
ar.upload.ming.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
server
{
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,PUT,DELETE,PATCH' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,Keep-Alive,Content-Type,accept,origin,X-Requested-With,UPLOAD-SERVER-TOKEN,UPLOAD-SERVER-USER,UPLOAD-SERVER-DATE,UPLOAD-SERVER-NOTIFY-URL,UPLOAD-SERVER-ACTION,UPLOAD-SERVER-LOCAL-PATH' always;
if ($request_method = OPTIONS ) { return 200; }
listen 80;
#listen [::]:80;
server_name ar.upload.ming;
index index.html index.htm index.php;
root /Volumes/HDD/workshop/old/ar.upload.ming;
client_max_body_size 20m;
client_body_buffer_size 512k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE_ADD $remote_addr;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
include ar_upload_img_filter.conf;
include none.conf;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
# 上传path配置
location /upload {
if ($request_method != POST) {
return 405;
}
#权限控制
access_by_lua_file '/path/upload-server/auth.lua';
# 转到后台处理URL
upload_pass @python;
client_body_in_file_only on;
# 临时保存路径
# 可以使用散列
upload_store /path/ar.upload.ming/tmp;
# 上传文件的权限,rw表示读写 r只读
upload_store_access user:rw;
# 这里写入http报头,pass到后台页面后能获取这里set的报头字段
upload_set_form_field "${upload_field_name}_name" $upload_file_name;
upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;
# Upload模块自动生成的一些信息,如文件大小与文件md5值
upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
# 允许的字段,允许全部可以 "^.*$"
upload_pass_form_field "^.*$";
# 每秒字节速度控制,0表示不受控制,默认0
upload_limit_rate 0;
# 如果pass页面是以下状态码,就删除此次上传的临时文件
upload_cleanup 400 404 499 500-505;
}
location @python {
proxy_pass http://127.0.0.1:8000;
#return 200; # 如果不需要后端程序处理,直接返回200即可
}
location /action {
#本地端口号
proxy_pass http://127.0.0.1:8000;
}
access_log off;
}