ubuntu16.04 一鍵安裝nginx-rtmp


給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等命令進行相關操作


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM