gpt4 book ai didi

python - AWS python Flask EB .ebextensions .conf 文件不工作

转载 作者:行者123 更新时间:2023-12-04 04:00:06 25 4
gpt4 key购买 nike

.conf文件

files:
"/etc/nginx/conf.d/01_proxy.conf":
mode: "000644"
owner: root
group: root
content: |
client_max_body_size 200M;

container_commands:
01_reload_nginx:
command: "sudo nginx -s reload"

我已将此文件放入所有可能的文件夹中:

.ebextensions
|-- 01_nginx.conf
|
|--nginx
|--01_nginx.conf
|--conf.d
|--01_nginx.conf

当我查看日志时,第一条消息是

2020/07/31 18:23:59.603405 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.

然后

2020/07/31 18:23:59.603427 [INFO] Executing instruction: CleanEbExtensions

理论上,当 .ebextensions 干净时,自定义命令应该已经执行,但它们没有(当我通过 ssh 连接到服务器时,没有创建文件,如果我尝试上传文件,服务器响应带有 413)。

我也尝试过修改/etc/nginx/中的 nginx.conf 文件,但每次更新代码时它都会被重置。所有的/etc/nginx/目录似乎都被重置了,因为我也尝试在“/etc/nginx/conf.d/”中放置一个“000_custom.conf”文件,但没有结果。

编辑:我想指出的是,如果我修改服务器上“/etc/nginx/”中的 nginx.conf 并执行“sudo nginx -s reload”,它会一直工作到下一个代码构建。

最佳答案

您的 nginx 配置不起作用的可能原因是您使用的是基于 Amazon Linux 2 (AL2) 的当前版本的 EB。但是,您的 nginx 配置文件适用于旧的 AL1。

对于 AL2,nginx 设置应该在 .platform 中,而不是在 .ebextentions 中,如 docs 中所示.

因此,您可以尝试使用以下内容创建文件 .platform/nginx/conf.d/mynginx.conf:

client_max_body_size 200M;

关于python - AWS python Flask EB .ebextensions .conf 文件不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63197420/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com