-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.upload.conf
46 lines (35 loc) · 1.29 KB
/
nginx.upload.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
lua_package_path "/opt/script/?.lua;;";
server {
client_max_body_size 50m;
listen 8070;
server_name _;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods POST;
location /post_upload {
content_by_lua_file /opt/script/post_upload.lua;
# lua_code_cache off;
}
# Upload form should be submitted to this location
location /upload {
# Pass altered request body to this location
upload_pass /post_upload;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /opt/upload 2 2;
# Allow uploaded files to be read only by user
upload_store_access user:r;
# Set specified fields in request body
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";
# Inform backend about hash and size of a file
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 "^.*$";
upload_cleanup 400 404 499 500-505;
}
location /img {
alias /opt/upload/;
autoindex on;
}
}