Still receiving 413 Request Entity Too Large even after client_max_body_size 100M

I use Rails and Nginx in the digital ocean, and I try to download a 17.6 MB file, and I still get 413 Request Entity Too Large even after setting client_max_body_size 100M in my /etc/nginx/nginx.conf file.

Here is a snippet from the file:

 http { ## # Basic Settings ## client_max_body_size 100M; sendfile on; tcp_nopush on; ... } 

After setting this parameter, I used sudo service nginx reload . When this did not work, I even performed a complete reboot using sudo shutdown -r now , and then cap production puma:start from my local machine. I also tried client_max_body_size 0; , which, as I understand it, should completely disable file size checking. Nothing works. Plus, I made some errors in the location of the client_max_body_size operator, and in cases where the server could not start to throw the error "Something went wrong", so I'm sure that the changes that I make are in the correct file .

Is there anything I can lose? Is there any other place that I am missing to set this up? Is there something that I am missing in the way I configure it? Any pointers would be greatly appreciated.

+6
source share
1 answer

Good. I get it. Following the Digital Ocean tutorial on how to configure nginx , I set client_max_body_size 100M in /etc/nginx/nginx.conf . And for sure, the changes that definitely influenced what the server did. Especially when I messed up something in this file and the server stops working.

However, I forgot that in Deploying a Rails application on Ubuntu 14.04 with Capistrano, Nginx, and Puma , which was my main resource for tuning, my server shows that these settings are not configured in the nginx.conf above, but in my rails application there is a file ~/my_app/config/nginx.conf , into which the settings already included the statement

  client_max_body_size 10M; 

So I changed this statement as well as in the /etc/nginx/nginx.conf file when I created it. Voila! Now I can upload files up to 100M.

+12
source

All Articles