亚马逊弹性豆茎 ebextension

Amazon Elastic Beanstalk ebextension

我想在 Amazon Elastic Beanstalk 上使用 ebextension 配置 nginx 配置,

conf内容如下:

files:
    "/etc/nginx/conf.d/custom-nginx-proxy.conf" :
        mode: "000755"
        owner: "root"
        group: "root"
        content: |
            client_max_body_size 60M;

contatiner_commands:
    reload_nginx:
        command: "sudo service nginx reload"

但总是得到关于内容的错误,

nginx: [emerg] unknown directive "files:" in /var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf:7

我把这个文件放在

ROOT.war 
   |- ROOT/
        |- .ebextensions
               |- nginx
                    |- conf.d
                         |- custom-nginx-proxy.conf
        |- Others content

您的分机应该放在 .ebextensions/01-custom-nginx-proxy.config。此外,第二个块应该以 container_commands: 开头,而不是 contatiner_commands:,并且您不需要 sudo,因为部署已经是 运行 作为根。如果这没有帮助,请尝试在每个缩进级别使用两个空格。 EB 扩展是用 YAML 编写的,它对空格非常敏感。

如果您仍然遇到问题,请 post /var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf 的内容 - 部署后创建的文件。