Nginx 不接受字节范围

2024-02-18

我正在使用 nginx 来提供文件系统中的视频。我想启用范围请求。

目前这是我的文件返回的结果

curl -I fileurl
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 29 Mar 2014 06:41:41 GMT
Content-Type: video/mp4
Content-Length: 15603963
Last-Modified: Sat, 04 Jan 2014 15:02:26 GMT
Connection: keep-alive
Keep-Alive: timeout=300
Accept-Ranges: bytes

但如果我发送 curl --header“范围:字节=0-50”fileurl

整个文件已下载。

这是 nginx 配置中的服务器:

server {
            listen 80;
            server_name myserver;
            error_log logs/myserver.error.log;
            access_log logs/myserver.access.log;

            root /srv/myserver;

            #add_header Accept-Ranges;
            add_header Accept-Ranges bytes;
    }

我还需要启用其他功能吗?我如何允许文件的范围请求?


将以下行添加到我的 nginx 站点配置后,我能够使范围请求正常工作

    proxy_force_ranges on;

您可以阅读更多相关内容here http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_force_ranges

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Nginx 不接受字节范围 的相关文章

随机推荐