#下载
sudo wget http://nginx.org/download/nginx-1.14.0.tar.gz
sudo wget https://github.com/slact/nchan/archive/v1.1.15.tar.gz
#停止nginx
sudo nginx -s stop
#启动
sudo nginx
#重新加载配置
sudo nginx -s reload
#查看nginx进程
sudo ps aux |grep nginx
#杀死进程
sudo kill -9 [port]
#编译nginx 编译不同版本nchan
sudo ./configure --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_realip_module --with-http_sub_module --add-module=../nchan-1.1.15 && make
#1.1.12
sudo ./configure --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_realip_module --with-http_sub_module --add-module=../nchan-1.1.12 && make
#1.1.6
sudo ./configure --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_realip_module --with-http_sub_module --add-module=../nchan-1.1.6 && make
#备份nginx
sudo mv /usr/local/nginx/nginx /usr/local/nginx/nginx.bak/nginx.bak20180625
cp /home/shtermuser/nginx-1.12.2/objs/nginx /usr/local/nginx/
#编译后
sudo cp /home/shtermuser/nginx-1.14.0/objs/nginx /usr/local/nginx/
#编译后的nginx 文件
ll /home/shtermuser/nginx-1.14.0/objs/
备份文件
ll /usr/local/nginx/nginx.bak/
#测试nchan 是否成功
var ws = new WebSocket("ws://172.17.5.1127/sub?vid=2222");
ws.onmessage = function (evt)
{
var received_msg = evt.data;
console.log(received_msg);
};
curl -H "Content-Type:application/json" -X POST -d '{"type":"support","source":100,"data":{"videoId":2222,"videoUniqueId":"ab11a7b4-cdae-4a88-8b85-3be4020f7722","number":2}}' http://172.17.5.127/private/final_pub?vid=2222
var ws = new WebSocket("ws://192.168.0.65/sub?vid=2222");
ws.onmessage = function (evt)
{
var received_msg = evt.data;
console.log(received_msg);
};
curl -H "Content-Type:application/json" -X POST -d '{"type":"support","source":100,"data":{"videoId":2222,"videoUniqueId":"ab11a7b4-cdae-4a88-8b85-3be4020f7722","number":2}}' http://192.168.0.65/private/final_pub?vid=2222