简体   繁体   English

NGINX _ nginx 上的 rtmp nodejs 服务器配置:[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)

I have media server running on port 1935.我在端口 1935 上运行媒体服务器

and I have a subdomain: "streaming.foo.com"我有一个子域: “streaming.foo.com”

I need to configure Nginx to access rtmp://streaming.foo.com我需要配置 Nginx 来访问rtmp://streaming.foo.com

I tried the RTMP Nginx plugin with this blog:我用这个博客尝试了 RTMP Nginx 插件:

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

and configured the /etc/nginx/nginx.conf file.并配置/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;
        }
    }
}

but I get this error from nginx:但我从 nginx 收到此错误:

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

It is RTMP , not HTTP .它是RTMP ,而不是HTTP Nginx is a web server, which can proxy and balance HTTP only. Nginx是web服务器,只能代理和平衡HTTP It is not a general proxy server.它不是一般的代理服务器。

Use a general Proxy or Load balancer, like HA Proxy .使用通用代理或负载均衡器,例如HA Proxy

You can't have two services listening on the same port.您不能让两个服务在同一个端口上侦听。

The common solution is to configure the real service (your media service) on another port (let's say 19350) than configure a reverse proxy on nginix to forward requests from the exposed port (1935 in this case) to the back-end service (19350 in our example).常见的解决方案是在另一个端口(比如说 19350)上配置真实服务(您的媒体服务),而不是在 nginix 上配置反向代理以将请求从暴露端口(在本例中为 1935)转发到后端服务(19350)在我们的示例中)。

Sorry but I don't know nginix (I use this config with apache) so I can't help you on how to configure a reverse proxy on it.抱歉,我不知道 nginix(我将此配置与 apache 一起使用),所以我无法帮助您了解如何在其上配置反向代理。

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

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