Reputation: 33
.conf file
files:
"/etc/nginx/conf.d/01_proxy.conf":
mode: "000644"
owner: root
group: root
content: |
client_max_body_size 200M;
container_commands:
01_reload_nginx:
command: "sudo nginx -s reload"
I have put this file in all possible folders:
.ebextensions
|-- 01_nginx.conf
|
|--nginx
|--01_nginx.conf
|--conf.d
|--01_nginx.conf
when I check the log, the first message is
2020/07/31 18:23:59.603405 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.
then
2020/07/31 18:23:59.603427 [INFO] Executing instruction: CleanEbExtensions
In theory when .ebextensions is cleant the custom commands should already have been executed, but they are not (when I connect via ssh to the server no file has been created as well as if I try to upload files, the server responds with a 413).
I have also tried modifying the nginx.conf file in /etc/nginx/ but it is reset everytime I update the code. All the /etc/nginx/ directory seems to be reset because I have also tried to put a "000_custom.conf" file in "/etc/nginx/conf.d/", but with no results.
Edit: I'd like to point out that if I modify nginx.conf in "/etc/nginx/" on the server and I do a "sudo nginx -s reload" it works till the next code build.
Upvotes: 3
Views: 302
Reputation: 238051
The likely reason why your nginx config does not work is that you are using current version of EB which is based on Amazon Linux 2 (AL2). However, your nginx config files are for AL1, which is old.
For AL2, nginx settings should be in .platform
, not in .ebextentions
as shown in the docs.
Therefore, you could try creating file .platform/nginx/conf.d/mynginx.conf
with the content of:
client_max_body_size 200M;
Upvotes: 2