给nginx加rtmp协议,网上写的都是重新编译安装,这样会比较麻烦,编译的时候会报很多依赖缺失的问题,这个其实是可以通过apt-get一键安装
参考:https://blog.csdn.net/kangear/article/details/83019640
sudo apt-get install software-properties-common python-software-propertiessudo add-apt-repository ppa:nginx/stablesudo apt-get updatesudo apt-get install nginx
然后安装rtmp
sudo apt-get install libnginx-mod-rtmp
centos7.x系列在编译安装过程中可能有n多个报错。。按照网上的方法。忽略报错即可,最后可能就是没法用systemctl命令去启动服务,这时只需要自己手动添加就好:
vim /usr/lib/systemd/system/nginx.service # 内容一般都是默认的
[Unit]Description=nginx - high performance web serverDocumentation=http://nginx.org/en/docs/After=network.target remote-fs.target nss-lookup.target[Service]Type=forkingPIDFile=/usr/local/nginx/logs/nginx.pidExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.confExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confExecReload=/bin/kill -s HUP $MAINPIDExecStop=/bin/kill -s QUIT $MAINPIDPrivateTmp=true[Install]WantedBy=multi-user.target
此时就可以使用:systemctl status/stop/start/restart nginx等命令进行相关操作
还没有人抢沙发呢~