rtmp服务器搭建
安装准备
下载
wget http://nginx.org/download/nginx-1.10.3.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
解压
tar -zxvf 文件名
unzip master.zip
nginx编译并添加模块
进入nginx-1.10.3解压目录后执行
./configure --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-master
然后编译安装
make
make install
nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# nginx-rtmp-module解压的目录
root /*/nginx-rtmp-module-master/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
验证
[root@host-10-10-9-187 sbin]# ./nginx -Ves of bean [name : org.apache.dub
nginx version: nginx/1.10.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) es of bean [name : org.apache.dub
built with OpenSSL 1.0.2k 26 Jan 2017
TLS SNI support enabledn[type:ReferenceBean] has been bu
configure arguments: --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with
-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-master
打开浏览器输入:http://ip:1935/stat,
使用VLC media player测试rtmp地址播放