CentOS:RTMP流媒体服务器:修订间差异
imported>Soleverlee 以“=编译安装nginx= 利用nginx搭建rtmp流媒体服务器。首先安装编译工具链: <source lang="bash"> yum groupinstall "Development Tools" </source> 安...”为内容创建页面 |
imported>Soleverlee |
||
第68行: | 第68行: | ||
In file included from ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2: | In file included from ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2: | ||
../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function 'ngx_streaming_handler': | ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function 'ngx_streaming_handler': | ||
../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158: error: 'ngx_http_request_t' has no member named 'zero_in_uri' | ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158: error: 'ngx_http_request_t' has no | ||
member named 'zero_in_uri' | |||
make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1 | make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1 | ||
make[1]: Leaving directory `/home/rtmp/nginx-1.10.1' | make[1]: Leaving directory `/home/rtmp/nginx-1.10.1' | ||
第94行: | 第95行: | ||
make[1]: Leaving directory `/home/rtmp/nginx-1.10.1' | make[1]: Leaving directory `/home/rtmp/nginx-1.10.1' | ||
</pre> | </pre> | ||
=配置nginx= | =配置nginx= | ||
增加如下内容到nginx配置文件usr/local/nginx/conf/nginx.conf: | 增加如下内容到nginx配置文件usr/local/nginx/conf/nginx.conf: |
2016年8月27日 (六) 17:15的版本
编译安装nginx
利用nginx搭建rtmp流媒体服务器。首先安装编译工具链:
yum groupinstall "Development Tools"
安装完成后,下载源码到同一目录并解压:
wget http://nginx.org/download/nginx-1.10.1.tar.gz
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
wget http://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
wget https://www.openssl.org/source/openssl-1.1.0.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.9.tar.gz
tar -zxvf nginx-1.10.1.tar.gz
tar -zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf pcre-8.39.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
tar -zxvf openssl-1.1.0.tar.gz
tar -zxvf v1.1.9.tar.gz
解压完成后,cd到nginx源码目录,
./configure \
--prefix=/usr/local/nginx \
--add-module=../nginx_mod_h264_streaming-2.2.7 \
--add-module=../nginx-rtmp-module-1.1.9 \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre=../pcre-8.39 \
--with-zlib=../zlib-1.2.8 \
--with-openssl=../openssl-1.0.2h \
--with-debug
配置完成后,结果如下:
Configuration summary + using PCRE library: ../pcre-8.39 + using OpenSSL library: ../openssl-1.0.2h + md5: using OpenSSL library + sha1: using OpenSSL library + using zlib library: ../zlib-1.2.8 nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
编译错误解决
开始编译:
make && make install
可能出现这个错误:
../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c In file included from ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2: ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function 'ngx_streaming_handler': ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158: error: 'ngx_http_request_t' has no member named 'zero_in_uri' make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1 make[1]: Leaving directory `/home/rtmp/nginx-1.10.1' make: *** [build] Error 2
解决办法:注释掉如下的函数:
vim ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
/* TODO: Win32 */
/*
if (r->zero_in_uri)
{
return NGX_DECLINED;
}
*/
编译完后后,输出如下:
sed -e "s|%%PREFIX%%|/usr/local/nginx|" \ -e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \ -e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \ -e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \ < man/nginx.8 > objs/nginx.8 make[1]: Leaving directory `/home/rtmp/nginx-1.10.1'
配置nginx
增加如下内容到nginx配置文件usr/local/nginx/conf/nginx.conf:
rtmp{
server{
listen 1935;
chunk_size 4000;
application live{
live on;
meta copy;
}
}
}
- 启动 ./nginx
- 优雅关闭 ./nginx -s quit
- 快速关闭 ./nginx -s stop