Amazon Elastic Beanstalk ebextension [英] Amazon Elastic Beanstalk ebextension
问题描述
我想在Amazon Elastic Beanstalk上使用ebextension配置nginx配置,
I want to config the nginx config with the ebextension at Amazon Elastic Beanstalk,
conf的内容如下:
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]/var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf:7中的未知指令文件:"
nginx: [emerg] unknown directive "files:" in /var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf:7
我将此文件放在
ROOT.war
|- ROOT/
|- .ebextensions
|- nginx
|- conf.d
|- custom-nginx-proxy.conf
|- Others content
推荐答案
您的扩展名应放在 .ebextensions/01-custom-nginx-proxy.config .另外,第二个块应该以 container_commands:
开头,而不是 contatiner_commands:
,并且您不需要 sudo
,因为部署已经在运行作为根.如果这样做没有帮助,请尝试在每个缩进级别使用两个空格.EB扩展使用YAML编写,它对空格非常敏感.
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.
如果您仍然遇到问题,请发布/var/elasticbeanstalk/staging/nginx/conf.d/custom-nginx-proxy.conf
的内容-您创建后创建的文件部署.
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.
这篇关于Amazon Elastic Beanstalk ebextension的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!