Jalena Blog

  • 首页
  • 程序开发
    • Java
    • Spring
    • SpringBoot
    • SpringMvc
    • Python
    • Odoo
    • C#
    • SQL
    • Web
    • Linux
  • 移动设备
    • Android
    • Router
  • 杂七杂八
    • 我的废话
    • 音频
    • 视频
    • 常用软件
  • 关于
  1. 首页
  2. 杂七杂八
  3. 正文

Nginx 添加MP4流媒体模块(LNMP1.0)

2013-07-02

由于公司网站要用到在线视频,但是大部分时候不能在线缓冲播放。对客户体验很纠结。今天刚好在折腾就编译了一个。

以下是我的nginx的信息,如果符合可以试试

编译之前需要拿到之前编译的配置参数

nginx -V #查看编译配置参数

[root@bcsytv nginx-1.4.1]# nginx -V
nginx version: nginx/1.4.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6

接下来就可以开始了

cd /root/lnmp1.0-full
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf nginx_mod_h264_streaming-2.2.7.tar.gz

首先备份我们之前的程序配置

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

接着给nginx增加需要的模块

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/root/lnmp1.0-full/nginx_mod_h264_streaming-2.2.7

等待,如果出现错误,需要注释掉nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c的以下内容:

if (r->;zero_in_uri)
{
return NGX_DECLINED;
}

接着返回/root/lnmp1.0-full/nginx-1.4.1

清除之前编译错误的模块,从新编译

make clean
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/root/lnmp1.0-full/nginx_mod_h264_streaming-2.2.7
make
nginx -t
make install

如果成功你看到的应该是这样的内容

[root@bcsytv nginx-1.4.1]# nginx -V
nginx version: nginx/1.4.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/root/lnmp1.0-full/nginx_mod_h264_streaming-2.2.7

接着就添加支持吧~
在server段中添加

location ~ .*.mp4${
mp4;
}
标签: LNMP
最后更新:2021-10-15

Jalena

原创内容,转载请注明出处! 部分内容来自网络,请遵守法律适用!

点赞
< 上一篇
下一篇 >

文章评论

  • 博友会

    效果看起来很不错

    2013-07-04
    回复
  • razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
    取消回复

    【腾讯云】云服务器特惠热卖中
    标签聚合
    java Centos odoo 其他 生活 wordpress docker MySql
    分类
    • Android / 4篇
    • C# / 10篇
    • Codec / 9篇
    • Conversion / 14篇
    • Editing / 16篇
    • Java / 47篇
    • Javascript / 3篇
    • Linux / 29篇
    • Odoo / 25篇
    • Python / 6篇
    • SQL / 30篇
    • Web / 3篇
    • Windows / 4篇
    • 我的日记 / 10篇
    • 杂七杂八 / 93篇
    • 软件开发 / 72篇
    • 非线性编辑 / 1篇

    COPYRIGHT © 2026 Jalena Blog. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    蜀ICP备17025376号