skip to Main Content

I need to increase the max body size for my Spring Boot application. I know that I need to include a .conf file in my project, but the solutions for older AMI’s (Linux 1/Linux 2) found here are not working.

I am deploying my project as a fat .jar built with Maven.

I have tried including a configuration file with this content:

client_max_body_size 2000M;

In this directory at the root of my project:

.platformnginxconf.d

The config file is not displayed when I run this command in my ssh instance: sudo nginx -T

2

Answers


  1. Chosen as BEST ANSWER

    I was able to make the configuration change by including the .conf file in the upload outside of my .jar when uploading the project files. I found that if removed the .platform directory from my project, created a .zip file with both the .platform directory and the .jar, and uploaded that .zip file as the application, Elastic Beanstalk will add the make the configuration file to all NGINX instances automatically.

    Important Note: Placing the .platform directory and the .jar file in a parent directory/folder and zipping the parent will not work. You must individually select the files.


  2. You need to configure a valid block, you cannot specify the client_max_body_size directive without placing it inside an appropriate block like http, server, or location. NGINX configuration files are structured in hierarchical blocks, and directives must be placed inside those blocks to be valid.

    Something like this :

    http {
        server {
            listen 80;
            server_name example.com;
    
            client_max_body_size 2000M;
    
            location / {
                root /var/www/html;
            }
        }
    }
    

    Or you can replace the principal config with your custom changes .platform/nginx/nginx.conf and you need to pull beanstalk configuration by adding :

     include conf.d/elasticbeanstalk/*.conf;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search