centos7+nginx-1.13.5搭建mp4视频服务器

in #nginx6 years ago

1、yum -y install gcc-c++
2、wget http://nginx.org/download/nginx-1.13.5.tar.gz
3、tar -zxvf nginx-1.13.5.tar.gz
4、cd nginx-1.13.5
5、./configure --prefix=/usr/local/nginx --user=root --group=root --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_sub_module --with-http_stub_status_module --with-http_perl_module --with-http_mp4_module --with-http_flv_module
报错:./configure: error: perl module ExtUtils::Embed is required 解决: yum install perl perl-devel perl-ExtUtils-Embed -y
6、make && make install
7、vi /usr/local/nginx/conf/nginx.conf 修改下面这个地方为如下 8、启动 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
server {
#listen 80;
#server_name localhost;
listen 8080;
server_name 192.168.244.83;
root /usr/local/nginx/html/; #视频放置位置,可以修改
limit_rate_after 30m;
limit_rate 700k; #这里根据需要设置,意思是视频缓冲30M之后,限速为700k/s
index index.html;
charset utf-8;
#charset koi8-r;

    #access_log  logs/host.access.log  main;

    #location / {
        #root   html;
        #index  index.html index.htm;
    #}
location ~ \.flv$ {
          flv;
       }

location ~ \.mp4$ {
          mp4;
       }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
           root   html;
       }
    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

Coin Marketplace

STEEM 0.27
TRX 0.21
JST 0.038
BTC 96973.73
ETH 3678.85
USDT 1.00
SBD 3.86