【发布时间】:2021-04-05 02:24:13
【问题描述】:
昨天我在 Amazon Elastic Beanstalk 上部署了我的第一个烧瓶应用程序。 应用程序正在运行,但是当我按下启动抓取过程的按钮时出现问题。 这个过程很长,大概需要 3/4 分钟,很明显,在我按下按钮一分钟后,我得到了 504 错误。
我在互联网上阅读了很多关于如何解决这个问题的内容,它与 nginx 相关,但没有任何效果。
这是我尝试过的:
1. EC2 负载均衡器 我创建了一个连接到我的 istance 的负载均衡器,并将空闲超时增加到 300 秒。但什么都没有改变。
2。在我的项目中添加了 .ebextensions 我还尝试使用 my_name.conf 修改 nginx 参数
.ebextensions -> nginx -> conf.d -> my_name.conf
my_name.conf
keepalive_timeout 240s
proxy_read_timeout 240s;
proxy_send_timeout 240s;
proxy_connect_timeout 240s;
单独在.ebextensions
proxy.config
container_commands:
01_reload_nginx:
command: 'sudo service nginx reload'
这个解决方案都不起作用。
所以我尝试了另一种方法
在.ebextensions我创建了这个文件,但没有用,然后我尝试输入.ebextensions -> nginx,但问题仍然存在。
proxy.config
files:
“/etc/nginx/conf.d/01-timeout.conf”:
mode: “000644”
owner: root
group: root
content: |
keepalive_timeout 240s;
proxy_connect_timeout 240s;
proxy_send_timeout 240s;
proxy_read_timeout 240s;
fastcgi_send_timeout 240s;
fastcgi_read_timeout 240s;
container_commands:
nginx_reload:
command: “sudo service nginx reload”
我的项目结构是:
my_app
-> .ebextensions
->project (where there are python file with all the code)
->application.py (python file wiith main used to load all the file and launch the app)
->requirements.txt
你知道如何解决这个问题吗? 提前致谢
【问题讨论】:
-
是否可以通过设置以某种方式更改空闲超时?因为我不想手动配置它
标签: amazon-web-services nginx flask amazon-ec2 amazon-elastic-beanstalk