How to Install RTMP with Nginx on Ubuntu 14.04

Jose Velazquez
by Atlantic.Net (71posts) under HIPAA Compliant Cloud Hosting
0 Comments
Verified and Tested 09/3/15

Introduction

In this how-to we will walk you through the basic installation of an RTMP server using Ubuntu 14.04. RTMP stands for Real Time Messaging Protocol. This protocol has the ability to project or stream live videos, games, images and much more directly from your server and into the internet.

Prerequisites

You need a Ubuntu 14.04 server that is configured with a static IP address.

We must make sure that the server is up to date with the following command:

sudo apt-get update

We will also need unzip which can be installed with the following command:

sudo apt-get install unzip

Installing Nginx for use with RTMP

First, we need to get the correct build tools to lay the foundation. They can be installed with the
following command:

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

Once we have downloaded the build tools we need to begin with the web server. We will be using Nginx and it can be installed with the following command:

wget http://nginx.org/download/nginx-1.8.0.tar.gz

Now, unpack the tar.gz file that we just downloaded with the following command:

tar -zxvf nginx-1.8.0.tar.gz

Additionally, we need to install the RTMP module. This can be installed with the following command:

wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

Now, unzip the module file with the following command:

unzip master.zip

Once both packages are extracted, let us change our current directory to the Nginx directory with the following
command:

cd nginx-1.8.0

To complete the installation, we will need to build Nginx with the RTMP module with the following commands:

./configure --add-module=../nginx-rtmp-module-master
make
sudo make install

Finally, to conclude the installation, we must start Nginx so we can verify if there are no errors. Start nginx with the
following command:

sudo /usr/local/nginx/sbin/nginx

Then stop the service with the following command:

sudo /usr/local/nginx/sbin/nginx -s stop

Configure Nginx with RTMP

In order for Nginx to fully function with RTMP, we must configure it accordingly. Using you favorite text editor, open up your Nginx configuration file with the following command:

nano /usr/local/nginx/conf/nginx.conf

Now, since there are so many ways to configure RMTP, we will just cover enough information to get RTMP live and running forwarding the streams to anyone who requests it. Scroll to the bottom of the configuration file and pasted the following code:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

Now we must restart Nginx so all the configurations take effect with the following command:

sudo /usr/local/nginx/sbin/nginx -s reload

Additional Configurations

At this point, your server is all set up and configured with RMTP. However, to begin  streaming, you can download “Open Broadcaster Software” software free of charge and configure the broadcast settings to the following:

Streaming Service: Custom
Server: rtmp://your.ip.add.ress/live
Play Path/Stream Key: mystreamkey

Finally, to request the RTMP, type the following link replacing the information with yours:

rtmp://your.ip.add.ress/live/mystreamkey

What’s Next?

Congratulations! This completes our how-to Installing RTMP on Ubuntu 14.04. You are now ready to begin streaming live videos, games, images and much more. Thank you for following along this how-to! Check back with us for further updates.

Atlantic.Net

Atlantic.net offers HIPAA Cloud Hosting services which include a layer of business-essential managed services as part of your hosting package. Contact us today for more information.

Not sure what you need?

Get a free consultation today!

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources