sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx -y
sudo apt-get install libnginx-mod-rtmp -y
sudo nano /etc/nginx/nginx.conf
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://127.0.0.1:1936/rtmp/<<Facebook persistent stream key >>;
}
}
}
sudo systemctl restart nginx
OBS Stream configuration
Settings>>Stream
Service: Custom Server: rtmp://<>/live Stream Key: test VLC Configuration
Open Network Stream>>Network
Please enter a network URL: rtmp://<>/live/test
sudo apt-get install stunnel4 -y
#Edit stunnel auto boot configuration
sudo nano /etc/default/stunnel4
ENABLE=1
sudo nano /etc/stunnel/stunnel.conf
pid = /var/run/stunnel4/stunnel.pid
output = /var/log/stunnel4/stunnel.log
setuid = stunnel4
setgid = stunnel4
# https://www.stunnel.org/faq.html
socket = r:TCP_NODELAY=1
socket = l:TCP_NODELAY=1
debug = 4
[fb-live]
client = yes
accept = 1936
connect = live-api-s.facebook.com:443
verifyChain = no
sudo systemctl enable stunnel4.service
sudo systemctl restart stunnel4.service
when i add rtmp part to nginx.conf i get this error
Aug 13 17:12:54 cdn-lt92 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 13 17:12:54 cdn-lt92 nginx[8187]: nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:84
Aug 13 17:12:54 cdn-lt92 nginx[8187]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 13 17:12:54 cdn-lt92 systemd[1]: nginx.service: Control process exited, code=exited status=1
Aug 13 17:12:54 cdn-lt92 systemd[1]: nginx.service: Failed with result 'exit-code'.
Aug 13 17:12:54 cdn-lt92 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
root@cdn-lt92:~/nginx#