SRS4.0.85流媒体搭建及HTTPS代理

下载SRS4.0.85 :git clone -b v4.0.85 https://gitee.com/ossrs/srs.git

服务器配置参考链接:1-SRS 4.0开发环境搭建:包括推流、服务器配置、拉流测试 - 知乎

webRTC延迟基本在1s内,配置好webrtc文件后可用obs推流,见文Windows+nginx+rtmp+OBS中obs推流

另注:服务开启命令:./objs/srs -c conf/rtc.conf

          将公网IP改到rtc.conf中的candidate 47.108.xx.xx;

         按照配置文件说明开放端口(linux):

iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
#如国标平台接入需开udp-5060端口,否则获取不到画面
iptables -I INPUT -p udp --dport 5060 -j ACCEPT
#最后不要忘
iptables-save

nginx作Https代理

nginx配置文件如下,将nginx证书与密钥配置好即可。

先开启nginx服务再开启srs服务

如果nginx没有http2模块,运行以下命令

#安装http2模块
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module
#直接make不覆盖编译
make
#启动命令
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/srsnginx.conf
#nginx.conf配置文件
worker_processes  1;
events {
    worker_connections  1024;
}
​
http {
    include             /etc/nginx/mime.types;
​
    server {
        listen       80;
        listen       443 ssl http2;
        server_name  _;
        ssl_certificate      /usr/local/srs/conf/server.crt;
        ssl_certificate_key  /usr/local/srs/conf/server.key;
​
        # For SRS homepage, console and players
        #   http://r.ossrs.net/console/
        #   http://r.ossrs.net/players/
        location / {
           proxy_pass http://127.0.0.1:8080/;
        }
        # For SRS streaming, for example:
        #   http://r.ossrs.net/live/livestream.flv
        #   http://r.ossrs.net/live/livestream.m3u8
        location ~ /.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
           proxy_pass http://127.0.0.1:8080$request_uri;
        }
        # For SRS backend API for console.
        location /api/ {
           proxy_pass http://127.0.0.1:1985/api/;
        }
        # For SRS WebRTC publish/play API.
        location /rtc/ {
           proxy_pass http://127.0.0.1:1985/rtc/;
        }
    }
}

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值