【问题标题】:Adding to ngnix configuration using .ebextensions使用 .ebextensions 添加到 nginx 配置
【发布时间】:2020-09-17 05:07:06
【问题描述】:

我正在尝试向 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】:

    存在缩进问题。应该是(注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

    可能还有其他原因导致它失败,从简短的问题中无法判断。但是缩进绝对是您遇到问题的原因之一。

    【讨论】:

      猜你喜欢
      • 2020-12-14
      • 2014-02-15
      • 2013-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-23
      • 1970-01-01
      • 2016-02-22
      相关资源
      最近更新 更多