How to setup simple RTMP server on Nginx®

You need RTMP server to publish via RTMP protocol. We have successfully tested Noisypeak encoders with Wowza RTMP server, Adobe Media Server, Akamai RTMP publishing, YouTube RTMP publishing and Nginx server with RTMP module. If you already have your own RTMP server, some YouTube publishing point or an other RTMP publishing point you may pass this paper and go to Setup of broadcasting from UDP multicast to RTMP

Here we provide an simple example how to install Nginx with RTMP module to Ubuntu server 14.04 x64 to create your RTMP publishing point.

First you need to install all of required packets

sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

Let’s create the “working” folder:

mkdir ~/working
cd ~/working

Download the Nginx and Nginx-RTMP source:


Install the Unzip package:

sudo apt-get install unzip

Extract the Nginx and Nginx-RTMP source:

tar -zxvf nginx-1.7.5.tar.gz

Go to Nginx directory:

cd nginx-1.7.5

Add modules that Nginx will be compiled with:

./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master

Compile and install:

sudo make install

Install Nginx init scripts:

sudo wget -O /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults

Start and stop Nginx to create configuration files:

sudo service nginx start
sudo service nginx stop

To set up RTMP support you need to add rtmp{} section to /usr/local/nginx/conf/nginx.conf. Backup and replace your nginx.conf with the following sample config:



error_loglogs/error.log debug;

events {

http {
include mime.types;


server {
listen 8080;
# sample handlers
#location /on_play {
#if ($arg_pageUrl ~* localhost) {
#return 201;
#return 202;
#location /on_publish {
#return 201;

#location /vod {
#alias /var/myvideos;

# rtmp stat
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
location /stat.xsl {
# you can move stat.xsl to a different location
root /usr/build/nginx-rtmp-module;

# rtmp control
location /control {
rtmp_control all;

error_page 500 502 503 504/50x.html;
location = /50x.html {
root html;

rtmp {
server {
listen 1935;
ping 30s;
notify_method get;

application myapp {
live on;

# sample play/publish handlers
#on_play http://localhost:8080/on_play;
#on_publish http://localhost:8080/on_publish;

# sample recorder
#recorder rec1 {
#record all;
#record_interval 30s;
#record_path /tmp;
#record_unique on;

# sample HLS
#hls on;
#hls_path /tmp/hls;
#hls_sync 100ms;

# Video on demand
#application vod {
#play /var/Videos;

# Video on demand over HTTP
#application vod_http {
#play http://localhost:8080/vod/;


Then restart Nginx:

sudo service nginx restart

Your RTMP server is ready.

For publication to the RTMP server use this URL:  rtmp://server_name_or_IP/myapp/stream_name