【发布时间】:2019-02-15 22:39:00
【问题描述】:
我尝试使用
更改 nginx 配置尝试 1
.ebextensions/000_nginx.config
container_commands:
01_reload_nginx:
command: "sudo echo 'underscores_in_headers on;' >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf"
和
尝试 2
.ebextensions/000_nginx.config
files:
"/tmp/proxy.conf":
mode: "000644"
owner: root
group: root
content: |
underscores_in_headers on;
container_commands:
00-add-config:
command: cat /tmp/proxy.conf >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf
01-restart-nginx:
command: /sbin/service nginx restart
和
尝试 3
.ebextensions/nginx/conf.d/elasticbeanstalk/00_application.conf
location / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
underscores_in_headers on;
但每次尝试更新文件,然后在代码部署到 Beanstalk 后清除更改
如何防止覆盖配置文件或基本上如何更改 Nginx 配置?
【问题讨论】:
标签: amazon-web-services nginx amazon-elastic-beanstalk