- 下載PCRE 并安裝.
主頁地址: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
- 解壓 tar -xzvf pcre-8.40.tar.gz
cd pcre-8.40
make, make install (if not the root user, please use the sudo)
- 安裝OpenSSL
sudo apt-get install libssl-dev
- 下載nginx 和 nginx rtmp 模塊
1: 解壓 tar -zxvf nginx-1.10.0.tar.gz
http://nginx.org/download/nginx-1.10.0.tar.gz
git clone https://github.com/arut/nginx-rtmp-module
2: 執(zhí)行nginx 編譯配置
cd nginx-1.10.0
./configure --add-module=/.../nginx-rtmp-module
make
make install
- 啟動nginx
nginx 默認(rèn)安裝目錄 /usr/local/nginx
sbin 目錄下nginx 服務(wù)器主程序梦鉴, 啟動 sudo ./nginx
可能80端口被占用:
sudo fuser -k 80/tcp
And then try restarting nginx again:
service nginx start
- 查看
/usr/local/nginx/sbin$ ps -ef | grep nginx
root 1394 1474 0 18:11 ? 00:00:00 nginx: master process ./nginx
nobody 1395 1394 0 18:11 ? 00:00:00 nginx: worker process
1570 1027 0 18:22 pts/32 00:00:00 grep --color=auto nginx
- 在瀏覽器中輸入 http://localhost/ , 可以看到nginx 的首頁
(我貌似打不開桐臊, 原來是要輸入服務(wù)器IP:http://172.17.6.96)
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
nginx.org.
Commercial support is available at
nginx.com.
Thank you for using nginx.
- 添加rtmp 支持
sudo vi conf/nginx.conf
rtmp {
server {
listen 1935;
application live {
live on;
record off;
}
}
}
9, 重啟 nginx
cd /usr/local/nginx
sudo ./sbin/nginx -t
sudo ./sbin/nginx -s reload
- 添加測試源紊册, 推流到服務(wù)器
ffmpeg -re -i "http://pull3.a8.com/live/1494925686330748.flv" -c copy -f flv rtmp://172.17.6.96:1935/live/gongjia
- 使用vlc在局域網(wǎng)機(jī)器上打開rtmp測試流
rtmp://172.17.6.96:1935/live/gongjia