在弹性魔豆部署覆盖Nginx的配置文件? [英] Nginx config file overwritten during Elastic Beanstalk deployment?

查看:207
本文介绍了在弹性魔豆部署覆盖Nginx的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要P3P头添加到静态资源的位置在一个标准Nodejs和放大器; Nginx的弹性魔豆。

I need to add p3p headers to the static resource location on a standard Nodejs & Nginx Elastic Beanstalk.

我创建了一个 ebextension 脚本的<一个解释href="http://stackoverflow.com/questions/21335575/how-to-configure-ebextensions-for-nginx-location-directive/21336573#21336573">this问题。该脚本使用sed来添加别名线下 add_header 指令,这是在静态位置指令。它运行在 /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf 文件。

I've created an ebextension script as explained on this question. The script uses sed to add a add_header directive under the alias line, which is under the static location directive. It runs on the /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf file.

该脚本不仅修改了文件,它也将其复制到安全的位置,即/家庭/ EC2用户。据 /var/log/cfn-init.log ,该脚本正常运行。作为证据,修改后的文件的副本显示在正确的地方的附加头。但 /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf 文件不具备此修改

The script not only modifies the file, it also copies it to a "safe" location, i.e. /home/ec2-user. According to /var/log/cfn-init.log, the script runs correctly. As evidence, the copy of the modified file shows the additional header at the right place. But the /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf file does not have this modification.

我只能推断,尽管我的脚本运行正常,别的东西在以后的部署过程将覆盖它。这是奇怪的,因为<一href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands"相对=nofollow>根据容器中运行命令后,应用程序和Web服务器已经建立,所以我不认为这是什么文件。

I can only deduce that although my script runs fine, something else later in the deployment process overwrites it. Which is strange, because according to documentation container commands are run after the application and web server have been set up, so I don't see what does it.

那么浩/什么是覆盖该文件,哪能prevent呢?

So ho/what is overwriting this file and how can I prevent that?

推荐答案

要修改配置文件没有它被覆盖,解决的办法是修改位于模板文件/ tmp /部署/配置/ #等#nginx的#conf.d#00_elastic_beanstalk_proxy.config

To modify the config file without it being overwritten, the solution is to modify the template file located at /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.config

我更新这个文件,而不是添加需要的指令,并自动部署到 /etc/nginx/conf.d 中,修饰是活性

I update this file instead to add the desired directive, and it is automatically deployed to /etc/nginx/conf.d, and voila, the modification is active.

这篇关于在弹性魔豆部署覆盖Nginx的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆