【问题标题】:Timeout issue in django with nginx and gunicornDjango 中的 nginx 和 gunicorn 超时问题
【发布时间】:2022-02-13 18:38:30
【问题描述】:

我在 django 中几乎没有其他 API,需要一分钟以上才能获取数据。因为数据库中有超过 2000 万条记录。但它在一分钟后显示超时。如何增加超时?我已经在互联网上搜索并相应地对 Nginx 和 Gunicorn 进行了更改,但是当我使用邮递员访问 API 时,它仍然会在一分钟后显示超时。

Nginx 配置文件 -

    location / {

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://unix:/home/neeraj/run/gunicorn.sock;

proxy_connect_timeout 500;

proxy_read_timeout 500s;  }

Gunicorn.service 文件 -

ExecStart=/home/neeraj/cashvenv/bin/gunicorn --error-logfile /home/neeraj/run/gerror.log --workers 3 --timeout 500 --bind unix:/home/neeraj/run/gunicorn.sock Cash.wsgi:application

编辑 nginx 日志

 - - [13/Feb/2022:15:49:25 +0530] "POST /reporting/dashboard/cards HTTP/1.1" 499 0 "-" "PostmanRuntime/7.28.4" "

请帮帮我。

【问题讨论】:

  • 能否分享一下nginx错误日志。谁关闭连接?上游或浏览器。你是如何发送请求的?来自网络浏览器?
  • @TimoStark nginx 日志 atteched 。我正在用邮递员打 api。即使我卷曲它仍然显示超时

标签: django nginx gunicorn


【解决方案1】:

这是来自 AWS 方面的问题。我的服务器连接了一个负载均衡器,其中超时设置为 60 秒。

【讨论】:

  • 是的。就是想问这个。错误代码 499 表示与 NGINX 的连接已被客户端关闭。 LoadBalancer 通常是问题所在。很高兴它正在工作!
猜你喜欢
  • 2015-12-24
  • 2013-12-15
  • 2019-10-29
  • 2021-01-02
  • 1970-01-01
  • 2014-09-14
  • 2018-09-20
  • 2019-05-06
  • 1970-01-01
相关资源
最近更新 更多