-
Notifications
You must be signed in to change notification settings - Fork 22
/
nginx.conf
54 lines (37 loc) · 1.44 KB
/
nginx.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
load_module modules/ngx_http_upload_module.so;
events {
}
http {
server {
listen 5050;
# Allow file uploads max 1024M for example
client_max_body_size 1024M;
upload_buffer_size 10M;
# POST URL
location /upload {
# Pass altered request body to this location
upload_pass @after_upload;
# Store files to this directory
upload_store /tmp/nginx_upload/;
# Allow uploaded files to be world readable
upload_store_access user:rw group:rw all: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 "^submit$|^description$";
upload_cleanup 400 404 499 500-505;
}
location @after_upload {
add_header Content-Type "text/plain;charset=utf-8";
return 200 "Upload succeeded";
}
root /tmp/nginx_upload;
location / {
root /tmp/nginx_upload;
}
}
}