Cosaic
Cosaic

Reputation: 547

Amazon Elastic Beanstalk ebextension adds nginx config parameter into default config

I'm deploying my app using a zip file which contains my app jar, docker config file and a .ebextensions folder which includes a nginx/conf.d/custom.config file.

In my custom.config, there is only one line to increase nginx upload file size limit:

client_max_body_size: 16M

But the console displays:

Error processing file (Skipping): '.ebextensions/nginx/conf.d/custom.config' - Contains invalid key: 'client_max_body_size'. For information about valid keys, see http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

The guide that I followed to extends the default nginx setting. Quote:

To extend Elastic Beanstalk's default nginx configuration, add .conf configuration files to a folder named .ebextensions/nginx/conf.d/ in your application source bundle. Elastic Beanstalk's nginx configuration includes .conf files in this folder automatically.

I changed .conf to .config because the first one does not even trigger ELB environment updating during deployment.

Upvotes: 0

Views: 2684

Answers (3)

Muhammad Umair Raza
Muhammad Umair Raza

Reputation: 362

I have tried all .ebextensions method of adding implementation level configuration and it didn't help me in the latest Amazon Linux AMI. for the latest Amazon Linux AMI, You need to follow this structure to increase the upload size. You need to follow this structure to increase the upload size limit.

Add the below folder setup in the root level of your project folder.

Folder structure (.platform/nginx/conf.d/proxy.conf)

.platform/
         nginx/
              conf.d/
                    proxy.conf

Add this line to proxy.conf (Inside .platform/nginx/conf.d/ folder)

client_max_body_size 50M;

commit this file and deploy again using eb deploy.

Upvotes: 2

Cosaic
Cosaic

Reputation: 547

I managed to make it work by adding a beanstalk config file .ebextensions/add_nginx_config.config which copies my custom-nginx.conf file to the conf.d folder of the ec2 instance.

add_nginx_config.config:

container_commands:
  copy:
    command: "cp nginx-custom.conf /etc/nginx/conf.d/"

So my app resource bundle tree looks like this:

app.zip
|-application.yml
|-app.jar
|-nginx-custom.conf
|-.ebextensions
  |-add_nginx_config.config

Upvotes: 0

Derek
Derek

Reputation: 749

I think Elastic Beanstalk is trying to process custom.config as an EB configuration file. Try moving custom.config to .ebextensions/nginx/custom.conf (note the change in file extension)

Upvotes: 0

Related Questions