Installing Nginx RTMP Module on Ubuntu
The easiest way to build a basic RTMP server on Ubuntu is to use Nginx with the RTMP module. Nginx handles the network service, while the RTMP module adds streaming features such as applications, stream names, HLS output, recording and relay options.
Step 1: Log in to your Ubuntu VPS over SSH as a user with sudo access. Avoid working directly as root unless you understand the risks.
Step 2: Update Ubuntu first:
sudo apt update && sudo apt upgrade -y
Step 3: Install Nginx and the RTMP module:
sudo apt install nginx libnginx-mod-rtmp -y
Step 4: Confirm Nginx is running:
sudo systemctl status nginx
Step 5: Create or edit an RTMP configuration file. A common location is:
/etc/nginx/conf.d/rtmp.conf
Step 6: Add a simple RTMP application:
rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; } } }
Step 7: Test the configuration:
sudo nginx -t
Step 8: Reload Nginx:
sudo systemctl reload nginx
Step 9: Open the firewall:
sudo ufw allow 1935/tcp
Once installed, test from OBS using rtmp://your-server-ip/live as the server and a stream key such as test. If Nginx rejects the configuration, check that the RTMP module is actually installed and that your braces are correctly closed. Most first-time errors are caused by a missing semicolon or placing the RTMP block inside the wrong part of the config.
Hosting tip: For Online Audience style hosting guides, remind users to test changes outside busy broadcast times, keep a backup of the last working configuration, and avoid exposing admin services publicly. A clear checklist, sensible firewall rules and careful bitrate choices will prevent most support issues before they happen.