Linux 上传大文件时超时?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7348935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:04:53  来源:igfitidea点击:

Timeout when uploading a large file?

djangolinuxnginxgunicorn

提问by dougv

I am running a Django app on a Linux platform with gunicorn and Nginx. I allow users to upload a CSV file (approx 2MB) which the app processes and adds to the backend database. The problem is for large files something seems to be timing out after around 2 or 3 minutes and a page entitled 404 Not Found nginx/0.7.6 is displayed. The URL does not change however - i.e., it remains as the URL to the file upload page of my app.

我正在使用 gunicorn 和 Nginx 在 Linux 平台上运行 Django 应用程序。我允许用户上传应用程序处理并添加到后端数据库的 CSV 文件(约 2MB)。问题是对于大文件,大约 2 或 3 分钟后似乎超时,并显示了一个名为 404 Not Found nginx/0.7.6 的页面。但是,该 URL 不会更改 - 即,它仍然是我的应用程序文件上传页面的 URL。

The Nginx error log shows:

Nginx 错误日志显示:

2011/09/08 13:28:05 [error] 1349#0: *303 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 213.146.112.122, server: _, request: "POST /app/import_csv/ HTTP/1.1", upstream:

2011/09/08 13:28:05 [错误] 1349#0:*303 上游超时(110:连接超时),同时从上游读取响应头,客户端:213.146.112.122,服务器:_,请求:“POST /app/import_csv/ HTTP/1.1", 上游:

Any ideas what's happening? How can I increase this timeout?

任何想法发生了什么?我怎样才能增加这个超时?

采纳答案by dougv

I added:

我补充说:

proxy_read_timeout 1200;

to nginx.conf. This increased the timeout from the default which fixed the problem. I probably don't need to use 1200, it's just the first value I tried.

到 nginx.conf。这增加了解决问题的默认超时。我可能不需要使用 1200,这只是我尝试的第一个值。