Nginx上传文件响应状态

时间:2018-06-08 07:43:34

标签: php symfony nginx

我正在尝试使用bellow config

使用Nginx上传文件
location /attachments/upload {
           set $true 1;
           if ($true) {
                   add_header 'Access-Control-Allow-Origin' '*';
                   add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,OPTIONS';
                   add_header 'Access-Control-Allow-Headers' 'Authorization,Keep-Alive,User-Agent,Cache-Control,Content-Type';
           }

           # Pass altered request body to this location
           upload_pass   /callbackAttachment;

           # Store files to this directory
           # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
           upload_store /var/www/html/MYPROJECT/files 1;

           # Allow uploaded files to be read only by user
           upload_store_access user:r;

           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_pass_form_field "^document_id$|^unique_path$";



           # For resumable file uploads
           # upload_resumable on;
           # upload_state_store /usr/share/nginx/html/tmp_files 1;
           # upload_cleanup 400 404 499 500-505;
           # track_uploads proxied 5s;
   }

将更改后的请求正文传递给后端

location /callbackAttachment {
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
           proxy_set_header Host $http_host;
           proxy_redirect off;

           proxy_read_timeout 3600;
           proxy_connect_timeout 3600;
           proxy_max_temp_file_size 5024m;
           proxy_send_timeout 3600;
           proxy_pass_header 'Access-Control-Allow-Origin';
           proxy_pass      http://127.0.0.2/attachments/move;
   }

我使用nginx上传进行文件上传过程,使用代理传递URL,将其传递给后端。 问题是无论何时取消上传,都无法在显示为

的日志文件中跟踪上传是否失败
2018/06/08 06:54:35 [alert] 5078#5078: *1 aborted uploading file "Product.tar.gz" to "/var/www/html/My_project/var/files/6/0009180116", dest file removed

是否可以将此警报传递给代理路径网址。

0 个答案:

没有答案
相关问题