一键安装nginx_http_push_module
cd /opt/ && wget https://github.com/slact/nginx_http_push_module/archive/master.zip && unzip master.zip && cd (/opt/nginx-master | 替换成你的ngnix源码目录) && ./configure --add-module=/opt/nginx_http_push_module-master
nginx.conf 中添加
location /pub {
push_publisher;
set $push_channel_id $arg_id;
push_store_messages off;
}
location /sub {
push_subscriber;
set $push_channel_id $arg_id;
}
测试如下 左侧变成长连接了
点击send按钮后
nginx 安装 nginx_http_push_module
原文地址:http://blog.csdn.net/starparker/article/details/42238917