javascript – Nginx node.js表示下载大文件停在1.08GB

我有这个由Nginx代理的node.js应用程序(正在制作中).路线是这样的:

exports.download = function(req,res){

    var id = req.params.id;

    if (id && id == 'latest')
    {
        res.download(config.items.release_directory+'/<1.6GB-file>.zip',function(err){
            if (err) {
                console.log(err);
            } else {
                // do something
            }
        });
    }
    else
    {
        res.redirect(301,'/');
    }

};

因此,单击正确的路径/ URL,浏览器开始下载大文件,但随后它始终停止在1.08GB(文件大约为1.6GB),截断它.

我真的不明白为什么.有任何想法吗?

编辑:
config.items.release_directory是一个静态Express目录,声明为:

app.use('/releases',express.static(path.join(__dirname,'..','releases')));

EDIT2:
在没有Nginx的情况下使用grunt直接服务应用程序的开发它可以正常工作.

求助:阅读下面的评论,问题是Nginx中的proxy_max_temp_file_size变量

最佳答案
这里的问题是nginx配置,而不是nodejs代码.

nginx在将临时文件发送到客户端之前将其写入磁盘,如果站点要提供大型静态文件,通常最好禁用此缓存,例如:

location / {
    proxy_max_temp_file_size 0;
}

(没有限制)

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...