我已经设置了Nginx上传模块来处理在逆向代理模式下运行的应用程序的file upload。 它在本地工作,但不在服务器上(EC2 Ubuntu AMI)。 我自己编译了Nginx,包含上传模块。 这里是我的nginx.conf(从服务器部分)的相关位:
location /upload { # pass request body to here upload_pass /upload_endpoint; # Store files to this directory # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist # ie make sure to create /u/apps/bugle/shared/uploads_tmp/0 /u /apps/bugle/shared/uploads_tmp/1 etc. upload_store /tmp/nginxuploads 1; # set permissions on the uploaded files upload_store_access user:rw group:rw all:r; # Set specified fields in request body # this puts the original filename, new path+filename and content type in the requests params 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_aggregate_form_field $upload_field_name.size "$upload_file_size"; upload_pass_form_field ".*"; upload_cleanup 400 404 499 500-505; } location /upload_endpoint { proxy_pass http://127.0.0.1:9001; }
除了404以外的日志没有错误,这只是说/ usr / local / nginx / html / upload文件不存在。 任何想法发生了什么?
/ tmp / nginxuploads / 0到/ tmp / nginxuploads / 9存在并且是世界可读和可写的。
事实certificate,对于Nginx上传模块的端点设置的GET请求将始终返回一个404。它正常工作与POST请求,这正是你想要的,当然,我只是使用GET进行testing!