server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } location /storage { root /vagrant/fileserver; index index.html index.htm; } # Upload form should be submitted to this location location /upload { # Pass altered request body to this location upload_pass @backend; upload_pass_args on; # Store files to this directory # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist upload_store /tmp 1; # Allow uploaded files to be read only by user upload_store_access group:rw; # 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"; #upload_set_form_field $upload_field_name.md5 "$upload_file_md5"; #upload_set_form_field $upload_field_name.size "$upload_file_size"; # 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; } # Pass altered request body to a backend location @backend { proxy_pass http://11.11.11.1:8080; } }