1 2worker_processes 20; 3 4error_log logs/error.log notice; 5 6working_directory /usr/local/nginx; 7 8events { 9 worker_connections 1024; 10} 11 12http { 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}_name" $upload_file_name; 34 upload_set_form_field "${upload_field_name}_content_type" $upload_content_type; 35 upload_set_form_field "${upload_field_name}_path" $upload_tmp_path; 36 37 # Inform backend about hash and size of a file 38 upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5; 39 upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size; 40 41 upload_pass_form_field "^submit$|^description$"; 42 } 43 44 # Pass altered request body to a backend 45 location @test { 46 proxy_pass http://localhost:8080; 47 } 48 } 49} 50