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.
For me the remedy were these two settings:
In the file:
/etc/nginx/nginx.conf
Add:
Between the lines
client_max_body_size 128M;
andserver_names_hash_bucket_size 256;
:The answer appears to be in these links. One, two. Basically, disable the disk cache
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.