流媒體服務器配置安裝SRS及nginx+rtmp


--------------------------thisisunsafe
yum install -y git
yum install -y gcc

git clone https://github.com/arut/nginx-rtmp-module.git

wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar -zxvf nginx-1.18.0.tar.gz

cd nginx-1.18.0
./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module
yum -y install pcre-devel

yum -y install openssl openssl-devel

make & make install

啟動操作
1、驗證nginx配置文件是否正確
方法一:進入nginx安裝目錄sbin下,輸入命令./nginx -t
看到如下顯示nginx.conf syntax is ok

nginx.conf test is successful

說明配置文件正確!
方法二、
/usr/nginx/sbin/nginx (/usr/nginx/sbin/nginx -t 查看配置信息是否正確)

重啟
進入nginx可執行目錄sbin下,輸入命令./nginx -s reload 即可

[root@localhost html]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost html]# /sbin/iptables -I INPUT -p tcp --dport 1935 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 5766 -j ACCEPT
[root@localhost html]# /etc/init.d/iptables save

[root@localhost html]# /etc/init.d/iptables restart

停止操作
停止操作是通過向nginx進程發送信號(什么是信號請參閱linux文 章)來進行的
步驟1:查詢nginx主進程號
ps -ef | grep nginx
在進程列表里 面找master進程,它的編號就是主進程號了。
步驟2:發送信號
從容停止Nginx:
kill -QUIT 主進程號
快速停止Nginx:
kill -TERM 主進程號
強制停止Nginx:
pkill -9 nginx

rtmp {
server {
listen 1935; #監聽的端口
chunk_size 4000;
application hls { #rtmp推流請求路徑
live on;
hls on;
hls_path /usr/share/nginx/html/hls;
hls_fragment 5s;
}
}
}

二、srs服務器操作
啟動:[root@localhost trunk]# ./objs/srs -c conf/srs.full.conf
查看日志:tailf ./objs/srs.log

三、掛載硬盤
查看磁盤:fdisk -l
新增硬盤:fdisk /dev/sdb
格式化:mkfs.ext4 /dev/sdb1
開始掛載到/work目錄下:mount -t ext4 /dev/sdb1 /work
開機自動掛載:vim /etc/fstab
最后加一行:/dev/sdb1 /work ext4 errors=remount-ro 0 1
[root@localhost /]# df -h
文件系統 容量 已用 可用 已用% 掛載點
devtmpfs 479M 0 479M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.5M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/mapper/centos_10-root 6.2G 5.7G 505M 93% /
/dev/sda1 1014M 171M 844M 17% /boot
tmpfs 100M 12K 100M 1% /run/user/42
tmpfs 100M 0 100M 0% /run/user/0
/dev/sdb1 21G 45M 20G 1% /work


免責聲明!

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



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