0

I want to config the nginx config with the ebextension at Amazon Elastic Beanstalk,

The content of the conf as below:

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"

but always got the error about the content,

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

I put this file at

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

1 Answer 1

2

Your extension should be placed at .ebextensions/01-custom-nginx-proxy.config. Also, the second block should start with container_commands:, not contatiner_commands:, and you don't need sudo as the deployment will already be running as root. If that doesn't help, try using two spaces per indent level. EB extensions are written in YAML, which is very sensitive to whitespace.

If you're still stuck, please post the contents of /var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf - the file that gets created after your deployment.

2
  • It should be 01-custom-nginx-proxy.conf or 01-custom-nginx-proxy.config ?
    – Tommy Yeh
    May 11, 2018 at 9:25
  • It should be .config - sorry for the typo.
    – Brian
    May 14, 2018 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.