Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/nginx/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu Nginx-通过HTTP请求上传文件_Ubuntu_Nginx_Http Request_Http Post - Fatal编程技术网

Ubuntu Nginx-通过HTTP请求上传文件

Ubuntu Nginx-通过HTTP请求上传文件,ubuntu,nginx,http-request,http-post,Ubuntu,Nginx,Http Request,Http Post,我想向我的Nginx服务器(ubuntu机器)发送一个图像文件 我将以下代码添加到nginx.conf: location /upload { auth_basic "Restricted Upload"; auth_basic_user_file basic.htpasswd; limit_except POST { deny all; } client_body_temp_path /tmp/; c

我想向我的Nginx服务器(ubuntu机器)发送一个图像文件

我将以下代码添加到nginx.conf:

location /upload {
  auth_basic                 "Restricted Upload";
  auth_basic_user_file       basic.htpasswd;
  limit_except POST          { deny all; }

  client_body_temp_path      /tmp/;
  client_body_in_file_only   on;
  client_body_buffer_size    128K;
  client_max_body_size       1000M;

  proxy_pass_request_headers on;
  proxy_set_header           X-FILE $request_body_file; 
  proxy_set_body             off;
  proxy_redirect             off;
  proxy_pass                 http://backend/file;
}
添加该附加代码后,重新启动serivce失败

我哪里做错了什么


谢谢

此链接可能对您有所帮助:我认为您应该查看图像上载的位置,这通常是一个服务器方法,它会作为POST请求接收您的图像,尝试使用web浏览器的开发人员工具进行检查,并查看失败后的响应。请检查nginx的access.log。我想您得到了一个::[emerg]38429#0:在/etc/nginx/sites enabled/yourwebsite的上游“后端”中找不到主机--错误