Trying to set file upload limit in mup/nginx-proxy

2.1k views Asked by At

I am running into a file upload error with files > 10M. I have followed the advice here: http://meteor-up.com/docs.html#advanced-configuration which says how to set it in the nginx proxy by setting the clientUploadLimit: '50M'

I pushed the changes using mup proxy reconfig-shared, and it told me it had restarted the proxy. It didn't work, I still get the 413 (Request Entity Too Large) error.

I checked inside the nginx-proxy docker instance, and the file /etc/nginx/conf.d/my_proxy.conf has the correct entry client_max_body_size 50M. I restarted the EC2 box to make sure, but it's still not working.

This article https://www.tecmint.com/limit-file-upload-size-in-nginx/ suggests that the setting needs to go inside a http block, like this:

By default, Nginx has a limit of 1MB on file uploads. To set file upload size, you can use the client_max_body_size directive, which is part of Nginx’s ngx_http_core_module module. This directive can be set in the http, server or location context.

http {
    client_max_body_size 100M;
}

I can't see how to achieve this, as the .conf file is read only and somehow locked.

Any ideas on how to proceed?

I suppose I could try a custom nginx.conf file, but I'm not sure what should go in there, and in fact whether it will even improve the situation.

Any help is appreciated :)

2

There are 2 answers

0
Mikkel On BEST ANSWER

I'm happy to report that I solved it... I will explain how.

I was setting the limit in the nginx reverse proxy in the mup.js file

  proxy: {
    domains: 'website.com,www.website.com',
    shared: { clientUploadLimit: '50M' }
  }

But it turns out that there is an option to set it for each independent server like this:

  proxy: {
    domains: 'website.com,www.website.com',
    clientUploadLimit: '50M'
  }

The limit was being set to 10M by default. I found it by shelling into the nginx-proxy docker image and doing a search with the command grep -R client_max_body_size /etc/nginx and it showed me all the places where it was set (for each vhost)

So I changed the mup.js file for my server, did a mup stop, and a mup setup (to re-do the settings) and then a mup deploy

2
Toys0125 On

Now this is speculation but have you tried going to the docker container's root shell changed the permissions to give write permission to root or your user chmod 760 /etc/nginx/nginx.conf and edit the nginx file there?