Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

client intended to send too large body EB Nginx

I'm trying to increase the size of uploadable files to the server. However it seems there's a cap that prevents anything over 1MB of being uploaded.

I've read a lot of answers and none have worked for me.

I've done everything in this question Stackoverflow question

I did everything here as well. AWS resource

Here's what I have as the full error

2021/01/15 05:08:35 [error] 24140#0: *150 client intended to send too large body: 2695262 bytes, client: [ip-address-removed], server: , request: "PATCH /user HTTP/1.1", host: "host.domain.com", referrer: "host.domain.com"

I've made a file in this directory (which is at the root of my source code)

.ebextensions/nginx/conf.d/myconf.conf

In it I have

client_max_body_size 40M;

I know that EB is acknowledging it because if there's an error it won't deploy it. Other than that I have no idea what to do

Does anybody know what might be the issue here?

Edit: backend is nodejs v12

Edit: Also tried this inside of a .conf file in .ebextensions

files:
    "/etc/nginx/conf.d/myconf.conf":
        mode: "000755"
        owner: root
        group: root
        content: |
          client_max_body_size 20M;
like image 660
Trevor Wood Avatar asked Oct 20 '25 14:10

Trevor Wood


1 Answers

Update:

Beanstalk on Amazon Linux 2 AMI has a little different path for NGINX config extensions:

.platform/nginx/conf.d

There you can place NGINX config extension files with *.conf extension, for example:

.platform/nginx/conf.d/upload_size.conf:

client_max_body_size 20M;

Documentation for this is here.

Original answer:

Nginx normally does not read config from where is serves the content. By default all config nginx read is /etc/nginx/nginx.conf and this file includes other files from /etc/nginx/conf.d/ with *.conf extension.

You need to place client_max_body_size 40M; there.

like image 118
anemyte Avatar answered Oct 22 '25 03:10

anemyte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!