nginx添加流媒体视频访问

关闭nginx,并找到nginx源码

nginx -s stop #nginx -t查看,如果配置错误会关闭不了的

查看已安装的nginx编译

nginx -V #大写的V,小写只查看版本

下载

wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
wget -O nginx-rtmp-module.zip https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar -zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
unzip nginx-rtmp-module.zip

重新编译nginx,添加mp4和flv模块,不需要make install

./configure --prefix=/app/deploy/nginx --add-module=/app/nginx-src/nginx_mod_h264_streaming-2.2.7 --add-module=/app/nginx-src/nginx-rtmp-module-master --with-http_flv_module --with-http_mp4_module --with-http_stub_status_module --with-http_ssl_module 
make 
#特别注意:nginx_mod_h264和with-http_mp4_module不要同时使用,会出问题的 #不要make install,否则会完全重新安装 报错1: make[
1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1 make[1]: Leaving directory `/root/nginx-0.8.54' make: *** [build] Error 2 则h264:src/ngx_http_streaming_module.c注释如下,如果不行就删除: /* TODO: Win32 */ #if (r->zero_in_uri) #{ # return NGX_DECLINED; #}
错误2:
[objs/addon/src/mp4_reader.o] Error 1
修改objs/Makefile,删除-Werror和cc换成gcc编译
再make clean,configure,make

替换文件,修改原来的nginx为nginx-old

cp ./objs/nginx /app/deploy/nginx/sbin

启动查看

nginx -V
nginx -t
nginx #启动,或者如下启动 nginx
-c /app/deploy/nginx/conf/nginx.conf

 

posted @ 2018-01-15 01:04  maoriaty  阅读(728)  评论(0编辑  收藏  举报