【问题标题】:How to block other IP to use my rtmp-ffmpeg restreamed links?如何阻止其他 IP 使用我的 rtmp-ffmpeg 重流链接?
【发布时间】:2020-08-28 01:10:20
【问题描述】:

我使用 rtmp-ffmpeg 技术重新流式传输流,在etc/nginx/sites-available 我允许我的域显示我的流,就像这样:

server {
    listen   80; 

    #root /var/www/html/; 
    #index index.php index.html index.htm;

    server_name example.com; 

    location / {
    proxy_redirect off; 
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
    }

    location ~ /\.ht {
        deny all;
    }
}

但是每个人都可以在 vlc 或其他桌面播放器中播放我重新流式传输的链接/m3u8,这些链接也可以在xtream code 或其他rtmp-ffmpeg 脚本中再次重新流式传输。我的rtmp-ffmpeg 看起来像这样:

[program:test]
autorestart=true
command=/usr/bin/ffmpeg -hide_banner -i https://example.com/playlist.m3u8  -c copy -f hls -hls_time 4 -hls_flags append_list+delete_segments -hls_list_size 6 -hls_segment_filename '/etc/nginx/hls/test/file%%03d.ts' /etc/nginx/hls/test/playlist.m3u8

如何阻止其他人转发我的信息流?

【问题讨论】:

    标签: ffmpeg video-streaming http-live-streaming rtmp live-streaming


    【解决方案1】:

    我想对于经过身份验证的内容会有几种方法。

    您可以为您的受众使用动态链接。或许你也可以尝试在location中使用referer

    location / {
      valid_referers none blocked example.com www.example.com;
      if ($invalid_referer) { return 404; }
    
      #Some other stuff
      ...
    }
    

    【讨论】:

    • 谢谢,在哪里添加?
    • 添加到您要应用规则的位置。请我已经编辑了答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 2013-03-21
    • 1970-01-01
    • 2013-11-08
    • 2017-11-14
    • 2021-03-15
    • 2012-03-09
    相关资源
    最近更新 更多