「nginx-rtmp-module」的推薦目錄:
- 關於nginx-rtmp-module 在 コバにゃんチャンネル Youtube 的精選貼文
- 關於nginx-rtmp-module 在 大象中醫 Youtube 的最佳解答
- 關於nginx-rtmp-module 在 大象中醫 Youtube 的最佳解答
- 關於nginx-rtmp-module 在 [心得] 以dynamic module安裝nginx-rtmp @Ubuntu - 看板Linux 的評價
- 關於nginx-rtmp-module 在 Nginx RTMP module on Ubuntu 18.04 with RTMPS support 的評價
- 關於nginx-rtmp-module 在 Ubuntu Rtmp Nginx Server install part 1 - YouTube 的評價
nginx-rtmp-module 在 大象中醫 Youtube 的最佳解答
nginx-rtmp-module 在 大象中醫 Youtube 的最佳解答
nginx-rtmp-module 在 Nginx RTMP module on Ubuntu 18.04 with RTMPS support 的必吃
2.1 Configuration. Install Nginx and RTMP module (On Ubuntu server 18.04). This configuration assumes that nginx and stunnel is installed on the same machine. ... <看更多>
nginx-rtmp-module 在 Ubuntu Rtmp Nginx Server install part 1 - YouTube 的必吃
Installing Nginx and Nginx-RTMPInstall the tools required to compile Nginx and ... nginx - rtmp - module -master Compile and install Nginx with ... ... <看更多>
nginx-rtmp-module 在 [心得] 以dynamic module安裝nginx-rtmp @Ubuntu - 看板Linux 的必吃
與 Apache 不同,Nginx 的模組 (module) 是以靜態連結的方式
直接編譯進 nginx 執行檔中,所以當新增或抽換模組時必須重新
編譯 Nginx, 非常不方便。幸好在 Nginx 1.9.11 加入了 dynamic
modules 機制 [1],可以透過 shared object (.so) 於執行期動
態載入額外的模組。
nginx-rtmp-module [2] 為一個處理 rtmp 與 HLS, DASH 等串流
技術的第三方模組,可在 Nginx 中加入直播串流支援。但要安裝
nginx-rtmp-module 就必須將其編譯進 Nginx 中,在大多數 Linux
發行版本,透過套件庫安裝的 Nginx 是不含這個模組的,要使用
此模組勢必要手動編譯 Nginx, 而無法使用套件管理系統管理 Nginx.
但是透過 dynamic modules 機制,我們可以保留透過套件庫安裝
的 Nginx 版本,同時又可以使用 nginx-rtmp, 但 Nginx 版本要
高於 1.9.11 就是了。動態模組的還有一個好處是抽換版本很簡單
,make modules 編完再取代舊 .so 就好。
本文以 Ubuntu 16.04.2 LTS, nginx/1.10.0 為環境。
--
[Step 1]
先把 nginx source 與 nginx-rtmp 抓下來
~ $ apt-get source nginx
~ $ git clone https://github.com/arut/nginx-rtmp-module/
以下假設抓下來的檔案位於
nginx: /home/example/nginx-1.10.0
nginx-rtmp: /home/example/nginx-rtmp-module
[Step 2]
進入 nginx-1.10.0 資料夾,編輯 debian/rules 檔案
~ $ cd nginx-1.10.0
nginx-1.10.0 $ vim debian/rules
在 common_configure_flags 結尾加入
--add-dynamic-module=/home/example/nginx-rtmp-module
```
common_configure_flags := \
--with-cc-opt="$(debian_cflags)" \
--with-ld-opt="$(debian_ldflags)" \
--prefix=/usr/share/nginx \
...
...
--with-http_auth_request_module \
--add-dynamic-module=/home/example/nginx-rtmp-module
```
注意: --with-http_auth_request_module \ 後方的斜線不能少
--add-dynamic-module=/home/example/nginx-rtmp-module 後方不要加斜線
修改 dpkg 編譯選項 [3]
nginx-1.10.0 $ export DEB_BUILD_MAINT_OPTIONS="hardening=+all, reproducible=-timeless"
nginx-1.10.0 $ dpkg-buildflags
```
CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security
CPPFLAGS=-D_FORTIFY_SOURCE=2
CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security
FCFLAGS=-g -O2 -fstack-protector-strong
FFLAGS=-g -O2 -fstack-protector-strong
GCJFLAGS=-g -O2 -fstack-protector-strong
LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now
OBJCFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security
OBJCXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security
```
檢查 CPPFLAGS 中沒有 -Wdate-time, LDFLAGS 中沒有 -fPIE, -fpie
[Step 3]
安裝 build dependencies
nginx-1.10.0 $ sudo apt-get build-dep nginx
設定 nginx 編譯選項及環境 [4]
nginx-1.10.0 $ debian/rules config.arch.core
編譯 nginx 模組
nginx-1.10.0 $ make -C debian/build-core/ modules
[Step 4]
編譯後在 debian/build-core/objs/ 可以找到 ngx_rtmp_module.so
將它複製到 /usr/share/nginx/modules 資料夾下
nginx-1.10.0 $ sudo mkdir /usr/share/nginx/modules
nginx-1.10.0 $ sudo cp debian/build-core/objs/ngx_rtmp_module.so \
/usr/share/nginx/modules
編輯 /etc/nginx/nginx.conf,
在文件開頭加入 load_module "modules/ngx_rtmp_module.so";
nginx-1.10.0 $ sudo vim /etc/nginx/nginx.conf
```
user www-data;
worker_processes auto;
pid /run/nginx.pid;
load_module "modules/ngx_rtmp_module.so";
...
...
```
重新啟動 nginx
nginx-1.10.0 $ sudo systemctl restart nginx
沒有錯誤訊息的話就是成功了
--
[1]: https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/
[2]: https://github.com/arut/nginx-rtmp-module
[3]: https://man7.org/linux/man-pages/man1/dpkg-buildflags.1.html
由於我們要編譯 shared object, 必須關閉 hardening - pie,
否則編譯時會報錯:
relocation R_X86_64_PC32 against symbol `ngx_rtmp_core_module'
can not be used when making a shared object; recompile with -fPIC
解決 -fPIE 問題後又會遇到錯誤:
error: macro "__DATE__" might prevent reproducible builds
error: macro "__TIME__" might prevent reproducible builds
所以還要再補上關閉 reproducible - timeless
[4]: 雖然可能安裝在伺服器上的是 nginx-full, nginx-extras 之類的版本
不過這裡我們只要編 rtmp 模組,所以直接選 nginix-core 來編就好
有疑慮的話也可以改成 debian/rules config.arch.<full|extras|light|core>
後面 make -C 的資料夾也要改成對應的 debian/build-<full|extras|light|core>
--
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.198.141
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1489642831.A.5C5.html
※ 編輯: s25g5d4 (140.117.198.141), 03/16/2017 13:42:33
※ 編輯: s25g5d4 (140.117.198.141), 03/16/2017 13:42:46
... <看更多>