Nginx(tengine)添加mp4流媒体支持

Nginx(tengine)添加mp4流媒体支持

#网上下载nginx_mod_h264_streaming-2.2.7.tar.gz

#解压

#tar -xzvf nginx_mod_h264_streaming-2.2.7.tar.gz

#cd nginx_mod_h264_streaming-2.2.7

修改Makefile文件中NGINX项的值为NGINX=$(HOME)/nginx-1.6.2/ ,nginx-1.6.2为你安装的nginx的版本

#vim Makefile

#vim nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c

以下

TODO: Win32

if (r->zero_in_uri)

{

return NGX_DECLINED;

}

改成

/*

TODO: Win32

if (r->zero_in_uri)

{

return NGX_DECLINED;

}

*/

 

#首先执行命令找到nginx路径

#ps aux | grep nginx

==1#查看编译参数,在原有参数基础上增加模块

#cd /usr/local/nginx/sbin

#./nginx -V

Tengine version: Tengine/2.1.0 (nginx/1.6.2)

built by gcc 4.4.7 20120313 (Red Hat4.4.7-11) (GCC)

TLS SNI support enabled

configurearguments: --add-module=/root/nginx_mod_h264_streaming-2.2.7--prefix=/usr/local/nginx --with-http_stub_status_module--with-openssl=/root/openssl-1.0.2a --with-pcre=/root/pcre-8.13--with-http_mp4_module --with-http_flv_module

loaded modules:

    ngx_core_module (static)

   ngx_errlog_module (static)

   ngx_conf_module (static)

   ngx_dso_module (static)

   ngx_syslog_module (static)

   ngx_events_module (static)

   ngx_event_core_module (static)

   ngx_epoll_module (static)

   ngx_procs_module (static)

   ngx_proc_core_module (static)

   ngx_openssl_module (static)

   ngx_regex_module (static)

   ngx_http_module (static)

   ngx_http_core_module (static)

   ngx_http_log_module (static)

   ngx_http_upstream_module (static)

   ngx_http_static_module (static)

   ngx_http_autoindex_module (static)

   ngx_http_index_module (static)

   ngx_http_auth_basic_module (static)

   ngx_http_access_module (static)

   ngx_http_limit_conn_module (static)

   ngx_http_limit_req_module (static)

    ngx_http_geo_module (static)

   ngx_http_map_module (static)

   ngx_http_split_clients_module (static)

   ngx_http_referer_module (static)

   ngx_http_rewrite_module (static)

   ngx_http_ssl_module (static)

   ngx_http_proxy_module (static)

   ngx_http_fastcgi_module (static)

   ngx_http_uwsgi_module (static)

   ngx_http_scgi_module (static)

   ngx_http_memcached_module (static)

   ngx_http_empty_gif_module (static)

   ngx_http_browser_module (static)

   ngx_http_user_agent_module (static)

   ngx_http_flv_module (static)

   ngx_http_mp4_module (static)

   ngx_http_upstream_ip_hash_module (static)

   ngx_http_upstream_consistent_hash_module (static)

   ngx_http_upstream_check_module (static)

   ngx_http_upstream_least_conn_module (static)

   ngx_http_reqstat_module (static)

   ngx_http_upstream_keepalive_module (static)

   ngx_http_upstream_dynamic_module (static)

   ngx_http_stub_status_module (static)

   ngx_http_write_filter_module (static)

   ngx_http_header_filter_module (static)

   ngx_http_chunked_filter_module (static)

   ngx_http_range_header_filter_module (static)

   ngx_http_gzip_filter_module (static)

   ngx_http_postpone_filter_module (static)

   ngx_http_ssi_filter_module (static)

   ngx_http_charset_filter_module (static)

   ngx_http_userid_filter_module (static)

   ngx_http_footer_filter_module (static)

   ngx_http_trim_filter_module (static)

   ngx_http_headers_filter_module (static)

   ngx_http_upstream_session_sticky_module (static)

   ngx_http_h264_streaming_module (static)

   ngx_http_copy_filter_module (static)

   ngx_http_range_body_filter_module (static)

   ngx_http_not_modified_filter_module (static)

 

==2#进入nginx(tengine)源码目录

# cd tengine-2.1.0

执行以下(在原有参数基础上增加模块)
./configure --add-module=/root/nginx_mod_h264_streaming-2.2.7\
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-openssl=/root/openssl-1.0.2a \
--with-pcre=/root/pcre-8.13 \
--with-http_mp4_module \
--with-http_flv_module

 

==3#只需make不需要make install  【makeclean / make】

#make
 
==4#备份nginx并拷贝新的

#mv /usr/local/nginx/sbin/nginx/usr/local/nginx/sbin/nginx.old

#cp objs/nginx /usr/local/nginx/sbin/nginx
 

#配置文件
#vim /usr/local/nginx/conf/nginx.conf

 

location~* \.(gif|jpg|png|bmp|mp4|mp3)$ {

     root   /bamboodata;

    index  index.html index.htm;

     access_log logs/custom.log wscstatic ;

}

 

location ~* .*.mp4$ {
      mp4;
}

location~* .flv$ {

         flv;

}


#测试
#cd /usr/local/nginx/sbin

#./nginx -t


#平滑重启
#./nginx -s reload
 

#查看编译参数
#cd /usr/local/nginx/sbin
#./nginx -V

[root@10-10-78-50 sbin]# ./nginx -V

Tengine version: Tengine/2.1.0 (nginx/1.6.2)

built by gcc 4.4.7 20120313 (Red Hat4.4.7-11) (GCC)

TLS SNI support enabled

configurearguments: --add-module=/root/nginx_mod_h264_streaming-2.2.7--prefix=/usr/local/nginx --with-http_stub_status_module--with-openssl=/root/openssl-1.0.2a --with-pcre=/root/pcre-8.13--with-http_mp4_module --with-http_flv_module

loaded modules:

    ngx_core_module (static)

   ngx_errlog_module (static)

   ngx_conf_module (static)

   ngx_dso_module (static)

   ngx_syslog_module (static)

   ngx_events_module (static)

   ngx_event_core_module (static)

   ngx_epoll_module (static)

   ngx_procs_module (static)

   ngx_proc_core_module (static)

   ngx_openssl_module (static)

   ngx_regex_module (static)

   ngx_http_module (static)

   ngx_http_core_module (static)

   ngx_http_log_module (static)

   ngx_http_upstream_module (static)

   ngx_http_static_module (static)

   ngx_http_autoindex_module (static)

   ngx_http_index_module (static)

   ngx_http_auth_basic_module (static)

   ngx_http_access_module (static)

   ngx_http_limit_conn_module (static)

   ngx_http_limit_req_module (static)

    ngx_http_geo_module (static)

   ngx_http_map_module (static)

   ngx_http_split_clients_module (static)

   ngx_http_referer_module (static)

   ngx_http_rewrite_module (static)

   ngx_http_ssl_module (static)

   ngx_http_proxy_module (static)

   ngx_http_fastcgi_module (static)

   ngx_http_uwsgi_module (static)

   ngx_http_scgi_module (static)

   ngx_http_memcached_module (static)

   ngx_http_empty_gif_module (static)

   ngx_http_browser_module (static)

   ngx_http_user_agent_module (static)

   ngx_http_flv_module (static)

   ngx_http_mp4_module (static)

   ngx_http_upstream_ip_hash_module (static)

   ngx_http_upstream_consistent_hash_module (static)

   ngx_http_upstream_check_module (static)

   ngx_http_upstream_least_conn_module (static)

   ngx_http_reqstat_module (static)

   ngx_http_upstream_keepalive_module (static)

   ngx_http_upstream_dynamic_module (static)

   ngx_http_stub_status_module (static)

   ngx_http_write_filter_module (static)

   ngx_http_header_filter_module (static)

   ngx_http_chunked_filter_module (static)

   ngx_http_range_header_filter_module (static)

   ngx_http_gzip_filter_module (static)

   ngx_http_postpone_filter_module (static)

   ngx_http_ssi_filter_module (static)

   ngx_http_charset_filter_module (static)

   ngx_http_userid_filter_module (static)

   ngx_http_footer_filter_module (static)

   ngx_http_trim_filter_module (static)

   ngx_http_headers_filter_module (static)

   ngx_http_upstream_session_sticky_module (static)

   ngx_http_h264_streaming_module (static)

   ngx_http_copy_filter_module (static)

   ngx_http_range_body_filter_module (static)

   ngx_http_not_modified_filter_module (static)


其他命令
【停止nginx】
#cd/usr/local/nginx/sbin
#servicenginx stop


【启动nginx】
#cd/usr/local/nginx/sbin
#./nginx


【查看状态】
#cd/usr/local/nginx/sbin
#servicenginx status

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值