We're using CodeBuild to automatically deploy to EBS. We need to modify nginx with a proxy.conf file containing:
client_max_body_size 20M;
to allow us to upload photos to S3. So far none of the documented methods to do this have worked. I initially attempted the following yaml content in .ebextensions/nginx_files.config:
files:
"/etc/nginx/conf.d/01_proxy.conf":
mode: "000644"
owner: root
group: root
content: |
client_max_body_size 20M;
container_commands:
01_nginx_reload:
command: “systemctl reload nginx”
This had no effect. After more research I discovered the new method for modifying the nginx config on Amazon Linux 2 is creating the conf file within the .platform directory. I tried using both these paths:
./platform/nginx/conf.d/00_proxy.conf
./platform/nginx/conf.d/elasticbeanstalk/00_proxy.conf
The 00_proxy.conf file is created on the EC2 instance in /var/app/staging, but is never copied to /etc/nginx/conf.d or /etc/nginx/conf.d/elasticbeanstalk. The next thing I tried was launching a script from Buildfile to copy the file into the correct place. I can see in /var/log/messages on the EC2 instance that Buildfile runs the script, but gets a permission denied message when attempting to copy. If I execute the cp command with sudo I get errors about needing a root password. How can I get around this permission issue?