How To Use The NGINX RTMP Module To Setup A Streaming Server
Có thể bạn quan tâm
Complete the form below and one of our experts will contact you within 24 hours or less. For immediate assistance contact us or chat now.
Full Name * Email * Company Website URL Phone Number When will you need these service(s)? * Choose a value1 week2 weeks3 weeks4 weeks4 weeks+ How can we assist you? * I wish to receive news and exclusive server offers from ServerMania. You can opt-out at any time.We promise not to sell, trade or use your email for spam. View our Privacy Policy .
Request a quote nowHomeHow ToHow to Use the NGINX RTMP Module to Setup a Streaming Server
One of the most common video streaming protocols is an HLS Streaming Server. HLS is an adaptive streaming technology which allows you to stream media content that is tailored to the user’s device and network conditions for the best streaming performance.
HLS and RTMP can be easily integrated with the Nginx web server using the Nginx RTMP module. In this tutorial, we’ll show you how to setup an HLS live streaming server on Ubuntu.
See Also: ServerMania Media Streaming Server Solutions
Table of Contents Hide 1. What is Nginx RTMP? 2. Server Requirements 3. Installation Instructions 3.1. Step 1: Login via SSH to the server 3.2. Step 2: Download required software 3.3. Step 3: Clone Module 3.4. Step 4: Download Nginx 3.5. Step 5: Configure Nginx 3.6. Step 6: Configure Nginx 3.7. Step 7: Start Nginx 3.8. Step 8: Start Streaming 3.9. Step 9: Integrate into Player 4. Deploying An Nginx RTMP ServerWhat is Nginx RTMP?
Nginx RTMP is an Nginx module which allows you to add RTMP and HLS streaming to your media server. Previously, the RTMP and HLS modules were seperate Nginx modules, but they can now all be added to Nginx as a single module.
See Also: (Live Webinar) Meet ServerMania: Transform Your Server Hosting Experience
Server Requirements
- Ubuntu OS (May work on other Operating Systems with command modifications)
- Minimum 2GB RAM
- Disk space as required for any media files
- ServerMania Hybrid or Dedicated Server
Installation Instructions
Step 1: Login via SSH to the server
Login as root or a user with sudo access on the server. If you are using a user with sudo access, then add sudo before each command in the tutorial:
ssh root@server-ipStep 2: Download required software
Start by updating the apt repository:
apt-get updateIf this is a new server, you should consider updating the system software:
apt-get UpgradeWe’ll then install the required software:
apt-get install -y git build-essential ffmpeg libpcre3 libpcre3-dev libssl-dev zlib1g-devStep 3: Clone Module
Install the clone module:
git clone https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.gitStep 4: Download Nginx
Copy the latest download link from the Nginx website and decompress the files:
wget http://nginx.org/download/nginx-1.17.6.tar.gztar -xf nginx-1.17.6.tar.gzcd nginx-1.17.6Step 5: Configure Nginx
Configure NGINX by typing in the following command:
./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=../nginx-rtmp-modulemake -j 1make installStep 6: Configure Nginx
Continued…
rm /usr/local/nginx/conf/nginx.confnano /usr/local/nginx/conf/nginx.confCopy the following contents into the file and save it:
worker_processes auto;events {worker_connections 1024;}# RTMP configurationrtmp {server {listen 1935; # Listen on standard RTMP portchunk_size 4000;application show {live on;# Turn on HLShls on;hls_path /mnt/hls/;hls_fragment 3;hls_playlist_length 60;# disable consuming the stream from nginx as rtmpdeny play all;}}}http {sendfile off;tcp_nopush on;directio 512;default_type application/octet-stream;server {listen 8080;location / {# Disable cacheadd_header 'Cache-Control' 'no-cache';# CORS setupadd_header 'Access-Control-Allow-Origin' '*' always;add_header 'Access-Control-Expose-Headers' 'Content-Length';# allow CORS preflight requestsif ($request_method = 'OPTIONS') {add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Max-Age' 1728000;add_header 'Content-Type' 'text/plain charset=UTF-8';add_header 'Content-Length' 0;return 204;}types {application/dash+xml mpd;application/vnd.apple.mpegurl m3u8;video/mp2t ts;}root /mnt/;}}}Step 7: Start Nginx
Start Nginx:
/usr/local/nginx/sbin/nginxStep 8: Start Streaming
This server can stream from a variety of sources including a static file, webcam, etc.
We previously installed ffmpeg. We’ll start streaming example-vid.mp4 to our http://localhost/show/stream
ffmpeg -re -i example-vid.mp4 -vcodec libx264 -vprofile baseline -g 30 -acodec aac -strict -2 -f flv rtmp://localhost/show/streamStep 9: Integrate into Player
The stream can now be integrated into a javascript HLS player as per your requirements.
Deploying An Nginx RTMP Server
If you have any questions about deploying a new Nginx RTMP or HLS server, consider booking a free consultation with one of our our account executives. We can help you choose the right server hardware for your media streaming project.
Now that you’ve learned about creating an Nginx RTMP server, why not read about: What is RTMP?
ServerMania not only supports businesses with technical tutorials, but also through enterprise focused solutions such as colocation and server cluster configurations. To find out more about these advanced partnership opportunities, please book a free consultation with an account executive.
Was this page helpful?
About the author

Luc Ayotte
IT Networking/Infrastructure guru
Luc brings a wealth of experience and expertise to the world of server management. With a passion for optimizing digital landscapes and ensuring seamless online experiences, Luc has become an indispensable part of the ServerMania team.


GPU Capacity Planning for Small AI Teams: VRAM, PCIe Lanes, NUMA, and Storage ThroughputBuilding Private RAG (Retrieval-Augmented Generation) Systems on Dedicated GPUs: Enterprise InfrastructureCloud Server Pricing Guide: Transparent Costs & Comparisons for 20252025 Colocation Costs & Pricing Overview | ServerManiaHow to Automate Server Scripts on Linux Servers: Cron, Systemd Timers, and Task SchedulingDedicated Server Hosting Pricing GuideHow to Automate Server Scripts on Windows Servers: Task Scheduler, PowerShell, and Windows Services AutomationWhat Is An AI Server? Understanding Artificial Intelligence ServersContact [email protected] to get help
Thank you!Our experts will contact you soon
New customers get $100 off first month on AMD Dedicated Servers.
Apply today!
We promise not to sell,trade or use your email for spam. View our Privacy Policy
Từ khóa » Http Live Streaming Nginx
-
Setting Up HLS Live Streaming Server Using NGINX - Peer5 P2P Docs
-
Streaming Videos Server Sử Dụng NGINX RTMP Và HLS - Viblo
-
Streaming Media Với Nginx Và Nginx-rtmp Module - TopDev
-
Enabling Video Streaming For Remote Learning With NGINX And ...
-
How To Set Up A Video Streaming Server Using Nginx-RTMP On ...
-
Module Ngx_http_hls_module
-
Hướng Dẫn Streaming Và Livestream Trên NGINX Với RTMP Và HLS
-
How To Use Authentication In Nginx Hls - Stack Overflow
-
How Should I Should I Configure NGINX Rtmp Server So I Can Publish ...
-
Live Video Streaming With Nginx RTMP & HLS On Ubuntu
-
Using NGINX Open Source For Video Streaming And Storage
-
HLS Streaming Server With NGINX - YouTube
-
Arut/nginx-rtmp-module: NGINX-based Media Streaming ... - GitHub
-
Streaming HLS With Nginx's RTMP Module