Trevor
Trevor

Reputation: 2457

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;

Upvotes: 4

Views: 4721

Answers (1)

anemyte
anemyte

Reputation: 20226

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.

Upvotes: 11

Related Questions