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

hfyxw5xn  于 2024-01-06  发布在  Nginx
关注(0)|答案(1)|浏览(200)

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

  1. rtmp {
  2. server {
  3. listen 1935;
  4. chunk_size 4096;
  5. allow publish 127.0.0.1;
  6. deny publish all;
  7. application live {
  8. live on;
  9. record off;
  10. exec /my/path/to/transcode.sh $name;
  11. }
  12. }
  13. }

字符串

xurqigkl

xurqigkl1#

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

  1. rtmp {
  2. server {
  3. listen 1935;
  4. chunk_size 4096;
  5. allow publish 127.0.0.1;
  6. deny publish all;
  7. application live {
  8. live on;
  9. record off;
  10. push rtmp://your_destination_url; # Add your destination URL here
  11. exec /my/path/to/transcode.sh $name;
  12. }
  13. }
  14. }

字符串

展开查看全部

相关问题