昨天,我在 Amazon Elastic Beanstalk 上部署了我的第一个 Flask 应用程序。
应用程序正在运行,但当我按下启动抓取过程的按钮时出现问题。
这个过程相当长,可能需要大约 3/4 分钟,显然在我按下按钮一分钟后,我收到了 504 错误。
我在网上读了很多关于如何解决这个问题的内容,它与 nginx 有关,但没有任何效果。
这是我尝试过的:
1. EC2负载均衡器我创建了一个链接到我的实例的负载均衡器,并将空闲超时增加到 300 秒。但一切都没有改变。
2.将.ebextensions添加到我的项目中我还尝试用 my_name.conf 修改 nginx 参数
.ebextensions -> nginx -> conf.d -> my_name.conf
我的名字.conf
keepalive_timeout 240s
proxy_read_timeout 240s;
proxy_send_timeout 240s;
proxy_connect_timeout 240s;
并独自在.ebextensions
代理配置
container_commands:
01_reload_nginx:
command: 'sudo service nginx reload'
这个解决方案都不起作用。
所以我尝试了另一种方法
In .ebextensions
我创建了这个文件,但没有用,然后我尝试放入.ebextensions -> nginx
,但问题仍然存在。
代理配置
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
您知道如何解决这个问题吗?
提前致谢