一键安装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,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号