显然 Nginx 现在支持分块,但是当平板设备向 Nginx 发送分块请求时,我收到错误“411 Length Required”。关于如何配置 Nginx 以支持分块的任何建议?我正在使用 v.1.3.9。
我知道有人问过类似的问题,但那是在 2010 年 Nginx 支持分块之前。
我的 nginx.conf:
master_process off;
worker_processes 1;
daemon off;
pid /usr/nginx/logs/nginx.pid;
events {
worker_connections 1024;
}
http {
ngao_filters_directory /usr/nginx/filters;
include mime.types;
default_type application/octet-stream;
# prevent caching by client
add_header Cache-Control "no-store, no-cache";
sendfile on;
keepalive_timeout 65;
server {
listen 8081;
server_name localhost;
client_max_body_size 3m;
chunked_transfer_encoding on;
scgi_temp_path /usr/nginx/scgi_temp;
uwsgi_temp_path /usr/nginx/uwsgi_temp;
location / {
proxy_buffering off;
proxy_pass http://10.0.2.20:79;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} } }
Run Code Online (Sandbox Code Playgroud)
(发布回复是因为我还不能发表评论。需要 >50 声望)
你应该读一下这个。
诀窍是
proxy_buffering off;
在您的位置块中进行设置。
^--- 我看到你已经尝试过这个。
Nginx 目前不支持分块 POST 请求 [...]
我发现的唯一可行的解决方案是: http:
//wiki.nginx.org/HttpChunkinModule
^--- 但我认为这是你最好的选择。不过这意味着你需要编译 nginx