启用nginx Chunked Transfer编码

时间:2010-07-11 05:42:37

标签: nginx chunked-encoding

看起来像nginx 0.8.35 may support chunked transfer encoding

  

随着nginx的变化0.8.35 2010年4月1日

*) Change: now the charset filter runs before the SSI filter.

*) Feature: the "chunked_transfer_encoding" directive.

这很好,因为我试图通过nginx反向代理将git更改推送到git-http-backend进程。 Git HTTP利用了分块传输编码for client-side efficiency reasons

然而,我无法让它发挥作用。我在Debian Lenny上使用nginx 0.8.44,并进行以下配置调用:

./configure \
--sbin-path=/usr/sbin \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--user=www-data \
--group=www-data \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module

以下conf文件:

server {
    server_name example.com;
    location / {
        proxy_pass  http://192.168.0.10;
        include     /etc/nginx/proxy.conf;
        chunked_transfer_encoding on;
    }
}

我的proxy.conf看起来像这样:

proxy_redirect          off;
proxy_set_header        Host $host;
proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size    100M;
client_body_buffer_size 128k;
proxy_connect_timeout   90;
proxy_send_timeout      90;
proxy_read_timeout      90;
proxy_buffer_size       4k;
proxy_buffers           4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

2 个答案:

答案 0 :(得分:8)

我在ServerFault上问了同样的问题并得到了这个答案:

https://serverfault.com/questions/159313/enabling-nginx-chunked-transfer-encoding/187573#187573

答案 1 :(得分:2)

我相信chunked_transfer_encoding默认开启。配置标志在添加到服务器{}范围时可正常工作,并且在放置在{}范围内时无效。