我试图在我的Ubuntu盒子上安装Madsonic ,并让Nginx运行在它的前面。 问题是,当我尝试通过Web界面上传东西时,我总是收到这个警告:
31115#0: *14 a client request body is buffered to a temporary file
这也解释了为什么上传窗口上的进度条不起作用。 这是我的相关Nginxconfiguration:
# proxy the madsonic server here location / { proxy_pass https://madsonic-server/; proxy_redirect off; proxy_buffering off; proxy_request_buffering off; allow all; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Proto $scheme; client_body_buffer_size 0; client_max_body_size 0; proxy_max_temp_file_size 0; proxy_read_timeout 18000; proxy_send_timeout 18000; gzip off; }
目前我正在使用Nginx 1.9.12。
我想要达到的目的是使Nginx不使用请求主体缓冲区,只需将请求主体直接传递给Madsonic,不pipe大小如何。 这甚至有可能吗? 如果是,那么正确的configuration是什么?
其他问题似乎用设置缓冲区大小的方法得到了答案。 我不想要任何缓冲区。 我想直接传递请求到Madsonic。
我有一个相同的问题,为Dockerregistry设置一个Nginx代理。 我结束了:
client_max_body_size 0; proxy_http_version 1.1; proxy_request_buffering off;
client_max_body_size仍然必须为0来防止错误,但是请watch -n 1 du -hs . 清楚地显示了一个区别 缓冲使得数据在请求之后出现,在请求期间不出现缓冲。
由于分块编码, proxy_http_version 1.1是必要的。 从Nginx文档引用:
当使用HTTP / 1.1分块传输编码发送原始请求体时,不pipe指令值如何,都会caching请求体,除非HTTP / 1.1已启用代理。