Reputation: 45
So,I am using Django for my backend application deployed on AWS Elastic Beanstalk (EC2 t2.micro, Amazon Linux 2). When I am trying to submit files (.mp4, pdf) that are obviously larger than 1MB, I get Nginx Error 413: Entity too large. The problem is that everything I have tried works for a few hours, before everything is getting reset to the default configurations. As far as I understood there is an auto-scaling functionality that resets everything after each new deploy and sometimes even without deploy.I know that a lot of people had faced this kind of problem, and for some of them actions described in other posts solved the problem. However, for me everything resets either immediately after deploy, or in a couple of hours.
I have already tried, as suggested in other posts on Stackoverflow, changing the nginx file from the EC2 console, adding my own configuration file in source code (.ebextensions folder), applied some changes to my S3 bucket, and many other options. ***NOTE: I have also created a custom function for handling large files in Django itself, but I think it is irrelevant to the Nginx error that I get.
My .ebextensions directory:
--.ebextenstions
--nginx
--conf.d
--proxy.conf
--02_files.config
Content of the proxy.conf:
client_max_body_size 100M;
Content of 02_files.config: `files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 100M;`
Thanks.
Upvotes: 2
Views: 1650
Reputation: 1
You are right. Both of these folders are required for current Amazon Linux 2023
my_django/
|--.ebextentions/
| |--project.config
|
|.platform/
|--nginx/
|--conf.d/
|--your_config.conf
Upvotes: 0
Reputation: 239005
For Amazon Linux 2
you have to use .platform
, not .ebextentions
. So create a file, e.g. myconfig.conf
(.platform/nginx/conf.d/myconfig.conf
) with content of:
client_max_body_size 100M;
Upvotes: 4