[to] solve the problem of nginx+php uploading large files by setting Nginx Client_max_body_size

Source: Internet
Author: User

Tag: Will webserver TMP detail memory Specify system default large file

Ext.: http://blog.csdn.net/zhengwish/article/details/51602059

By setting Nginx client_max_body_size resolution nginx+php upload large files problem:  
use Nginx to do webserver, you need to pay special attention when uploading large files Client_max_body _size This parameter, otherwise it will break in Nginx request, in PHP is not logged to access.  
General upload large file flow:  
First modify php.ini file:  
Parameter setting description  
File_uploads on whether to allow the switch to upload files over HTTP. The default is on  
upload_tmp_dir– file is uploaded to the server where temporary files are stored, if not specified, the system default temporary folder  
upload_max_filesize 8m business, That is, the maximum size allowed for uploading files. The default is 2m 
Post_max_size 8m refers to the maximum value that can be received by the form Post to PHP, including all values in the form. The default is 8m 
Description  
In general, after the above four parameters are set, in the network normal situation, uploading <=8m files is not a problem  
But if you want to upload large files >8m, It is not necessarily possible to set the above four items. Unless your network really has a 100m/s upload speed, you still have to set the following parameters.  
Max_execution_time 600 maximum time value per PHP page (in seconds), default 30 seconds  
Max_input_time 600 maximum time per PHP page to receive data, default 60 seconds  
Memory_limit 8m per php page to eat the maximum memory, default 8m 

But still not, because the webserver with Nginx, Google a bit, Found in Nginx conf added a parameter:  
Default is 1M, need to increase.  
Add a   in the nginx.conf;
Client_max_body_size 30m; 
Restart  
30m indicates the maximum upload 30M and how large the setting will be.

[go] solve nginx+php uploading large files by setting Nginx client_max_body_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.