Question

How to use rtmp

Hello! Dear Community members.

So I have set up a Digital Ocean Droplet to host A node app, or two of them more precisely.

I use Nginx to serve localhost:8000 (which is the main app) for /main/ locations.

Also, I have node-media-server app running on localhost:8888 and localhost:1935, I successfully show the admin panel provided by the package using the same Nginx

But how can I also listen on 1935 port and pass the traffic to node-media-server?

Ideally, I want to be able to stream to my app using OBS like this

rtmp://my-ip:1935/live/{stream_key}

and receive the RTMP with my node-media-server.

PS. I don’t have a domain currently.

Please let me know if You need more details.

upstream media {
   server 127.0.0.1:8888;
}


upstream main {
   server 127.0.0.1:8000;
}

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	root /var/www/html/challenger;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name hellonode;

	location ^~ /assets/ {
		gzip_static on;
		expires 12h;
		add_header Cache-Control public;
  }

        location /main/  {
        	proxy_pass          http://localhost:8000/;
        	#proxy_http_version  1.1;
        	#proxy_set_header    Host                $http_host;
        	#proxy_set_header    Upgrade             $http_upgrade;
        	#proxy_set_header    Connection          "Upgrade";
        	#proxy_set_header    X-Real-IP           $proxy_protocol_addr;
        	#proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
        	#proxy_set_header    X-Forwarded-Proto   tcp;
           	#proxy_set_header    X-NginX-Proxy       true;
        }

	location / {
		proxy_http_version 1.1;
		proxy_cache_bypass $http_upgrade;

		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection 'upgrade';
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;

		proxy_pass http://media;
	}
}

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer