Report this

What is the reason for this report?

How to edit Nginx setting for big file upload

Posted on December 18, 2017

Hello,

I want to upload a big file (~600MB) from a local app to my server app which takes more than 10 minutes. However it seems that after 10 minutes - my connection get closed. What settings I should change on my server and how?

Server is using Nginx and Meteor.js (Node.js)



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Great answer by @moisey!

Another thing to point out is that, this setting of “client_max_body_size” does not come included by default in the http section of the nginx.conf file. You have to add it manually in order to increase the setting to whatever number you need.

If the file is too large you may be running into nginx’s client_max_body_size which if exceed should return a 413 error, though some browsers don’t support actually reporting that error correctly.

You would want to increase this to a larger limit or set it to 0 in which case there will be no limits.

http {
    # [...]
    client_max_body_size 100m;
    # [...]
}

If that doesn’t fix it you will want to tail your error logs for both nginx and meteor to see if you are getting something more specific and then provide that in your question as there maybe other factors at play.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.