Welcome! Log In Create A New Profile

Advanced

nginx rtmp with ssl on domain

Posted by SirfPsycho 
nginx rtmp with ssl on domain
October 02, 2021 12:05AM
I used this tutorial for setup stream https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/

it works fine with http. http://f2.domain.com/hls/stream.m3u8
I want to setup with https like https://f2.domain.com/hls/stream.m3u8

I followed this: https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/

after getting ssl I edited nano /usr/local/nginx/conf/nginx.conf
and put in server field:

listen 8080;
server_name f2.domain.com;
ssl_certificate /etc/letsencrypt/live/f2.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/f2.domain.com/privkey.pem;

now when I send stream via ffmpeg it gives error:
[tcp @ 0x55702981e5e0] Connection to tcp://localhost:1935 failed: Connection refused
[rtmp @ 0x5570296970a0] Cannot open connection tcp://localhost:1935
rtmp://localhost/show/stream: Connection refused

I used below codes to send stream:
ffmpeg -re -i example-vid.mp4 -vcodec libx264 -vprofile baseline -g 30 -acodec aac -strict -2 -f flv rtmp://localhost/show/stream
--------------------------------
When I remove these below lines from /usr/local/nginx/conf/nginx.conf
server_name f2.domain.com;
ssl_certificate /etc/letsencrypt/live/f2.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/f2.domain.com/privkey.pem;

then stream runs fine with http. http://f2.domain.com/hls/stream.m3u8

I tried to replace listen 8080; to listen 443 ssl; then when I restart nginx it gives error:
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
---------------------------------
How can I use https? I tried to use https with server hostname but same error. I tried to use additional domain in conf after getting letsencrypt ssl but still same error. If I can use with hostname then it also be fine for me but with the https. Can you help me?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready