I need to add some locations to nginx.conf so the environment URL points to app.php. I have modified the file using vi. Restarting NGINX it works. But I need this configuration to be load automatically when I use eb deploy.
I have read and tried: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
How to configure .ebextensions for nginx location directive?
Amazon Elastic Beanstalk ebextension
I have /.ebextensions/01_nginx.config
files:
"/etc/nginx/nginx.conf":
mode: "0000644"
owner: root
group: root
content: |
My conf file
But that config is not working. I have tried changing "/etc/nginx/nginx.conf": by "/etc/nginx/my_nginx.conf": and the file appeared! So I tried to replace default file by my custom file with:
container_commands:
deleteConf:
command: "sudo rm /etc/nginx/nginx.conf"
changeConf:
command: "sudo cp /etc/nginx/my_nginx.conf /etc/nginx/nginx.conf"
Placed below previous config inside 01_nginx.config. But commands are not working. nginx.conf is not being deleted or replaced by mine. What I'm doing wrong?
Edit: I have read that files in .ebextensions are evaluated alphabetically. I was wondering if maybe the copy command was being executed before the file exists. So I created a new file /.ebextensions/02_copy.config and moved there
container_commands:
deleteConf:
command: "sudo rm /etc/nginx/nginx.conf"
changeConf:
command: "sudo cp /etc/nginx/my_nginx.conf /etc/nginx/nginx.conf"
No luck with that