宛渠日古
搜尋
WIKI专题
并发编程
数据库
Linux/Unix
网络相关
非技术
诗集
工具箱
近期變更
文章分类
全部文章
說明
連結至此的頁面
相關變更
特殊頁面
頁面資訊
登入
頁面
討論
views
閱讀
檢視原始碼
歷史
檢視 CentOS:RTMP流媒体服务器 的原始碼
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
=编译安装nginx= 利用nginx搭建rtmp流媒体服务器。首先安装编译工具链: <source lang="bash"> yum groupinstall "Development Tools" </source> 安装完成后,下载源码到同一目录并解压: <source lang="bash"> 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 </source> 解压完成后,cd到nginx源码目录, <source lang="bash"> ./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 </source> 配置完成后,结果如下: <pre> 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" </pre> =编译错误解决= 开始编译: <source lang="bash"> make && make install </source> 可能出现这个错误: <pre> ../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 </pre> 解决办法:注释掉如下的函数: <source lang="bash"> vim ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c /* TODO: Win32 */ /* if (r->zero_in_uri) { return NGX_DECLINED; } */ </source> 编译完后后,输出如下: <pre> 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' </pre> =配置nginx= 增加如下内容到nginx配置文件usr/local/nginx/conf/nginx.conf: <source lang="lua"> rtmp{ server{ listen 1935; chunk_size 4000; application live{ live on; meta copy; } } } </source> *启动 ./nginx *优雅关闭 ./nginx -s quit *快速关闭 ./nginx -s stop [[Category:Linux/Unix]]
返回「
CentOS:RTMP流媒体服务器
」頁面