I have been trying to increase the client_max_body_size for the provided Nginx server in my Java 11 Beanstalk deployment without success.
So far I have tried the AWS Developer Guide method, this approach in GitHub using a hook, as well as every posted solution I found in this StackOverflow question using different configurations in the .ebextenstions.
The errors I have faced are different depending on the approach I take, from the app not being deployed at all because of errors in the Nginx configuration to the app being deployed successfully but not taking the new file size limit into account. These are some of the bundle structures I have tried:
Bundle 1
myBundle.zip
--myApplication.jar
--Procfile
--.ebextensions
----nginx
------conf.d
--------proxy.conf
proxy.conf
client_max_body_size 50M;
Bundle 2
myBundle.zip
--myApplication.jar
--Procfile
--.ebextensions
----myconf.config
myconf.config
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 50M;
container_commands:
01_reload_nginx:
command: "sudo service nginx reload"
Bundle 3
myBundle.zip
--myApplication.jar
--Procfile
--.ebextensions
----myhookconfig.config
myhookconfig.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/enact/12_add_nginx_configuration.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
/bin/echo "client_max_body_size 50M;" > /etc/nginx/conf.d/proxy.conf
/sbin/service nginx reload
I presume this may have something to do with the EB Java 11 platform in specific. Have you guys accomplished to change this configuration in EB with Java 11? Thanks!
Here is the solution that worked for me. My mistake is that I was using the configuration for the preceding Amazon Linux 2 platforms. As Vaquar Khan mentions, the link with the correct configuration is this. The section Reverse Proxy Configuration is what I was looking for.
Here is the configuration that increased the NGINX request max body size:
myBundle.zip
--myApplication.jar
--Procfile
--.platform
----nginx
------conf.d
--------myConf.conf
myConf.conf:
client_max_body_size 50M;
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