Setting Up a Private RTMP Ingest Server on Your VPS

Published on

How to build your own RTMP streaming relay server using Nginx. Covers installation, multi-platform restreaming, authentication, and recording capabilities.

Written by Space-Node Team – Infrastructure Team – 15+ years combined experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

An RTMP ingest server is the backbone of professional streaming infrastructure. Instead of sending your stream directly to Twitch, you send it to your own server, which then distributes it to multiple platforms.

RTMP streaming server infrastructure

Why Run Your Own RTMP Server?

| Feature | Direct to Twitch | Own RTMP Server | |---------|-----------------|-----------------| | Multi-platform | No (or paid service) | Yes, unlimited | | Recording | Twitch VOD only | Full quality local | | Custom processing | None | FFmpeg pipeline | | Redundancy | Single point of failure | Automatic failover | | Statistics | Platform-dependent | Full access |

Installation

On Ubuntu/Debian VPS:

apt update
apt install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev

Download and compile Nginx with the RTMP module:

wget http://nginx.org/download/nginx-1.24.0.tar.gz
git clone https://github.com/arut/nginx-rtmp-module.git
tar xzf nginx-1.24.0.tar.gz
cd nginx-1.24.0
./configure --add-module=../nginx-rtmp-module --with-http_ssl_module
make && make install

Configuration

Basic RTMP Relay

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        
        application live {
            live on;
            record off;
            
            # Push to Twitch
            push rtmp://live.twitch.tv/app/YOUR_TWITCH_KEY;
            
            # Push to YouTube
            push rtmp://a.rtmp.youtube.com/live2/YOUR_YOUTUBE_KEY;
            
            # Push to Kick
            push rtmp://fa723fc1b171.global-contribute.live-video.net/app/YOUR_KICK_KEY;
        }
    }
}

With Authentication

Prevent unauthorized streaming to your server:

application live {
    live on;
    
    on_publish http://localhost:8080/auth;
    
    push rtmp://live.twitch.tv/app/TWITCH_KEY;
}

Create a simple auth endpoint:

from flask import Flask, request

app = Flask(__name__)
VALID_KEY = "your_secret_streaming_key"

@app.route('/auth', methods=['POST'])
def auth():
    key = request.form.get('name')
    if key == VALID_KEY:
        return '', 200
    return '', 403

app.run(port=8080)

With Recording

Save a local copy of every stream:

application live {
    live on;
    
    record all;
    record_path /home/recordings;
    record_unique on;
    record_suffix -%Y%m%d-%H%M%S.flv;
    
    push rtmp://live.twitch.tv/app/TWITCH_KEY;
}

OBS Configuration

In OBS, set your streaming output to your VPS:

Server: rtmp://your-vps-ip/live
Stream Key: your_secret_streaming_key

Everything else (bitrate, encoder, resolution) stays the same as direct streaming.

Advanced: Transcoding

Re-encode the stream on the VPS for different quality levels:

application live {
    live on;
    
    exec_push ffmpeg -i rtmp://localhost/live/$name
        -c:v libx264 -preset veryfast -b:v 3000k -s 1280x720
        -c:a aac -b:a 128k
        -f flv rtmp://localhost/lowres/$name;
}

application lowres {
    live on;
    push rtmp://live.twitch.tv/app/TWITCH_KEY;
}

This ingests your high-quality stream and re-encodes a 720p version for platforms with lower quality requirements.

Monitoring

Add an RTMP statistics page:

http {
    server {
        listen 8080;
        
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
    }
}

Access http://your-vps-ip:8080/stat to see active streams, bitrates, client connections, and uptime.

VPS Sizing

| Use Case | CPU | RAM | Bandwidth | |----------|-----|-----|-----------| | Simple relay (no re-encoding) | 1 core | 1GB | Based on bitrate | | Relay + recording | 2 cores | 2GB | Based on bitrate | | Relay + transcoding (720p) | 4 cores | 4GB | 2x bitrate | | Relay + transcoding (1080p) | 6 cores | 4GB | 3x bitrate |

Simple relaying (no re-encoding) uses almost no CPU. A 1-core VPS can relay a 6Mbps stream to 3 platforms without breaking a sweat.

Your own RTMP server is the foundation of professional streaming infrastructure. Once it's running on a Space-Node VPS, you own your streaming pipeline instead of depending on third-party restreaming services.

Space-Node Team

About the Author

Space-Node Team – Infrastructure Team – Experts in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 15+ years combined experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

Our team specializes in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters. We maintain GDPR compliance and ISO 27001-aligned security standards.

View Space-Node's full team bio and credentials →

Start Streaming in Minutes

Join content creators worldwide who trust our streaming infrastructure. Setup is instant and support is always available.

Setting Up a Private RTMP Ingest Server on Your VPS