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?