分类: LINUX
2014-10-23 14:29:59
安装(以下为安装示例,请根据实际情况实际目录进行修改安装)
1、安装pcre8.12
[root@WAP opt]# tar zxvf pcre-8.12.tar.gz
[root@WAP pcre-8.12]# cd pcre-8.12
[root@WAP pcre-8.12]# ./configure --enable-utf8 --enable-unicode-properties(支持中文播放)
[root@WAP pcre-8.12]# make
[root@WAP pcre-8.12]# make install
2、解压nginx_mod_h264_streaming-2.2.7.tar.gz
[root@WAP opt]# tar zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
[root@WAP opt]#cd nginx_mod_h264_streaming-2.2.7
[root@WAP opt]#mkdir -p /opt/nginx_mod_h264_streaming-2.2.7/src
[root@WAP opt]#cp -r src /opt/nginx_mod_h264_streaming-2.2.7/
3、安装nginx
[root@WAP opt]# tar zxvf nginx-0.8.54.tar.gz
[root@WAP nginx-0.8.54]# ./configure --add-module=../nginx_mod_h264_streaming-2.2.7 --with-http_ssl_module --with-pcre=/home/softwarebackup/pcre-8.21 --user=www --group=www --prefix=/usr/local/nginx --with-http_flv_module --with-http_stub_status_module
[root@WAP nginx-0.8.54]# make
在“make”编译的时候提示如下错误
In file included from /usr/local/src/nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2:
/usr/local/src/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function ‘ngx_streaming_handler’
:
/usr/local/src/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 `/usr/local/src/nginx-0.8.54'
make: *** [build] Error 2
解决错误:
因为在新版本的nginx中废弃了zero_in_uri这个flag,稍微修改一下nginx_mod_h264_streaming的源代码
vim /usr/local/src/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
把158到161行注释掉
157 /* TODO: Win32 */
158 //if (r->zero_in_uri)
159 //{
160 // return NGX_DECLINED;
161 //}
然后再make就正常了,make install 完成安装
[root@WAP nginx-0.8.54]# make install
4、配置nginx
[root@WAP nginx-0.8.54]# cd /usr/local/nginx/conf/
[root@WAP nginx-0.8.54]# vi nginx.conf
在43行插入如下内容:
location ~\.mp4$ {
mp4;
}
location ~\.flv$ {
flv;
}
在nginx下的html目录中指定一个软连接到发布点目录,使用如下命令:
ln -s /GFS /usr/local/nginx/html/video
/GFS为视频存储的物理路径,video为/GFS在/usr/local/nginx/html下的链接文件,此处的video即为对应发布点名称。
5、启动
nginx(直接使用,不需要加目录)
6、如果修改该了配置文件
通过nginx -s reload平滑重启
7、停止
nginx -s stop