gpt4 book ai didi

caching - 使用 Nginx 的分布式和缓存 MP4 伪流(搜索)

转载 作者:行者123 更新时间:2023-12-04 08:55:58 36 4
gpt4 key购买 nike

我尝试使用 nginx (origin + edge) 设置至少 2 台服务器。均使用 mp4 编译-模块。来源包含我所有的 mp4 文件。 Edge 配置了所有按预期工作的缓存内容(见下文),每个 mp4 文件请求第二次由边缘缓存提供服务,没有原始流量。

但我希望能够在文件中查找。该功能来自 mp4 模块。只需附加查询参数 "?start=120"告诉 nginx 从时间戳 120sec 开始提供 mp4 内容。这适用于直接请求的来源。但是一旦我在 nginx 的缓存位置启用 mp4-module,请求将是 404。

nginx.conf @起源:

server {
listen 80;
server_name localhost;
root /usr/share/nginx/www;
location ~ \.mp4$ {
mp4;
expires max;
}
}

nginx.conf @ 边缘:
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 的搜索功能一起工作?

最佳答案

您必须使用 proxy_store . proxy_cache将为每个 ?start=xxxx 创建大量文件要求。

要让 mp4 模块在文件中查找,您需要完整的电影。 proxy_store将在缓存服务器上创建一个镜像。

关于caching - 使用 Nginx 的分布式和缓存 MP4 伪流(搜索),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10024981/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com