{"id":798,"date":"2022-09-05T11:00:53","date_gmt":"2022-09-05T11:00:53","guid":{"rendered":"https:\/\/sunucucozumleri.com\/?p=798"},"modified":"2024-02-10T01:33:51","modified_gmt":"2024-02-09T22:33:51","slug":"nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi","status":"publish","type":"post","link":"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/","title":{"rendered":"NGINX RTMP Mod\u00fcl\u00fc Kurulumu ve Stream Sunucu Yap\u0131land\u0131rmas\u0131"},"content":{"rendered":"<p>En yayg\u0131n video ak\u0131\u015f protokollerinden biri bir\u00a0HLS Ak\u0131\u015f Sunucusudur.\u00a0\u00a0HLS, en iyi ak\u0131\u015f performans\u0131 i\u00e7in kullan\u0131c\u0131n\u0131n cihaz\u0131na ve a\u011f ko\u015fullar\u0131na g\u00f6re uyarlanm\u0131\u015f ortam i\u00e7eri\u011fini ak\u0131\u015fa alman\u0131z\u0131 sa\u011flayan uyarlanabilir bir ak\u0131\u015f teknolojisidir.<\/p>\n<p>HLS ve RTMP, <a href=\"https:\/\/sunucucozumleri.com\/blog\/080-nginx-reverse-proxy-nasil-kurulur\/\">Nginx<\/a> RTMP mod\u00fcl\u00fc kullan\u0131larak Nginx web sunucusuna kolayca entegre edilebilir.\u00a0Bu \u00f6\u011freticide, Ubuntu&#8217;da bir HLS canl\u0131 ak\u0131\u015f sunucusunun nas\u0131l kurulaca\u011f\u0131n\u0131 g\u00f6sterece\u011fiz.<\/p>\n<p>Ayr\u0131ca Haz\u0131r Yap\u0131land\u0131r\u0131lm\u0131\u015f\u00a0<strong>RTMP <a href=\"https:\/\/sunucucozumleri.com\/blog\/frontpage\/\">Sunucu<\/a> paketleri<\/strong>mize g\u00f6z atabilirsiniz.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Makale \u0130\u00e7eri\u011fi<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"\u0130\u00e7indekiler Tablosunu A\u00e7\/Kapat\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#Nginx_RTMP_nedir\" >Nginx RTMP nedir?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#Sunucu_Gereksinimleri\" >Sunucu Gereksinimleri<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#Kurulum_Talimatlari\" >Kurulum Talimatlar\u0131<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#Adim_1_SSH_uzerinden_sunucuya_giris_yapin\" >Ad\u0131m 1: SSH \u00fczerinden sunucuya giri\u015f yap\u0131n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#2_Adim_Gerekli_yazilimlari_yukleyelim\" >2. Ad\u0131m: Gerekli yaz\u0131l\u0131mlar\u0131 y\u00fckleyelim<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#3_Adim_Nginx_Yukleyelim\" >3. Ad\u0131m: Nginx Y\u00fckleyelim<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#4_Adim_Nginx_Konfigurasyonu_Yapalim\" >4. Ad\u0131m: Nginx Konfig\u00fcrasyonu Yapal\u0131m<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#Acmis_oldugumuz_Nginxconf_dosyasina_asagidaki_komutlari_yapistirip_kaydedelim_ve_nginx_servisini_yeniden_baslatalim\" >A\u00e7m\u0131\u015f oldu\u011fumuz Nginx.conf dosyas\u0131na a\u015fa\u011f\u0131daki komutlar\u0131 yap\u0131\u015ft\u0131r\u0131p kaydedelim ve nginx servisini yeniden ba\u015flatal\u0131m<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/sunucucozumleri.com\/blog\/nginx-rtmp-modulu-kurulumu-ve-stream-sunucu-yapilandirmasi\/#5_Adim_Stream_Sunucu_Yapilandirmasi\" >5. Ad\u0131m Stream Sunucu Yap\u0131land\u0131rmas\u0131<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"\"><span class=\"ez-toc-section\" id=\"Nginx_RTMP_nedir\"><\/span><span id=\"What_is_Nginx_RTMP\" class=\"ez-toc-section\">Nginx RTMP nedir?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nginx RTMP, medya sunucunuza RTMP ve HLS ak\u0131\u015f\u0131 eklemenizi sa\u011flayan bir Nginx mod\u00fcl\u00fcd\u00fcr.\u00a0Daha \u00f6nce, RTMP ve HLS mod\u00fclleri ayr\u0131 Nginx mod\u00fclleridir, ancak \u015fimdi hepsi tek bir mod\u00fcl olarak Nginx&#8217;e eklenebilir.<\/p>\n<h2 class=\"\"><span class=\"ez-toc-section\" id=\"Sunucu_Gereksinimleri\"><\/span><span id=\"Server_Requirements\" class=\"ez-toc-section\">Sunucu Gereksinimleri<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>&nbsp;<\/p>\n<ul>\n<li>Ubuntu OS (Komut de\u011fi\u015fikliklerine sahip di\u011fer \u0130\u015fletim Sistemlerinde \u00e7al\u0131\u015fabilir)<\/li>\n<li>Minimum 2GB RAM<\/li>\n<li>T\u00fcm medya dosyalar\u0131 i\u00e7in gereken disk alan\u0131<\/li>\n<li><strong><a href=\"https:\/\/sunucucozumleri.com\/blog\/sunucu\/sanal-sunucu\/\">Sanal Sunucu<\/a><\/strong>\u00a0veya\u00a0<strong><a href=\"https:\/\/sunucucozumleri.com\/blog\/sunucu\/fiziksel-sunucu\/\">Fiziksel Sunucu<\/a><\/strong><\/li>\n<\/ul>\n<h2 class=\"\"><span class=\"ez-toc-section\" id=\"Kurulum_Talimatlari\"><\/span><span id=\"Installation_Instructions\" class=\"ez-toc-section\">Kurulum Talimatlar\u0131<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"Adim_1_SSH_uzerinden_sunucuya_giris_yapin\"><\/span><span id=\"Step_1_Login_via_SSH_to_the_server\" class=\"ez-toc-section\">Ad\u0131m 1: SSH \u00fczerinden sunucuya giri\u015f yap\u0131n<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&nbsp;<\/p>\n<p>Sunucuda sudo eri\u015fimi olan bir kullan\u0131c\u0131 olarak oturum a\u00e7\u0131n.\u00a0Sudo eri\u015fimi olan bir kullan\u0131c\u0131 ile giri\u015f yapt\u0131ysan\u0131z e\u011fer, makalemizde ki her komutun \u00f6n\u00fcne sudo ekleyiniz:<\/p>\n<pre class=\"language-markup\"><code>ssh root @ server-ip\r\n<\/code><\/pre>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"2_Adim_Gerekli_yazilimlari_yukleyelim\"><\/span><span id=\"Step_2_Download_required_software\" class=\"ez-toc-section\">2. Ad\u0131m: Gerekli yaz\u0131l\u0131mlar\u0131 y\u00fckleyelim<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Apt deposunu g\u00fcncelleyerek ba\u015flay\u0131n:<\/p>\n<pre class=\"language-markup\"><code>apt-get update\r\napt-get Upgrade\r\napt-get install -y git build-essential ffmpeg libpcre3 libpcre3-dev libssl-dev zlib1g-dev\r\ngit clone https:\/\/github.com\/sergey-dryabzhinsky\/nginx-rtmp-module.git\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"3_Adim_Nginx_Yukleyelim\"><\/span><span class=\"ez-toc-section\">3. Ad\u0131m: Nginx Y\u00fckleyelim<code><\/code><\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"language-markup\"><code>wget http:\/\/nginx.org\/download\/nginx-1.17.6.tar.gz\r\ntar -xf nginx-1.17.6.tar.gz\r\ncd nginx-1.17.6\r\n.\/configure --prefix=\/usr\/local\/nginx --with-http_ssl_module --add-module=..\/nginx-rtmp-module\r\nmake -j 1\r\nmake install\r\n\r\n<\/code><\/pre>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"4_Adim_Nginx_Konfigurasyonu_Yapalim\"><\/span><span class=\"ez-toc-section\">4. Ad\u0131m: Nginx Konfig\u00fcrasyonu Yapal\u0131m<br \/>\n<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"language-markup\"><code>rm \/usr\/local\/nginx\/conf\/nginx.conf\r\nnano \/usr\/local\/nginx\/conf\/nginx.conf\r\n<\/code><\/pre>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"Acmis_oldugumuz_Nginxconf_dosyasina_asagidaki_komutlari_yapistirip_kaydedelim_ve_nginx_servisini_yeniden_baslatalim\"><\/span><span class=\"ez-toc-section\">A\u00e7m\u0131\u015f oldu\u011fumuz Nginx.conf dosyas\u0131na a\u015fa\u011f\u0131daki komutlar\u0131 yap\u0131\u015ft\u0131r\u0131p kaydedelim ve nginx servisini yeniden ba\u015flatal\u0131m<br \/>\n<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"language-markup\"><code>worker_processes  auto;\r\nevents {\r\nworker_connections  1024;\r\n}\r\n\r\n# RTMP configuration\r\nrtmp {\r\nserver {\r\nlisten 1935; # Listen on standard RTMP port\r\nchunk_size 4000;\r\n\r\napplication show {\r\nlive on;\r\n# Turn on HLS\r\nhls on;\r\nhls_path \/mnt\/hls\/;\r\nhls_fragment 3;\r\nhls_playlist_length 60;\r\n# disable consuming the stream from nginx as rtmp\r\ndeny play all;\r\n}\r\n}\r\n}\r\n\r\nhttp {\r\nsendfile off;\r\ntcp_nopush on;\r\ndirectio 512;\r\ndefault_type application\/octet-stream;\r\n\r\nserver {\r\nlisten 8080;\r\n\r\nlocation \/ {\r\n# Disable cache\r\nadd_header 'Cache-Control' 'no-cache';\r\n\r\n# CORS setup\r\nadd_header 'Access-Control-Allow-Origin' '*' always;\r\nadd_header 'Access-Control-Expose-Headers' 'Content-Length';\r\n\r\n# allow CORS preflight requests\r\nif ($request_method = 'OPTIONS') {\r\nadd_header 'Access-Control-Allow-Origin' '*';\r\nadd_header 'Access-Control-Max-Age' 1728000;\r\nadd_header 'Content-Type' 'text\/plain charset=UTF-8';\r\nadd_header 'Content-Length' 0;\r\nreturn 204;\r\n}\r\n\r\ntypes {\r\napplication\/dash+xml mpd;\r\napplication\/vnd.apple.mpegurl m3u8;\r\nvideo\/mp2t ts;\r\n}\r\n\r\nroot \/mnt\/;\r\n}\r\n}\r\n}<\/code><\/pre>\n<pre class=\"language-markup\"><code>\/usr\/local\/nginx\/sbin\/nginx\r\n<\/code><\/pre>\n<h3 class=\"\"><span class=\"ez-toc-section\" id=\"5_Adim_Stream_Sunucu_Yapilandirmasi\"><\/span><span class=\"ez-toc-section\"><br \/>\n5. Ad\u0131m Stream Sunucu Yap\u0131land\u0131rmas\u0131<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&nbsp;<\/p>\n<p>Bu sunucu, statik dosya, web kameras\u0131 vb. Gibi \u00e7e\u015fitli kaynaklardan ak\u0131\u015f sa\u011flayabilir.<br \/>\nDaha \u00f6nce ffmpeg&#8217;i kurduk.\u00a0Example-vid.mp4 dosyas\u0131n\u0131\u00a0http: \/\/ localhost \/ show \/ stream&#8217;imize\u00a0aktarmaya\u00a0ba\u015flayaca\u011f\u0131z<\/p>\n<pre class=\"language-markup\"><code>ffmpeg -re -i example-vid.mp4 -vcodec libx264 -vprofile baseline -g 30 -acodec aac -strict -2 -f flv rtmp:\/\/localhost\/show\/stream\r\n<\/code><\/pre>\n<p><span class=\"ez-toc-section\"><code><br \/>\nBol Trafikler Dileriz.<\/code><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>En yayg\u0131n video ak\u0131\u015f protokollerinden biri bir\u00a0HLS Ak\u0131\u015f Sunucusudur.\u00a0\u00a0HLS, en iyi ak\u0131\u015f performans\u0131 i\u00e7in kullan\u0131c\u0131n\u0131n cihaz\u0131na ve a\u011f ko\u015fullar\u0131na g\u00f6re uyarlanm\u0131\u015f ortam i\u00e7eri\u011fini ak\u0131\u015fa alman\u0131z\u0131 sa\u011flayan uyarlanabilir bir ak\u0131\u015f teknolojisidir. HLS ve RTMP, Nginx RTMP mod\u00fcl\u00fc kullan\u0131larak Nginx web sunucusuna kolayca entegre edilebilir.\u00a0Bu \u00f6\u011freticide, Ubuntu&#8217;da bir HLS canl\u0131 ak\u0131\u015f sunucusunun nas\u0131l kurulaca\u011f\u0131n\u0131 g\u00f6sterece\u011fiz. Ayr\u0131ca Haz\u0131r &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1456,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-798","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"acf":[],"_links":{"self":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/comments?post=798"}],"version-history":[{"count":0,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/798\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media\/1456"}],"wp:attachment":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media?parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/categories?post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/tags?post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}