序言
使用SRS的边缘模式搭建服务器.系统是Centos7.(官网地址:https://github.com/ossrs/srs/wiki/v2_CN_SampleHttpFlv)
步骤[root@localhost cuiyaonan]# yum install -y git #为系统添加git
[root@localhost cuiyaonan]# git clone https://git.oschina.net/winlinvip/srs.oschina.git #下载srs
[root@localhost cuiyaonan]# cd srs.oschina/
[root@localhost srs.oschina]# git pull
[root@localhost srs.oschina]# git branch -a
[root@localhost srs.oschina]# git checkout 2.0release
[root@localhost srs.oschina]# cd trunk/
[root@localhost srs.oschina]# ./configure
[root@localhost srs.oschina]# ./make
如上就是把SRS安装成功了.
如下就是修改他的配置文件主源配置文件,边缘配置文件
主源配置文件#cuiyaonan.conf
listen 19350;
srs_log_tank file; #配置日志答应到文件,需要和srs_log_level配合使用
srs_log_file ./objs/srs.log; #制定日志文件的位置。
srs_log_level trace; #制定配置文件的级别,默认级别是trace
ff_log_dir ./objs; #工具日志
daemon on; #以daemon的方式启动,如果要启动在console,那么需要配置daemon off;并且,需要配置srs_log_tank console;
max_connections 1000; #最大连接数
pid objs/cuiyaonan.pid;
vhost __defaultVhost__ {
}
边缘配置文件
#cuiyaonan.conf
listen 19351;
srs_log_tank file; #配置日志答应到文件,需要和srs_log_level配合使用
srs_log_file ./objs/srs-edge.log; #制定日志文件的位置。
srs_log_level trace; #制定配置文件的级别,默认级别是trace
daemon on; #以daemon的方式启动,如果要启动在console,那么需要配置daemon off;并且,需要配置srs_log_tank console;
max_connections 1000; #最大连接数
pid objs/cuiyaonan-edge.pid;
#这个是http-flv的配置相关
http_server {
enabled on;
listen 8081;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
mode remote;
origin 127.0.0.1:19350;
#这个是http-flv的配置相关
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
hstrs on;
}
#这个是hls的配置
hls {
enabled on;
hls_fragment 10;
hls_window 60;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream].m3u8;
hls_ts_file [app]/[stream]-[seq].ts;
}
}
启动
[root@cuiyaonan2000@163.com trunk]# ./objs/srs -c ./conf/cuiyaonan.conf #启动主源配置
[root@cuiyaonan2000@163.com trunk]# ./objs/srs -c ./conf/cuiyaonan-edge.conf #启动边缘配置文件