简体   繁体   中英

client_max_body_size is in Nginx conf but seems to be getting ignored

I'm running into status code 413 Request Entity Too Large . I'm running an Amazon Linux 2 AMI instance on AWS's Elastic Beanstalk, which is running an express server with a post route that uploads files to an S3 Bucket and then both adds some data to a table and produces a kafka message. Everything is working properly with files below 1MB size.

I understand nginx's default max-size value is 1MB and that I must change it.

I tried every answer in this thread Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk but despite getting the client_max_body_size 10M; inside the nginx.conf file, and restarting nginx everytime I changed a configuration, using nginx -t to see if anything was wrong with the syntax, resulting in everything being ok , and finally proving via this command that the client_max_body_size 10M; line was in fact there, when it accused of there being a duplicate of it inside the file, all of these configs seemed to be completely ignored by my micro-service whenever I try to post a file greater than 1MB.

I don't have much ideas on where to proceed from here. Any tips?

The link you are giving is for Amazon Linux 1 (AL1). These days all EB platform are based on AL2, and nginx is set differently . Namely, you should create .platform/nginx/conf.d/myconfig.conf file in the root of your application, with the content of:

client_max_body_size 10M;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM