NGINX 上的 rtmp nodejs 服务器配置 _ nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)

rtmp nodejs server config on NGINX _ nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)

我在端口 1935 上有 media server 运行。

我有一个子域名:"streaming.foo.com"

我需要配置Nginx来访问rtmp://streaming.foo.com

我在这个博客上尝试了 RTMP Nginx 插件:

https://www.nginx.com/blog/video-streaming-for-remote-learning-with-nginx/

并配置了 /etc/nginx/nginx.conf 文件。

rtmp {
    server {
        listen 1935;
        application live {
            live on;
            dash on;
            dash_path /tmp/dash; // what is this config??
            dash_fragment 15s;
        }
    }
}

但是我从 nginx 得到这个错误:

nginx[176987]: nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)

您不能让两个服务侦听同一个端口。

常见的解决方案是在另一个端口(假设为 19350)上配置真实服务(您的媒体服务),而不是在 nginix 上配置反向代理以将请求从公开端口(在本例中为 1935)转发到 back-end 服务(在我们的示例中为 19350)。

抱歉,我不知道 nginix(我将此配置与 apache 一起使用)所以我无法帮助您如何在其上配置反向代理。

RTMP,不是HTTP。 Nginx 是一个 web 服务器,它只能代理和平衡 HTTP。它不是一般的代理服务器。

使用通用代理或负载平衡器,例如 HA Proxy