【问题标题】:nginx rtmp conf using argumentnginx rtmp conf 使用参数
【发布时间】:2020-01-07 14:17:51
【问题描述】:

我使用 nginx - rtmp 插件模块配置服务器。
问题是 rtmp 发布。

rtmp 插件模块支持“on_publish_done”命令。
https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_publish_done

我想要这样。
on_publish_done http://MY_SERVER/$APP/$NAME ;
在 nginx 配置文件(nginx.conf)中可以使用 $arg_XXX 值。
但是我的 conf 文件无法观察到值。只观察字符串“$arg_app”、“$arg_name”。
如何观察 $arg_app, $arg_name ??
这是我的 conf 文件。

# HTTP can be used for accessing RTMP stats
http {
    access_log /Users/steve/dev/workspace/nginx/logs/access.log;
    server {
    listen      8080;
      location /local_redirect {
        rewrite ^.*$ newname? permanent;
    }
      location /cast {
        # Serve HLS fragments
        types {
          application/vnd.apple.mpegurl m3u8;
          video/mp2t ts;
        }
        root /Users/steve/dev/workspace/nginx/tmp;
        add_header Cache-Control no-cache;

      }
    }
}
rtmp {
    access_log /PATH/nginx/logs/rtmp-access.log;
    server {
      listen 1935;
      chunk_size 4000;
      application cast {
                live on;
                publish_notify on;
                hls on;
                hls_path /PATH/workspace/nginx/out;
                hls_nested on;
                hls_fragment 1s;
                hls_playlist_length 12s;
      }
      notify_method get;
      on_publish_done http://127.0.0.1:5000/$arg_app/$arg_name ; ##PROBLEM HERE!!
    }
}

【问题讨论】:

  • 只传递“$app”和“$name”而不是$arg_app

标签: nginx rtmp nginx-config


【解决方案1】:

[下图显示位于字符 r 和 b 之间的带有下划线的变量运行良好! ][1]

对我来说,下面使用带有 -c 标志的 bash 命令的代码有效!兄弟试试吧

exec_publish_done bash -c "/var/hls/ex.sh ${name}";

【讨论】:

  • 您的图片链接未通过。您可以编辑答案以包含图像吗? (除非图像是代码,在这种情况下,它应该包含为文本,而不是屏幕截图。)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-14
  • 1970-01-01
相关资源
最近更新 更多