I followed the advice here to configure the nginx reverse proxy to allow files larger than the default 1mb. So, my code in
/.platform/nginx/conf.d/prod.conf
looks like this:
http {
client_max_body_size 30M;
}
However, this seems to have no effect, and nginx still registers an error when I try to upload a file larger than 1mb.
I also tried doing this without the http
and braces, as detailed in the accepted answer to this question, like this:
client_max_body_size 30M;
This also had no effect.
I thought it might be necessary to restart nginx after applying the configuration, so I added a file in the .ebextensions directory called 01nginx.config
, which looks like this:
commands:
01_reload_nginx:
command: "sudo service nginx reload"
This also had no effect.
I have seen this question and the above-referenced question, as well as this one. However, they all seem either outdated or non-applicable to an Amazon Linux 2 instance, since none of them mention the .platform
directory from the above-referenced elastic beanstalk documentation. In any case, none of their answers have worked for me thus far. So, what am I missing?
I has a similar issue when moving to Amazon Linux 2.
Simply creating a file at .platform/nginx/conf.d/
called proxy.conf
with the content below was enough for me.
client_max_body_size 50M;
If you go digging around the main config for nginx you'll see how this file is included into the middle of the file so there's no need to have it wrapped with http.
This is similar to adam tropp's answer, but it follows the example given by AWS
Below worked for me:
~/my-app/
|-- web.jar
|-- Procfile
|-- readme.md
|-- .ebextensions/
| |-- options.config # Option settings
| `-- cloudwatch.config # Other .ebextensions sections, for example files and container commands
`-- .platform/
|-- nginx/ # Proxy configuration
| |-- nginx.conf
| `-- conf.d/
| `-- custom.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