
sites-available
當 RTMP 伺服器區塊在(連結到的符號)內的檔案中使用時,我在使用 RTMP 模組啟動 NGINX 時遇到問題sites-enabled
。 NGINX 設定檔全部位於/etc/nginx/
.
如果我直接在 中使用下面的 RTMP 伺服器區塊nginx.conf
,伺服器啟動得很好。但是,一旦我include /etc/nginx/sites-enabled/*;
從中的行中刪除註釋nginx.conf
, systemctl status nginx.service
就會返回"nginx: [emerg] "rtmp" directive is not allowed here in /etc/nginx/sites-enabled/livestream:1
rtmp {
server {
listen 1935;
chunk_size;
application obs_output {
live on:
record off;
}
}
}
這是我安裝 NGINX 和 RTMP 模組時遵循的兩個指南。
https://helpdeskgeek.com/linux-tips/create-your-own-live-video-streaming-server-with-linux/
https://www.scaleway.com/en/docs/setup-rtmp-streaming-server/
有什麼想法嗎?
提前謝謝了
答案1
我不相信您可以rtmp {}
從/etc/nginx/sites-enabled
目錄中聲明一個區塊。
預設情況下,該/etc/nginx/sites-enabled
目錄包含在現有http {}
區塊中。您可以透過查看來檢查這一點/etc/nginx/nginx.conf
。您不能在區塊rtmp
中包含區塊http
,它們需要彼此分開,因為它們是在同一層級聲明的。
唯一nginx
include
適合您的配置的是/etc/nginx/modules-enabled
目錄中的內容。