I tried changing nginx config using
Attempt 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"
and
Attempt 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
and
Attempt 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;
But each try updates files and then clears out the changes after code deploy to Beanstalk
How can I prevent overwriting config files or basically how to change Nginx config?
I had a similar issue before. It might be because you are zipping and uploading the whole project folder instead of just the project folder contents
In the archive you upload to EBS, you should be able to override the nginx conf inside
.ebextensions/nginx/nginx.conf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With