大网数据广告活动
服务器运维问答

Nginx does not serve large files

· 52CE 我爱测

When trying to download a large file (not sure what size is enough, trying to download 5Gb), connection is stuck: $ wget --verbose http://example.net/large.zip -O /dev/null --2016-12-14 12:52:38-- http://example.net/large.zip Res…

问题原文

原帖链接 · Andrey · CC BY-SA 3.0

When trying to download a large file (not sure what size is enough, trying to download 5Gb), connection is stuck:

$ wget --verbose http://example.net/large.zip -O /dev/null
--2016-12-14 12:52:38--  http://example.net/large.zip
Resolving example.net (example.net)... 1.2.3.4
Connecting to example.net (example.net)|1.2.3.4|:80... connected.
HTTP request sent, awaiting response...

And this is going on forever, and by forever I mean 10 minutes at least.

nginx config for this kind of files:

location ~* ^.+\.(css|js|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
   access_log off;
   log_not_found off;
   expires 7d;
}

Small static files (and by small I mean for example 50Mb ones) are served fine.

Turning access_log off; to "on" does not help, there is nothing in logs on this request.

Changing file type from zip to another type does not help.

The most strange thing is that if I start the download and after this restart nginx, the download starts just fine. But only this one. If you start another download after server restart, it doesn't work in the same way.

已采纳解答

原帖链接 · Andrey · CC BY-SA 3.0

Oops my mistake.

There was a CDN configured in front of this server. And it needed too much time to get those files completely before it started to serve them. That's why the download started instantly when I restarted nginx. CDN was giving the incomplete file.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。