0

我想在 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] 未知指令“文件:”在 /var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf:7

我把这个文件放在

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

1 回答 1

2

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

如果您仍然卡住,请发布/var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf- 部署后创建的文件的内容。

于 2018-05-09T17:27:35.253 回答