• nginx 支持chunked


    http://www.weekface.info/2010/05/20/nginx

     

    HTTP协议有一种分块传输编码的机制(Chunked Transfer Encoding),即一个HTTP消
    息可以分成多个部分进行传输。它对HTTP请求和HTTP响应都是适用的, 我们在作这样一个项目的时候就遇到了这样的问题:J2ME作的客户端,server端是rails,但J2ME发送的HTTP request 的header Transfer-Encoding: chunked,即是以块传输的,Rails接受这样的数据有问题(报错:negative length -27 given),所以需要编译Nginx的时候处理下,要编译chunkin-nginx-module模块:

    wget http://github.com/agentzh/chunkin-nginx-module/tarball/v0.19
    tar zxvf agentzh-chunkin-nginx-module-cb610a5.tar.gz
    

    然后再:

    [root@li96-10 nginx-0.7.65]# ./configure --prefix=/usr/local/system/nginx --with-openssl=/usr/include --with-pcre=/usr/local/lib --with-http_stub_status_module --with-http_realip_module --add-module=/root/src/agentzh-chunkin-nginx-module-cb610a5
    [root@li96-10 nginx-0.7.65]# vim objs/Makefile
    ./configure --disable-shared #注释掉这行内容
    [root@li96-10 nginx-0.7.65]# make
    [root@li96-10 nginx-0.7.65]# make install
    

    下面来测试下安装:

    [root@li96-10 nginx-0.7.65]# vim /usr/local/system/nginx/conf/nginx.conf
    listen       8080; #暂时先改为8080端口
    chunkin on; #打开chunkin模块
    [root@li96-10 nginx-0.7.65]# /usr/local/system/nginx/sbin/nginx  #然后启动之
    [root@li96-10 nginx-0.7.65]# ps aux | grep nginx
    root     17379  0.0  0.1   3764   496 ?        Ss   11:44   0:00 nginx: master process /usr/local/system/nginx/sbin/nginx
    nobody   17380  0.0  0.2   3932   848 ?        S    11:44   0:00 nginx: worker process             
    root     17384  0.0  0.1   3916   692 pts/0    S+   11:44   0:00 grep nginx
    
  • 相关阅读:
    shell习题第21题:计算数字的个数
    shell习题第20题:统计文件大小
    萌新小白
    编程第一天
    萌新报道
    linux下安装php扩展pdo_oci和oci8
    安装Hadoop伪分布式踩过的坑
    zabbix安装过程
    MySQL_索引
    mysql复制
  • 原文地址:https://www.cnblogs.com/lexus/p/1903507.html
Copyright © 2020-2023  润新知