{"id":7890,"date":"2023-07-04T06:19:28","date_gmt":"2023-07-04T06:19:28","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=7890"},"modified":"2023-07-04T06:19:30","modified_gmt":"2023-07-04T06:19:30","slug":"how-to-install-nginx-rtmp-media-server","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/how-to-install-nginx-rtmp-media-server\/","title":{"rendered":"How To Install Nginx RTMP Media Server?"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 6,721<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>An HLS Streaming Server is one of the most prevalent video streaming protocols. It\u2019s possible to broadcast media material adapted to the user\u2019s device and network circumstances using HLS, an adaptive streaming technique. Further, the Nginx RTMP module may be used to combine HLS and RTMP with the Nginx web server. This tutorial will set up the HLS live streaming server on Ubuntu.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installation Instructions:<\/strong><\/h2>\n\n\n\n<p>1)start updating your apt repositories<\/p>\n\n\n\n<p>#apt-get update<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"489\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image-1024x489.png\" alt=\"\" class=\"wp-image-7899\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image-1024x489.png 1024w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image-300x143.png 300w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image-768x367.png 768w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image-1536x733.png 1536w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/image.png 1542w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>2) Install required packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#apt-get install -y git build-essential ffmpeg libpcre3 libpcre3-dev libssl-dev zlib1g-dev<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"501\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg2-1-1024x501.png\" alt=\"\" class=\"wp-image-7900\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg2-1-1024x501.png 1024w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg2-1-300x147.png 300w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg2-1-768x376.png 768w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg2-1.png 1287w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3) Clone Module:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#git clone https:\/\/github.com\/sergey-dryabzhinsky\/nginx-rtmp-module.git<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"762\" height=\"164\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg3-1.png\" alt=\"\" class=\"wp-image-7901\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg3-1.png 762w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg3-1-300x65.png 300w\" sizes=\"(max-width: 762px) 100vw, 762px\" \/><\/figure>\n\n\n\n<p>4)Download Nginx<\/p>\n\n\n\n<p>#wget\u00a0<a href=\"http:\/\/nginx.org\/download\/nginx-1.14.0.tar.gz\" target=\"_blank\" rel=\"noopener\">http:\/\/nginx.org\/download\/nginx-1.17.6.tar.gz<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"226\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg4-1-1024x226.png\" alt=\"\" class=\"wp-image-7902\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg4-1-1024x226.png 1024w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg4-1-300x66.png 300w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg4-1-768x169.png 768w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg4-1.png 1307w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>5) Extract and compile the Nginx with RTMP module<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#tar -zxvf nginx-1.17.6.tar.gz\n\n#cd Nginx-1.17.6\n\n#.\/configure --prefix=\/usr\/local\/nginx --with-http_ssl_module \u2013add-module=..\/nginx-rtmp-module\n\n#make -j 1\n\n#make install \n<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"686\" height=\"648\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg5-1.png\" alt=\"\" class=\"wp-image-7903\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg5-1.png 686w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg5-1-300x283.png 300w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/figure>\n\n\n\n<p>6) Configure Nginx Daemon<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#wget https:\/\/raw.github.com\/JasonGiedymin\/nginx-init-ubuntu\/master\/nginx -O \/etc\/init.d\/nginx\n\n#chmod +x \/etc\/init.d\/nginx<\/pre>\n\n\n\n<p>7)Enable on boot Nginx service<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#update-rc.d nginx defaults<\/pre>\n\n\n\n<p>Editing nginx configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#cp -p \/usr\/local\/nginx\/conf\/nginx.conf nginx.conf_backup<\/pre>\n\n\n\n<p>Open Nginx configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#vim \/usr\/local\/nginx\/conf\/nginx.conf<\/pre>\n\n\n\n<p>Add the following configuration:-<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">worker_processes 1;\n\nerror_log logs\/rtmp_error.log debug;\n\npid logs\/nginx.pid;\n\nevents {\n\nworker_connections 1024;\n\n}\n\nhttp {\n\nserver {\n\nlisten 80;\n\nserver_name localhost;\n\nlocation \/hls {\n\n# Serve HLS fragments\n\n# CORS setup\n\nadd_header 'Access-Control-Allow-Origin' '*' always;\n\nadd_header 'Access-Control-Expose-Headers' 'Content-Length';\n\n# allow CORS preflight requests\n\nif ($request_method = 'OPTIONS') {\n\nadd_header 'Access-Control-Allow-Origin' '*';\n\nadd_header 'Access-Control-Max-Age' 1728000;\n\nadd_header 'Content-Type' 'text\/plain charset=UTF-8';\n\nadd_header 'Content-Length' 0;\n\nreturn 204;\n\n}\n\ntypes {\n\napplication\/vnd.apple.mpegurl m3u8;\n\nvideo\/mp2t ts;\n\n}\n\nroot \/mnt;\n\nadd_header Cache-Control no-cache;\n\n}\n\n}\n\n}\n\nrtmp {\n\nserver {\n\nlisten 1935;\n\nchunk_size 8192;\n\napplication hls {\n\nlive on;\n\nmeta copy;\n\nhls on;\n\nhls_path \/mnt\/hls;\n\n}\n\n}\n\n}\n\n:wq (Save and exit vim editor)\n<\/pre>\n\n\n\n<p>Create the required directories:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#mkdir \/mnt\/hls\n\n#mkdir \/mnt\/recordings<\/pre>\n\n\n\n<p>Restart the Nginx service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#systemctl restart nginx<\/pre>\n\n\n\n<p>Check the Nginx listening ports using the netstat command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#netstat -tulpn | grep nginx<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"913\" height=\"77\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg6.png\" alt=\"\" class=\"wp-image-7904\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg6.png 913w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg6-300x25.png 300w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg6-768x65.png 768w\" sizes=\"(max-width: 913px) 100vw, 913px\" \/><\/figure>\n\n\n\n<p>Start stream with any key using OBS:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">rtmp:\/\/localhost\/hls<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"475\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngnix11.png\" alt=\"\" class=\"wp-image-7905\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngnix11.png 642w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngnix11-300x222.png 300w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"579\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg8-1024x579.png\" alt=\"\" class=\"wp-image-7906\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg8-1024x579.png 1024w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg8-300x170.png 300w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg8-768x434.png 768w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg8.png 1305w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Check your streaming in VLC using network stream:<\/p>\n\n\n\n<p>http:\/\/localhost\/hls\/manualtesting.m3u8<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"388\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg9.png\" alt=\"\" class=\"wp-image-7907\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg9.png 642w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg9-300x181.png 300w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"621\" height=\"365\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg10.png\" alt=\"\" class=\"wp-image-7908\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg10.png 621w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/07\/ngniximg10-300x176.png 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/figure>\n\n\n\n<p>A free consultation with an Nginx RTMP or HLS server expert is a good idea if you have any concerns or queries regarding the process. Your video streaming project might benefit from our expertise in determining the best server hardware for your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>6,721 Views An HLS Streaming Server is one of the most prevalent video streaming protocols. It\u2019s possible to broadcast media material adapted to the user\u2019s device and network circumstances using HLS, an adaptive streaming technique. Further, the Nginx RTMP module may be used to combine HLS and RTMP with the Nginx web server. This tutorial [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[53],"tags":[],"class_list":["post-7890","post","type-post","status-publish","format-standard","hentry","category-streaming-server"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/7890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=7890"}],"version-history":[{"count":3,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/7890\/revisions"}],"predecessor-version":[{"id":7909,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/7890\/revisions\/7909"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=7890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=7890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=7890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}