給nginx加rtmp協議,網上寫的都是重新編譯安裝,這樣會比較麻煩,編譯的時候會報很多依賴缺失的問題,這個其實是可以通過apt-get一鍵安裝
參考:https://blog.csdn.net/kangear/article/details/83019640
sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo 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 server Documentation=http://nginx.org/en/docs/ After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
此時就可以使用:systemctl status/stop/start/restart nginx等命令進行相關操作