Cannot get RTMP to work

Francis Daly francis at daoine.org
Sat Dec 26 18:38:27 UTC 2020


On Fri, Dec 25, 2020 at 02:20:33AM -0500, brianbotkiller wrote:

Hi there,

> I have followed the tutorial found here: 
> https://www.nginx.com/blog/video-streaming-for-remote-learning-with-nginx/#installing-nginx-dependencies
> 
> To the best of my ability (it has some distinct holes in it), and some other
> tutorials that I have found. I cannot get RTMP to work with nginx. 

It does not matter just yet, but in case it remains a problem:

it will probably be useful if you can show exactly what you did do,
and what responses you got when you did things; just in case one of the
distinct holes is directly relevant to making things work.

> I am running a VPS with Ubuntu. I have installed the RTMP module. 
> 
> I have worked to edit the nginx.conf file as best as I can, but I don't
> understand why this file seems to reside in multiple locations, and I don't
> understand which of them I am to edit to add the RTMP configuration -- this
> is totally missing from the tutorial and I cannot find a straight answer
> about this. 

nginx, when run, uses exactly one conf file.

If you do not specify which conf file to use when you are calling the
nginx binary, it will use its compile-time value.

"nginx -V" should show the compile-time options that were provided;
"--conf-path=" is the conf file if it is set; otherwise it is something
based on "--prefix=" or on code defaults.

"nginx -t" or "nginx -T" will usually name the compile-time default conf
file that your nginx binary has.

"ps -ef | grep [n]ginx" should show the running "master process" and
whatever run-time arguments it was given -- "-c" there names the conf
file that this nginx instance is using.

So you will want to identify what one conf file your nginx is currently
using, and make changes there before reloading it.

> As it stands right now, I've added 
> 
> rtmp {
>         server {
>                 listen 1935;
>                 chunk_size 4096;
> 
>                 application live {
>                         live on;
>                         record off;
>                 }
>         }
> }
> 
> to the end of the config file found in /usr/local/nginx/conf, and I've ran
> nginx -t to ensure that it is configured properly -- nginx spits back that
> it is. I have stopped/started the service. I've run a port scan to ensure
> that it is listening on port 80 -- it is. 

Does "nginx -t" show the name of the config file that you edited as
being the config file that it is using?

Your rtmp system wants to listen on port 1935. Does "netstat -pant |
grep 1935" (or your system's equivalent) show that there is a port 1935
listener? If not, something is wrong.

> I am trying to stream using OBS via RTMP. I set OBS to use my server IP/live
> and no matter what, I get an error from OBS that it cannot connect to
> server. 

If you do not have a port-1935 listener on your server, that's the first
thing to fix.

If you do have a listener, then probably you should "tcpdump" on your
system to see if you can see what traffic is happening -- do your client
requests get as far as your server, or are they blocked somewhere before
it? If they get to your server, does your server block them from getting
to your nginx?

> I am lost as to what to do here and am looking for help. 

Basically, take it step by step.

Decide (or learn) what one specific thing should happen, and then look and
see if it does happen. If it does not happen, find out why, and fix it.

It's hard to give more specific advice than that, without knowing what
state things are in at the start.

Hopefully this at least points you in the right direction.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list