创建用户 useradd www
安装linux批量部署 yum groupinstall -y "Development Tools" "Development Libraries"
安装zlib nginx运行需要的函数库安装openssh 支持安全通信 yum install zlib* openssl* -y安装与perl兼容的正则表达式库模块tar fvxz pcre-8.33.tar.gz./configure makemake install安装libunwind库tar zxf libunwind-1.1.tar.gz cd libunwind-1.1CFLAGS=-fPIC ./configuremake CFLAGS=-fPICmake CFLAGS=-fPIC installecho '/usr/local/lib' > /etc/ld.so.conf.d/usr_local_lib.confldconfig安装gperftools CPU分析器tar zxf gperftools-2.1.tar.gz cd gperftools-2.1./configure makemake installldconfig 安装伪流模块 tar zxf nginx_mod_h264_streaming-2.2.7.tar.gz注释 nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c 158行的if代码
下载nginx视频模块
wget https://github.com/arut/nginx-rtmp-module.git
nginx-rtmp-module
安装nginx-1.5.1
tar fvxz nginx-1.5.1.tar.gz
cd nginx-1.5.1
编译
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module--with-http_ssl_module --with-zlib=/zkx/zlib-1.2.3 --with-pcre=/zkx/pcre-8.33--user=www --group=www --with-http_sub_module --with-http_flv_module--add-module=/zkx/nginx_mod_h264_streaming-2.2.7 --with-http_dav_module--with-http_addition_module --add-module=/zkx/nginx-accesskey-2.0.3--add-module=/zkx/nginx-rtmp-module/
make && make install
将视频和html页面放到指定路径下
/usr/local/nginx/vod/flvs
打开nginx配置文件进行配置
vi /usr/local/nginx/conf/nginx.conf
配置server段
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~* \.(gif|jpg|jpeg|png|bmp|swf|ico|html|js|as)$ {
root /usr/local/nginx/vod/flvs;
# index index.html index.htm;
expires 30d;
}
location ~* \.(flv|mp4)$ {
root /usr/local/nginx/vod/flvs;
expires 1h;
}