问题
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:
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.
来源:https://stackoverflow.com/questions/50153420/amazon-elastic-beanstalk-ebextension