使用.ebextensions添加到ngnix配置中

问题描述 投票:0回答:1

我正在尝试向nginx.conf中添加两个简单的东西,这些东西可以正常工作,直到在ELB上部署新版本为止,这是可以预期的,所以我知道我需要使用.ebextensions来执行此操作,但是我要么得到一个错误提示“模板中不允许使用空值”,否则将不起作用。

这是我的文件,位于/.ebextensions/custom.config中

files: 
    "/etc/nginx/conf.d/000_my_config.conf": 
    content: |
        client_max_body_size 100M;
        server {
            location / {
                index index.php index.html index.htm;
                try_files $uri $uri/ /index.php?$args;
            }
        }

仅尝试更改最大上载大小并添加位置信息以与Wordpress一起使用

amazon-web-services nginx amazon-elastic-beanstalk nginx-location ebextensions
1个回答
0
投票

存在indentation问题。它应该是(请注意content):

files: 
    "/etc/nginx/conf.d/000_my_config.conf": 
        content: |
            client_max_body_size 100M;
            server {
                location / {
                    index index.php index.html index.htm;
                    try_files $uri $uri/ /index.php?$args;
                }
            }

对于files的形式,请检查here

失败可能有其他原因,从简短的问题中看不出来。但是缩进绝对是您遇到问题的原因之一。

© www.soinside.com 2019 - 2024. All rights reserved.