系統環境
wujianjun@wujianjun-work ~ $ uname -a linux wujianjun-work 4.10.0-37-generic #41~16.04.1-ubuntu smp fri oct 6 22:42:59 utc 2017 x86_64 x86_64 x86_64 gnu/linux
軟體環境
obs(open broadcaster software) v20.0.1 (linux)
nginx version: nginx/1.13.6
built by gcc 5.4.0 20160609 (ubuntu 5.4.0-6ubuntu1~16.04.5)
built with openssl 1.0.2g 1 mar 2016
tls sni port
configure arguments: –with-pcre=pcre-8.38 –add-module=nginx-rtmp-module-1.1.11nginx obs安裝及設定安裝obs
wujianjun@wujianjun-work ~ $ sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next wujianjun@wujianjun-work ~ $ sudo apt-get update && sudo apt-get install ffmpeg wujianjun@wujianjun-work ~ $ sudo apt-get install obs-studio wujianjun@wujianjun-work ~ $ sudo add-apt-repository ppa:obsproject/obs-studio wujianjun@wujianjun-work ~ $ sudo apt-get update && sudo apt-get install obs-studio
wujianjun@wujianjun-work ~ $ sudo apt-get install build-essential wujianjun@wujianjun-work ~ $ wget wget http://nginx.org/download/nginx-1.13.6.tar.gz wujianjun@wujianjun-work ~/nginx-1.13.6 $ wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.11.tar.gz wujianjun@wujianjun-work ~/nginx-1.13.6 $ tar -xvf v1.1.11.tar.gz wujianjun@wujianjun-work ~/nginx-1.13.6 $ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz wujianjun@wujianjun-work ~/nginx-1.13.6 $ tar -xvf pcre-8.38.tar.gz wujianjun@wujianjun-work ~/nginx-1.13.6 $ ls -all 总用量 748 drwxr-xr-x 9 wujianjun wujianjun 4096 10月 15 11:39 . drwxr-xr-x 63 wujianjun wujianjun 4096 10月 15 11:33 .. drwxr-xr-x 6 wujianjun wujianjun 4096 10月 15 11:33 auto -rw-r--r-- 1 wujianjun wujianjun 282456 10月 10 23:22 changes -rw-r--r-- 1 wujianjun wujianjun 430416 10月 10 23:22 changes.ru drwxr-xr-x 2 wujianjun wujianjun 4096 10月 15 11:33 conf -rwxr-xr-x 1 wujianjun wujianjun 2502 10月 10 23:22 configure drwxr-xr-x 4 wujianjun wujianjun 4096 10月 15 11:33 contrib drwxr-xr-x 2 wujianjun wujianjun 4096 10月 15 11:33 html -rw-r--r-- 1 wujianjun wujianjun 1397 10月 10 23:22 license drwxr-xr-x 2 wujianjun wujianjun 4096 10月 15 11:33 man drwxrwxr-x 6 wujianjun wujianjun 4096 2月 13 2017 nginx-rtmp-module-1.1.11 drwxr-xr-x 7 wujianjun wujianjun 4096 11月 23 2015 pcre-8.38 -rw-r--r-- 1 wujianjun wujianjun 49 10月 10 23:22 readme drwxr-xr-x 9 wujianjun wujianjun 4096 10月 15 11:33 src wujianjun@wujianjun-work ~/nginx-1.13.6 $ ./configure --with-pcre=pcre-8.38 --add-module=nginx-rtmp-module-1.1.11 wujianjun@wujianjun-work ~/nginx-1.13.6 $ make && sudo make install wujianjun@wujianjun-work ~/nginx-1.13.6 $ ls -all /usr/local/nginx/ 总用量 24 drwxr-xr-x 6 root root 4096 10月 15 16:11 . drwxr-xr-x 11 root root 4096 10月 15 16:11 .. drwxr-xr-x 2 root root 4096 10月 15 16:11 conf drwxr-xr-x 2 root root 4096 10月 15 16:11 html drwxr-xr-x 2 root root 4096 10月 15 16:11 logs drwxr-xr-x 2 root root 4096 10月 15 16:11 sbin
wujianjun@wujianjun-work ~/nginx-1.13.6 $ sudo vi /usr/local/nginx/conf/nginx.conf
rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; } } }
啟動&測試
啟動nginxwujianjun@wujianjun-work ~/nginx-1.13.6 $ sudo /usr/local/nginx/sbin/nginx
rtmp { server { listen 1935; chunk_size 4096; application live { live on; hls on; hls_path /usr/share/nginx/html/hls; hls_fragment 5s; } } } http { server { listen 80; ..... location / { #root html; root /usr/share/nginx/html; index index.html index.htm; } ..... } }
#
以上是nginx怎麼使用nginx-rtmp-module模組實現直播間功能的詳細內容。更多資訊請關注PHP中文網其他相關文章!