指令 "events" 在 /etc/nginx/nginx.conf 中没有开头的“{”

directive "events" has no opening "{" in /etc/nginx/nginx.conf

我正在尝试使用 tiangolo/nginx-rtmp 设置一个 RTMP 服务器,但是当我尝试 运行 docker-compose up 时似乎出现了以下错误:

Attaching to rtmp_server
rtmp_server | 2021/08/29 22:25:57 [emerg] 1#1: directive "events" has no opening "{" in /etc/nginx/nginx.conf:5
rtmp_server | nginx: [emerg] directive "events" has no opening "{" in /etc/nginx/nginx.conf:5
rtmp_server exited with code 1

理论上它应该是 nginx.conf 第 5 行缺少的 {,但我的 nginx.conf 看起来像这样:

worker_processes auto;
rtmp_auto_push on;
events{} # Tried events { }, events{ } but none seem to work
rtmp {
    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;

        application live {
            live on;
            record off;

        }
    }
}

运行 nginx -t returns:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

出于某种原因 docker-compose 构建没有通过并且没有给我任何错误,因此它正在更新我的更改。重启后一切正常。