|
| 1 | + |
| 2 | +worker_processes 20; |
| 3 | + |
| 4 | +error_log logs/error.log notice; |
| 5 | + |
| 6 | +working_directory /usr/local/nginx; |
| 7 | + |
| 8 | +events { |
| 9 | + worker_connections 1024; |
| 10 | +} |
| 11 | + |
| 12 | +http { |
| 13 | + include mime.types; |
| 14 | + default_type application/octet-stream; |
| 15 | + |
| 16 | + server { |
| 17 | + listen 80; |
| 18 | + client_max_body_size 100m; |
| 19 | + |
| 20 | + # Upload form should be submitted to this location |
| 21 | + location /upload { |
| 22 | + # Pass altered request body to this location |
| 23 | + upload_pass /test; |
| 24 | + |
| 25 | + # Store files to this directory |
| 26 | + # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist |
| 27 | + upload_store /tmp 1; |
| 28 | + |
| 29 | + # Allow uploaded files to be read only by user |
| 30 | + upload_store_access user:r; |
| 31 | + |
| 32 | + # Set specified fields in request body |
| 33 | + upload_set_form_field "${upload_field_name}${upload_archive_elm}_name" $upload_file_name; |
| 34 | + upload_set_form_field "${upload_field_name}${upload_archive_elm}_content_type" $upload_content_type; |
| 35 | + upload_set_form_field "${upload_field_name}${upload_archive_elm}_path" $upload_tmp_path; |
| 36 | + upload_set_form_field "${upload_field_name}${upload_archive_elm}_archive_path" $upload_archive_path; |
| 37 | + |
| 38 | + # Inform backend about hash and size of a file |
| 39 | + upload_aggregate_form_field "${upload_field_name}${upload_archive_elm}_md5" $upload_file_md5; |
| 40 | + upload_aggregate_form_field "${upload_field_name}${upload_archive_elm}_size" $upload_file_size; |
| 41 | + |
| 42 | + upload_pass_form_field "^submit$|^description$"; |
| 43 | + |
| 44 | + upload_cleanup 400-599; |
| 45 | + |
| 46 | + upload_filter application/zip { |
| 47 | + upload_unzip on; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + # Pass altered request body to a backend |
| 52 | + location /test { |
| 53 | + proxy_pass http://localhost:8080; |
| 54 | + } |
| 55 | + } |
| 56 | +} |
0 commit comments