使用 nginx 和 gunicorn 的 django 超时问题

Timeout issue in django with nginx and gunicorn

我很少休息 API,在 django 中需要一分钟以上的时间来获取数据。因为数据库中有超过 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" "

请帮我解决这个问题。

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