kra*_*aiz 8 mp4 caching cdn nginx pseudo-streaming
我尝试使用nginx(origin + edge)设置至少2台服务器.都用mp4 -module 编译.原点包含我所有的mp4文件.Edge配置了所有按预期工作的缓存内容(见下文),第二次每个mp4文件请求由没有原始流量的边缘缓存提供.
但我希望能够在文件中寻找.功能来自mp4模块.只需追加查询参数"?start = 120"即告诉nginx以时间戳120秒开始提供mp4内容.这适用于直接请求的原点.但是只要我在nginx的缓存位置启用mp4-module,请求就会是404.
nginx.conf @ origin:
server {
  listen       80;
  server_name  localhost;
  root         /usr/share/nginx/www;
  location ~ \.mp4$ {
    mp4;
    expires max;
  }
}
nginx.conf @ edge:
proxy_cache_path /usr/share/nginx/cache levels=2:2 keys_zone=icdn_cache:10m inactive=7d max_size=2g;
proxy_temp_path /usr/share/nginx/temp;
proxy_ignore_headers X-Accel-Expires Cache-Control Set-Cookie;
log_format cache '[$time_local] Cache: $upstream_cache_status $upstream_addr $upstream_response_time $status $bytes_sent $proxy_add_x_forwarded_for $request_uri';
access_log /usr/local/nginx/logs/cache.log cache;
upstream origin {
  server <origin-domain>;
}
server {
  listen       80;
  server_name  localhost;
  location ~ \.mp4$ {
    mp4;
    proxy_cache icdn_cache;
    proxy_pass http://origin;
    proxy_cache_key $uri;
  }
}
我也尝试过:
location / {
  location ~ \.mp4$ { mp4; }
  proxy_cache icdn_cache;
  proxy_pass http://origin;
  proxy_cache_key $uri;
}
有没有办法让缓存的mp4文件与mp4-module的搜索功能一起工作?
小智 0
您必须使用proxy_store. proxy_cache将为每个请求创建很多文件?start=xxxx。
要让 mp4 模块在文件中查找,您需要完整的电影。proxy_store将在缓存服务器上创建一个镜像。
| 归档时间: | 
 | 
| 查看次数: | 4047 次 | 
| 最近记录: |