欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

srs音视频安装

程序员文章站 2022-07-01 17:39:32
...

安装

[yum/apt-get] install wget perl ntp ntpdate vim


对时

ntpdate 0.cn.pool.ntp.org


下载srs

    wget --no-check-certificate -c https://github.com/ossrs/srs/archive/v2.0-r2.tar.gz
    tar xzvf v2.0-r2.tar.gz
    cd srs-2.0-r2/trunk
    ./configure && make && make install

srs主配置

配置文件在 /usr/local/srs/conf/srs.conf

# main config for srs.
# @see full.conf for detail config.

listen              16635;
max_connections     10000;
srs_log_tank        file;
srs_log_file        ./objs/srs.log;
http_api {
	enabled         on;
	listen          16685;
}
http_server {
	enabled         on;
	listen          16680;
	dir             ./objs/nginx/html;
}
stats {
	network         0;
	disk            sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
	security{
		enabled         on;
		deny            play        all;
		allow           publish     all;
	}
	forward			xxx:16635 xxx:16635 xxx:16635 xxx:16635;
}

srs从配置

# main config for srs.
# @see full.conf for detail config.

listen              16635;
max_connections     10000;
srs_log_tank        file;
srs_log_file        ./objs/srs.log;

vhost __defaultVhost__ {
	security{
		enabled         on;
		allow            play        all;
		deny           publish     all;
	}
}

最大打开文件个数配置

修改/etc/security/limits.conf

* soft nofile 1048576
* hard nofile 1048576

防火墙配置

  • centos 6.9
    查看防火墙
    service iptables status
    开放tcp端口
    iptables -I INPUT -p tcp --dport 16635 -j ACCEPT
    iptables -I INPUT -p tcp --dport 16685 -j ACCEPT
    iptables -I INPUT -p tcp --dport 16680 -j ACCEPT
    保存配置
    service iptables save
    重启生效
    service iptables restart

  • centos 7.4
    查看防火墙
    firewall-cmd --state
    firewall-cmd --list-all
    开放tcp端口
    firewall-cmd --zone=public --permanent --add-port=16635/tcp
    重启
    service firewalld restart

开机上电

cp /usr/local/srs/etc/init.d/srs /etc/init.d/srs
ln -sf /etc/init.d/srs /etc/rc3.d/S70srs