在nginx中运行bash文件(.sh)

hfyxw5xn  于 5个月前  发布在  Nginx
关注(0)|答案(1)|浏览(87)

我想在我的Nginx服务器上运行一个Bash文件。该服务器接收RTMP流,Bash文件使用ffmpeg将其转换为不同的质量。该文件单独在终端中正常工作,并具有执行访问权限。
我写了这段代码来配置Nginx,但它不工作。

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        allow publish 127.0.0.1;
        deny publish all;

        application live {
            live on;
            record off;
        exec /my/path/to/transcode.sh $name;
        }
     }
 }

字符串

xurqigkl

xurqigkl1#

nginx配置中的exec指令应该包含在'push'块中。

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        allow publish 127.0.0.1;
        deny publish all;

        application live {
            live on;
            record off;
            push rtmp://your_destination_url;  # Add your destination URL here
            exec /my/path/to/transcode.sh $name;
        }
    }
}

字符串

相关问题