下载nginx

http://nginx.org/en/download.html

下载模块nginx-vod-module

git clone https://github.com/kaltura/nginx-vod-module

编译安装

./configure --prefix=/usr/local/nginx \
--with-file-aio \
--with-http_mp4_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_gunzip_module \
--with-http_stub_status_module \
--with-pcre \
--add-module=/opt/software/nginx-vod-module \
--with-threads \
--with-debug

配置文件

worker_processes 24;
worker_rlimit_nofile 204800;
  events {
  worker_connections 102400;
  use epoll;
 }


http {
    include mime.types;
    default_type application/octet-stream;
    limit_conn_zone $binary_remote_addr zone=addr:10m;
    limit_req_zone $binary_remote_addr zone=req_one:10m rate=100r/m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 300;
    server_tokens off;
    etag off;
    client_body_timeout 3s;
    client_header_timeout 5s;
    proxy_connect_timeout 30s;
    proxy_read_timeout 30s;
    proxy_send_timeout 30s;
    proxy_buffer_size 32k;
    proxy_buffers 32 64k;
    proxy_busy_buffers_size 64k;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    include vhost/*.conf;
}


server {
    listen 8080;
    serverer_name localhost;
    open_file_cache max=1000 inactive=5m;
    open_file_cache_valid 2m;
    open_file_cache_min_uses 1;
    open_file_cache_errors on;
    location / {
        vod hls;
        vod_hls_absolute_index_urls off;
        vod_align_segments_to_key_frames on;
        vod_secret_key "4kgd$vod_filepath";
       # vod_hls_encryption_method aes-128;

        root /opt/video;

        gzip on;
        gzip_types application/vnd.apple.mpegurl;

        expires 100d;
     }
 }

ps:现在只支持MP4,模块生效后普通访问nginx报400

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐