NGINX / Server Setup

Install NGINX RTMP module in CentOS/RHEL or Amazon Linux

by , , revisited on

We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

What is the NGINX RTMP module

The RTMP module for NGINX provides HLS and MPEG-DASH live streaming capabilities for those who want a lightweight solution based on the HTTP protocol. The stream is published in the MPEG-TS format over HTTP. This makes it possible to use all the power and flexibility of nginx HTTP configurations including SSL, access control, logging, request limiting, etc. MPEG-TS is a widely adopted, well known and well-documented streaming format.

You can use our repository to easily install the RPM package for the dynamic RTMP module for NGINX.
The dynamic module is compatible with the latest stable/mainline NGINX for CentOS/RHEL or Amazon Linux.

Step 1. Add GetPageSpeed extras YUM repository

Run the following command to add our repository:

sudo yum -y install

Step 2. Install NGINX and RTMP module

Then, all you have to do to install NGINX with the RTMP module:

sudo yum -y install nginx nginx-module-rtmp

Follow the installation prompt to import GPG public key that is used for verifying packages.

Step 3. Enable RTMP support in NGINX

Once you have installed the RTMP NGINX module package, it must be enabled.
You may want to simply follow the installer’s suggestion:


The nginx-module-rtmp has been installed.
To enable this module, add the following to /etc/nginx/nginx.conf
and reload nginx:

    load_module modules/;

Please refer to the module documentation for further details:


Doing so will enable NGINX to load the module and enable its directives.

Configure RTMP module

There are various ways you can use the module.

Simple Video-on-Demand

rtmp {
    server {
        listen 1935;
        application vod {
            play /var/flvs;

Forward live broadcast service

rtmp {
     listen 1935;
     chunk_size 4096;

     application live {
           live on;
           record off;
           push rtmp://[streamkeyfromtwitch];
           push rtmp://[streamkeyfromyoutube];

Re-translate remote stream with HLS support

rtmp {
    server {
        listen 1935;
        application tv {
            live on;

            hls on;
            hls_path /tmp/tv2;
            hls_fragment 15s;

            pull rtmp:// name=tv2;

http {
    server {
        listen 80;
        location /tv2 {
            alias /tmp/tv2;

Stream your X screen through RTMP

ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 -f flv rtmp://localhost/myapp/screen

For more details and examples, refer to the NGINX RTMP module project.

SELinux notes

The module pulls in an additional SELinux policy which allows NGINX to bind on RTMP port 1935.
So the module is fully compatible with SELinux.

Feels like something is still missing? Then continue reading on how to install PageSpeed module in NGINX 🙂

  1. mehman hm

    thank you master

  2. Joel

    Step 2:
    “No package nginx-module-rtmp available.”


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: