Nginx 配置 mp4 流媒体支持
版本Nginx-1.9.1编译与配置1. cd /usr/local/tools/nginx/ # NGINX的解压目录2. 使用 nginx -V 获得现有的nginx的编译配置信息3. ./configure<原有的NGINX的编译配置>--with-http_mp4_module # 添加mp4模块--with-http_flv_module # 添加flv模块,我先加上防止以后
·
版本
- Nginx-1.9.1
编译与配置
1. cd /usr/local/tools/nginx/ # NGINX的解压目录
2. 使用 nginx -V 获得现有的nginx的编译配置信息
3. ./configure
<原有的NGINX的编译配置>
--with-http_mp4_module # 添加mp4模块
--with-http_flv_module # 添加flv模块,我先加上防止以后公司有需要--可选
4. make # 编译 不要make install
5. 备份原有的nginx
6. 复制 objs中的nginx到命令路径下
7. 配置nginx
location ~* /videos/.*\.mp4 {
rewrite ^/videos/(.*)\.(mp4) /$1.$2 break; #此处去掉ideos只保留后面的路径,不在二次匹配
root /usr/files/videos/;
mp4;
mp4_buffer_size 1m;#处理mp4初始内存大小
mp4_max_buffer_size 50m;#处理mp4最大内存大小
limit_rate 150k; #限速
limit_rate_after 20m; #在20m后限速
}
8. 重新加载 nginx
上传文件测试
<video controls width="960" height="400">
<source src="https://xxx.xxxxx.com/videos/2/3.mp4"></source>
</video>
参考
更多推荐
已为社区贡献2条内容
所有评论(0)