srs部署小结

安装

[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-r5.tar.gz
    tar xzvf v2.0-r5.tar.gz
    cd srs-2.0-r5/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			128.1.201.x:16635 128.1.202.x: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

你可能感兴趣的:(srs,Linux)