带有 rtmp 的 Nginx 无法在 GCP 上运行。无法接收传入流

问题描述 投票:0回答:1

我通过

从源代码编译了 nginx 和 nginx-rtmp 模块
git clone https://github.com/arut/nginx-rtmp-module.git
git clone https://github.com/nginx/nginx.git

我按照这个教程

做了这个

我的配置如下


user  nobody;

worker_processes  auto;
pid /run/nginx.pid;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        allow publish all;
        application live {
            live on;
            record off;
        }
    }
}

防火墙:

sudo ufw allow 1935/tcp

但是,我无法通过 ffmpeg 将流从我的计算机推送到此 GCP RTMP 服务器,它不断抛出无法打开 tcp 连接错误。

[tcp @ 000001dc6449dac0] Connection to tcp://ipaddress:1935?tcp_nodelay=0 failed: Error number -138 occurred
[rtmp @ 000001dc6449d5c0] Cannot open connection tcp://ipaddress:1935?tcp_nodelay=0
rtmp://ipaddress/live/bbb: Error number -138 occurred

这是我的启动命令:

ffmpeg -re -i video.mp4 -vcodec copy -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp://{gcp.ipaddress}/live/bbb

我试图创建的只是一个简单的 RTMP 服务器端点,我的应用程序可以使用 RTMP 将视频流式传输到 GCP 或从 GCP 流式传输视频,没有像 HLS 那样花哨的东西或任何需要进一步复杂配置的类型

我尝试添加

allow publish all;
sudo ufw allow 1935
。但结果还是一样。

nginx nginx-config rtmp nginx-rtmp
1个回答
0
投票

据我所知,防火墙设置是在 GCP 控制台本身配置的,而不是在虚拟机上配置的。也许这份文档可以指导您: Google 防火墙策略设置

© www.soinside.com 2019 - 2024. All rights reserved.