系统:Centos7
nginx版本:1.10
1、下载 nginx_mod_h264_streaming
cd opt
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
tar xf nginx_mod_h264_streaming-2.2.7.tar.gz
2、编译nginx
tar xf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/data/nginx --with-http_ssl_module \
--with-http_realip_module --with-http_addition_module \
--with-http_xslt_module --with-http_image_filter_module \
--with-http_sub_module --with-http_dav_module --with-http_flv_module \
--with-http_mp4_module --with-http_gzip_static_module \
--with-http_random_index_module --with-http_secure_link_module \
--with-http_stub_status_module --with-pcre=/usr/local/pcre-8.31 \
--with-openssl=/usr/local/openssl-0.9.8r \
--add-module=/opt/nginx_mod_h264_streaming-2.2.7
3、报错ngx_http_streaming_module.c:158: 错误:‘ngx_http_request_t’ 没有名为 ‘zero_in_uri’ 的成员
解决:修改nginx_mod_h264_streaming-2.2.7的源代码
vi nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
....
# /* TODO: Win32 */
# if (r->zero_in_uri)
# {
# return NGX_DECLINED;
# }
注释或者删除以上代码,即可。我试过注释但是不起作用,不知道是什么原因,我就直接删除了。
清除编译信息,重新configure;
make clean
./configure ...(config信息同上,不再重复)
4、报错
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数‘esds_read’中:
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:377:16: 错误: 变量‘stream_priority’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:376:12: 错误: 变量‘stream_id’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数‘stsd_parse_vide’中:
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:529:22: 错误: 变量‘level_indication’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:528:22: 错误: 变量‘profile_compatibility’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:527:22: 错误: 变量‘profile_indication’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:526:22: 错误: 变量‘configuration_version’被设定但未被使用 [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/mp4_reader.o] 错误 1
解决方法:
修改Makefile文件
vi nginx-1.10.3/objs/Makefile
CC = cc
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror g -D_LARGEFILE_SOURCE -DBUILDING_NGINX
CPP = cc -E
LINK = $(CC)
删除-Werror字段,然后重新make.
make
make install