简体   繁体   English

NGINX open() 失败 (20: Not a directory) hls vod with secure link module

[英]NGINX open() failed (20: Not a directory) hls vod with secure link module

I have a problem with nginx config for hls streaming.我对 hls 流的 nginx 配置有问题。 I use kaltura nginx vod module and try to add ngx_http_secure_link_module to protect the stream.我使用kaltura nginx vod 模块并尝试添加ngx_http_secure_link_module来保护流。 The strange thing is I have 404 error if I enable ngx_http_secure_link_module (logs below).奇怪的是,如果我启用ngx_http_secure_link_module (下面的日志),我会出现 404 错误。 I think that is because it can't find a file with index.m3u8 on the end, but if I comment secure link block it works fine.我认为这是因为它在末尾找不到带有 index.m3u8 的文件,但是如果我评论安全链接块,它就可以正常工作。

Also I tried to add alias inside location ~ \\.m3u8$ {} block, but it didn't work.我也尝试在location ~ \\.m3u8$ {}块中添加别名,但没有用。 What am I doing wrong?我究竟做错了什么? How to protect my stream?如何保护我的流?

My stream link: https://stream.example.com/hls/c14de868-3130-426a-a0cc-7ff6590e9a1f/index.m3u8?md5=0eNJ3SpBd87NGFF6Hw_zMQ&expires=1609448340我的直播链接: https://stream.example.com/hls/c14de868-3130-426a-a0cc-7ff6590e9a1f/index.m3u8?md5=0eNJ3SpBd87NGFF6Hw_zMQ&expires=1609448340 : https://stream.example.com/hls/c14de868-3130-426a-a0cc-7ff6590e9a1f/index.m3u8?md5=0eNJ3SpBd87NGFF6Hw_zMQ&expires=1609448340

My NGINX config:我的 NGINX 配置:

server {
  listen 9000;
  server_name localhost;
  # root /srv/static;

  location ^~ /hls/ {
    # the path to c14de868-3130-426a-a0cc-7ff6590e9a1f file
    alias /srv/static/videos/1/;
    # file with cors settings
    include cors.conf;

    vod hls;

    # 1. Set secret variable
    set $secret "s3cr3t";

    # 2. Set secure link
    secure_link $arg_md5,$arg_expires;
    secure_link_md5 "$secure_link_expires $secret";

    # if I comment this block everything works fine (but security)
    location ~ \.m3u8$ {
      if ($secure_link = "") { return 403; }
      if ($secure_link = "0") { return 403; }
    }
  }
}

NGINX logs: NGINX 日志:

cmdlogs

Just moved out this block to server directory and added vod hls;刚刚将此块移出到服务器目录并添加了vod hls; inside.里面。

location ~ \.m3u8$ {
  include cors.conf;
  vod hls;

  if ($secure_link = "") { return 403; }
  if ($secure_link = "0") { return 403; }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM