linux视频服务器 nigx,nginx实现 mp4流媒体服务器

一.安装编译时说需要的扩展

yum install automake autoconf make gcc gcc-c++

二.安装nginx-rtmp-module

2.1第一种方式比较简单

yum install pcre pcre-devel

yum install zlib zlib-devel

yum install openssl openssl--devel

然后下载nginx,nginx-rtmp-module模块,并解压

git clone https://github.com/arut/nginx-rtmp-module.git

因为已经安装nginx,是一键安装的

#进入源代码目录

cd /usr/local/lnmp-1.4/src/

#解压

tar -xvf nginx-1.12.1.tar.gz

#进入解压后的nginx 目录

cd nginx-1.12.1

#编译

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/usr/local/src/lnmp1.4/src/openssl-1.0.2l --with-ld-opt=-ljemalloc --add-module=/usr/local/src/nginx-rtmp-module

#安装

make && make install

配置nginx.conf

说明:添加这个两个参数 : limit_rate_after 5m;  limit_rate 200k;

server

{

listen 80 default_server;

#listen [::]:80 default_server ipv6only=on;

server_name _;

index index.html index.htm index.php;

root /var/www/html/video;

limit_rate_after 5m;

limit_rate 100k;

#error_page 404 /404.html;

# Deny access to PHP files in specific directory

#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

include enable-php.conf;

location /nginx_status

{

stub_status on;

access_log off;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*\.(js|css)?$

{

expires 12h;

}

location ~ /.well-known {

allow all;

}

location ~ /\.

{

deny all;

}

access_log /home/wwwlogs/access.log;

}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值