This Is Your Brain On Informatics: NGINX and Large Files

From Pathology Education Instructional Resource
Revision as of 02:28, 19 March 2014 by Tikenn (talk | contribs)
Jump to: navigation, search

Need-to-know NGINX Parameters for Large Files

Size Parameters

  • client_max_body_size

If you've done the setup as in the blog, this parameter should be located in

/etc/nginx/nginx.conf

This parameter controls the size of a file that is allowed to be passed through NGINX. If a file that is passed to the server is too large, an error of 413 (or something similar will result). The way to fix that is to change the size of the file that is allowed to be passed to a larger number. The letter following that number will determine the units where the default (no letter) is bytes, k is kilobytes, and m is megabytes (you should not be passing gigabytes to your poor overworked server).

Server Timing Parameters

  • client_header_timeout
  • client_body_timeout
  • keepalive_timeout
  • send_timeout


These parameters should be in the same file as the size parameters.

/etc/nginx/nginx.conf

Each one of these modifies how long NGINX will deal with part of the process for uploading a file. Suffice it to say, that if your file upload is somehow timing out (resulting in a 504 gateway timeout error or a 502 general gateway error), these parameters need to be increased in order to allow the file to finish uploading.

FastCGI Parameters

  • fastcgi_read_timeout


This parameter will only work with something that is using FastCGI (like PHP, or another language). It is what allows CGI to keep processing the uploaded file. Again, if the uploaded file is timing out. This parameter needs to be increased.