我在使用弹性beantalk

时间:2020-09-14 03:29:00

标签: amazon-web-services nginx amazon-elastic-beanstalk

我正在使用带codePipeline的Elasticbeanstalk进行部署。

我必须增加文件大小才能上传, 因此我将02_nginx.config文件添加到我的应用目录(.ebextensions)中。

这是我的-2_nginx_config

#Elastic Beanstalk configuration for  413 Request Entity Too Large:.


container_commands:
  01_reload_nginx:`enter code here`
  command: "sudo service nginx reload"

  files:
  "/etc/nginx/conf.d/proxy.conf" :
  mode: "000644"
  owner: root
  group: root
  content: |
  client_max_body_size 100M;

,部署时出现问题。 这是消息:

部署已完成,但有错误:无法部署应用程序。应用程序版本代码-pipeline-1600053611774-BuildArtifact-5e317627-6a37-4548-aa47-f6d4ebb03e2f中的配置文件.ebextensions / 02_nginx.config包含无效的YAML或JSON。 YAML异常:无效的Yaml:扫描“ ”第13行第3列中的简单键时:client_max_body_size 0; ^在“ ”的第14行,第1列,第1行:^中找不到预期的':',JSON异常:无效的JSON:位置0处的字符(#)意外。更新配置文件。

什么是问题?

1 个答案:

答案 0 :(得分:0)

您要尝试使用的nginx设置(/etc/nginx/conf.d/proxy.conf)用于 Amazon Linux 1

由于您可能正在使用 Amazon Linux 2 ,因此应该使用不同的文件来设置nginx。对于AL2,nginx设置应位于.platform/nginx/conf.d/中,而不是docs中所示的.ebextentions中。

因此,您可以将以下.platform/nginx/conf.d/myconfig.conf与内容:

client_max_body_size 100M;

如果您使用.platform,也不需要重新启动Nginx。因此,基本上,将my-2_nginx_config替换为.platform/nginx/conf.d/myconfig.conf