启用nginx的分块传输编码技术

10

看起来 nginx 0.8.35 可能支持分块传输编码

更改内容为 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利用分块传输编码以提高客户端效率

然而,我无法让它工作。 我正在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

以下是配置文件:

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个回答

10

3

我相信chunked_transfer_encoding默认是开启的。当将配置标记添加到server{}范围时,它可以正常工作,但放置在location{}范围无效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接