Nginx Upload File size

Source: Internet
Author: User
Tags temporary file storage

Using Nginx as a reverse proxy, there is a strange problem, small files can be submitted, large files will be reported 500 internal error. What is the cause of this?

The wiki shows that there are three configurations associated with the upload file size

Client_body_buffer_size configuration request body buffer size, not worthy of words,

Client_body_temp_path set the temporary file storage path. Only when the requested body of the upload exceeds the buffer size will it be written to the temporary file

Client_max_body_size setting the maximum value of the uploaded file


So to find out, the problem arises because

1. File size exceeds Client_body_buffer_size

2.client_body_temp_path temporary file path does not have write permission

The two reasons above cause a 500 error to be returned.

If the upload file size exceeds client_max_body_size, the 413 entity too large error is reported.


The reason is known, the correction is simple.

1.client_body_buffer_size try to set the large point, which is based on the speed of consideration, if because the settings are too small, resulting in the upload of the file old to write disk, that speed is too slow.

2.client_body_temp_path path to have writable permission, this is a clear error. Just fix it, okay?

3.client_max_body_size set the maximum value of the uploaded file, this is based on security considerations, we believe that normal users will not or basically not upload too large files.

Can be set to client_max_body_size 100m; or set this value according to your own business.

Nginx Upload File size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.