【问题标题】:Change Timeout of Gunicorn Elastic BeanstalkGunicorn Elastic Beanstalk 更改超时
【发布时间】:2020-11-27 04:59:34
【问题描述】:

我正在尝试更改 Gunicorn 在 Python 3.7 Amazon Linux 2(版本 3.1)Elastic Beanstalk 部署上的超时。我的 Procfile 看起来像:

web: gunicorn --bind :8000 --workers 3 --threads 2 --timeout 300 application.application:application

但我似乎仍然得到默认的 30 秒超时。

我在 .ebextensions 中的 nginx 配置如下所示:

files:
  "/etc/nginx/conf.d/timeout.conf" :
    mode: "000644"
    owner: root
    group: root
    content: |
      keepalive_timeout 600;
      proxy_connect_timeout 600;
      proxy_send_timeout 600;
      proxy_read_timeout 600;
      send_timeout 600; 
      fastcgi_send_timeout 600; 
      fastcgi_read_timeout 600;

任何帮助将不胜感激。

【问题讨论】:

  • 您好,我也遇到了同样的问题。我想问一个关于那个的问题。如何配置procfile?您是在源文件夹的什么位置添加的?
  • 在您部署的应用程序文件夹的根目录中创建一个名为 Procfile 的文件

标签: amazon-web-services flask amazon-elastic-beanstalk gunicorn


【解决方案1】:

由于您使用的是 Amazon Linux 2 (AL2),因此不支持通过 /etc/nginx/conf.d/timeout.conf 设置 nginx 选项。这可以解释为什么它们没有任何效果。

对于 AL2,nginx 设置应设置使用 .platform/nginx/conf.d/ 文件夹显示 here

因此,您可以尝试以下方法。有一个文件.platform/nginx/conf.d/myconfig.conf,内容如下:

keepalive_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600; 
fastcgi_send_timeout 600; 
fastcgi_read_timeout 600;

【讨论】:

  • 这样真的解决了gunicorn的配置问题吗?
猜你喜欢
  • 2014-10-13
  • 2021-04-16
  • 2015-01-18
  • 2018-03-21
  • 2014-07-29
  • 2018-08-14
  • 2022-06-28
  • 2018-09-15
  • 2014-07-03
相关资源
最近更新 更多