How to Set Up a Video Stream with Nginx-RTMP
The fastest way to get a self-hosted live stream running on an offshore streaming server is Nginx with the RTMP module: free, battle-tested and light enough to leave most of your bandwidth for viewers. This walkthrough takes a fresh Ubuntu/Debian server to a working stream.
Step 1: Install Nginx with the RTMP module
sudo apt update
sudo apt install nginx libnginx-mod-rtmp
On Ubuntu and Debian the RTMP module ships as a package, so no compiling is needed.
Step 2: Configure the RTMP server
Add this block at the end of /etc/nginx/nginx.conf (outside the existing http block):
rtmp {
server {
listen 1935;
application live {
live on;
hls on;
hls_path /var/www/hls;
hls_fragment 3s;
}
}
}
Create the playback folder and reload:
sudo mkdir -p /var/www/hls
sudo chown www-data: /var/www/hls
sudo nginx -t && sudo systemctl reload nginx
Step 3: Serve the HLS playlist over HTTP
Inside your site’s server block, add a location so browsers and players can fetch the stream:
location /hls {
types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; }
root /var/www;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
Step 4: Push a stream from OBS
- In OBS, open Settings → Stream and choose “Custom”.
- Server:
rtmp://your-server-ip/live - Stream key: any name, e.g.
stream1— treat it like a password. - Click “Start Streaming”; playback is at
http://your-server-ip/hls/stream1.m3u8in any HLS player (VLC, hls.js, Video.js).
Before you go live for real
- Put the playback URL behind a domain with SSL, and restrict who can publish (the RTMP module supports
on_publishauth callbacks). - Size your port for the audience first — the math is in How Much Bandwidth Does a Streaming Platform Need?
- For large audiences in both Europe and Asia, run one server in each of our locations (Amsterdam and Hong Kong) and let viewers pick the closer one.
Need hardware for this? Our offshore streaming servers ship with 1–10 Gbps ports and are delivered ready for exactly this setup within 24–72 hours.