启用Nginx分块传输编码 [英] Enabling nginx Chunked Transfer Encoding

查看:125
本文介绍了启用Nginx分块传输编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nginx 0.8.35可能支持分块传输编码:

使用nginx 0.8.35进行的更改2010年4月1日

Changes with nginx 0.8.35 01 Apr 2010

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

*) Feature: the "chunked_transfer_encoding" directive.

这很棒,因为我正在尝试通过nginx反向代理将git更改推到git-http-backend进程.出于客户端效率方面的考虑,Git HTTP利用分段传输编码 .

This is great, because I'm trying to get push git changes through an nginx reverse proxy to a git-http-backend process. Git HTTP takes advantage of chunked transfer encoding for client-side efficiency reasons.

但是,我无法正常工作.我在Debian Lenny上使用nginx 0.8.44,并进行以下配置调用:

However, I can't get it to work. I'm using nginx 0.8.44 on Debian Lenny with the following configure invocation:

./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文件:

And the following conf file:

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;

推荐答案

我在ServerFault上问了同样的问题,并得到了以下答案:

I asked the same question on ServerFault and got this answer:

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

这篇关于启用Nginx分块传输编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆