Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the RTMP block be used inside the sites-enabled directory? #1492

Open
firewire10000 opened this issue Apr 1, 2020 · 5 comments
Open

Comments

@firewire10000
Copy link

My RTMP block works perfectly inside the /etc/nginx/nginx.conf but as soon as I add it into a file under /etc/nginx/sites-enabled directory I get error messages. My simple question can RTMP blocks be read from the sites-enabled directory? If so how do I get it to work please?

@Lax
Copy link

Lax commented Apr 1, 2020

rtmp block must be put in root context.
If you put the configuration inside sites-enabled, it is included in http {} context, which will not work.

see https://github.com/arut/nginx-rtmp-module/wiki/Directives#rtmp

@firewire10000
Copy link
Author

firewire10000 commented Apr 1, 2020

rtmp block must be put in root context.
If you put the configuration inside sites-enabled, it is included in http {} context, which will not work.

see https://github.com/arut/nginx-rtmp-module/wiki/Directives#rtmp

Can the sites-enabled be excluded from the HTTP block and still be picked by the nginx.conf still, or will it not work that way?

Inside the /etc/nginx/nginx.conf could I place the following?

rtmp {
    include /etc/nginx/sites-enabled/*
}

@Lax
Copy link

Lax commented Apr 2, 2020

Please do not do this kind of mixing files, they are different kind, it will make things complicated and error prone.

http {
  include sites-enabled/*.conf;
}

rtmp {
  include rtmp-enabled/*.conf;
}

anyway, if you still want to put them in same folder, you can use different file name pattern(for example different file name extension).

http {
  include sites-enabled/*.conf;
}

rtmp {
  include sites-enabled/*.rtmp;
}

@firewire10000
Copy link
Author

Sadly appending an extension to the file that holds my RTMP block and then modifying the nginx.conf file still doesn't work.

nginx: [emerg] "rtmp" directive is not allowed here in /etc/nginx/sites-enabled/livestream.rtmp:3

@pyk
Copy link

pyk commented Apr 10, 2020

@firewire10000 You are redefining rtmp directive inside rtmp, that's why the error happen.

If your /etc/nginx/sites-enabled/*.rtmp files contains the following:

rtmp {
    server {
        listen 1935;
        application live {
            live on;
        }
    }
}

You should remove the rtmp directive:

    server {
        listen 1935;
        application live {
            live on;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants