I have an application that can accept file uploads and puts those onto S3. Some files have been failing to upload when going through the nginx reverse-proxy.
Now, I have keepalive_timeout 120; set in the nginx.conf as well as
set on my application's sites-available/ sites-enabled configurations.
Optimize nginx for uploading/download huge files. To limit disk I/O for big requests/responses there are following options available. For responses you may also completely disable disk buffering using 'proxy_max_temp_file_size 0'. This implies that nginx won't be able to read full response from a backend though.
Nginx Limit Bandwidth
Even after restarting nginx this issue reoccurs. Relevant error.log message:
The thing is, I don't think this is actually a timeout issue. Uploading a file takes around 8 seconds total to upload without going through the proxy. Using the proxy will have the file hang for a minute or two and then errors out.
How can you limit download speed using Rails or Nginx. Take a look at nginx documentation for limit_rate. There is also a limit_rate_after directive that is useful to set this limit only after download exceeds certain size. Share| improve this answer. Answered Nov 17 '10 at 15:25. Scoffey scoffey.
In nginx, add the following line to your nginx.conf file: client_max_body_size 2G; for a 2gb file limit. Larger than that, and you might run into other issues (ie, like your local filesystem having problems with big files, memory spikes for processing, etc).
90% of files uploaded into the application are PDF's, all of them underneath the body size limit.