I'm having problems getting NGINX with the RTMP module to start when the RTMP server block is used within a file inside the sites-available (symbolic linked to sites-enabled). NGINX configuration files are all located at /etc/nginx/.

If I use the below RTMP server block directly in the nginx.conf, the server starts up perfectly fine. However, as soon I remove the comment from the line include /etc/nginx/sites-enabled/*; in the nginx.conf, systemctl status nginx.service comes back with"nginx: [emerg] "rtmp" directive is not allowed here in /etc/nginx/sites-enabled/livestream:1

rtmp {
    server {
        listen 1935;

        application obs_output {
            live on:
            record off;

These are the two guides I followed to install NGINX and the RTMP module.

Any ideas what's going on here please?

Many thanks in advance


I do not believe you can declare an rtmp {} block from within the /etc/nginx/sites-enabled directory.

By default, the /etc/nginx/sites-enabled directory is included within an existing http {} block. You can check this by looking at /etc/nginx/nginx.conf. You cannot have the rtmp block within the http block, they need to be separate from each other as they are declared at the same level.

The only nginx include that may fit your config would be from within the /etc/nginx/modules-enabled directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.