0

My nginx configuring is below:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                        hls on;
                        hls_path /var/www/html/stream/hls;
                        hls_fragment 3;
                        hls_playlist_length 60;
                }
        }
}

Above code was worked well, but when I have bind domain with server_name, then it doesn't work.

rtmp {
        server {
                listen 1935;
                server_name example.com;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                        hls on;
                        hls_path /var/www/html/stream/hls;
                        hls_fragment 3;
                        hls_playlist_length 60;
                }
        }
}

above code is not working, coz, I have added server_name

getting this error:

nginx: [emerg] "server_name" directive is not allowed here in /etc/nginx/nginx.conf:95
nginx: configuration file /etc/nginx/nginx.conf test failed

Any faced same problem before? i googled, I couldn't find any solution for this?

anyone know this? how can I restrict to specific domain

anamul
  • 13
  • 4
  • RTMP protocol does not make use of the server hostnames or anything similar. Moreover, specifying a server name within the HTTP(S) server block you are not restricting access to anything other than specified hostnames, that kind of restriction usually made using some kind of additional catch-all server block to answer any request with the invalid (or missing) `Host` HTTP request header. – Ivan Shatsky Jul 03 '22 at 07:33
  • Can you please tell me where to restrict this? – anamul Jul 04 '22 at 03:17

0 Answers0