Set nginx + php to upload large files

Source: Internet
Author: User
Tags form post

Set nginx + php to upload large files

1. To allow php to upload large files, modify the configuration file php. ini as follows:

File_uploads = on; // whether to allow file upload over HTTP. The default value is ONupload_tmp_dir; // The file is uploaded to the temporary directory of the server. upload_max_filesize = 2 m; // maximum size of the file to be uploaded: post_max_size = 8 m; // The maximum size that can be received by a form POST to PHP, including all values in the form. Max_execution_time = 600; // maximum time (in seconds) for running each PHP page. max_input_time = 600 by default; // The maximum time required for receiving data on each PHP page, the default value is 60 seconds for memory_limit = 8 m; // The maximum memory consumed by each PHP page. The previous mechanism is generally 8 M by default, and is usually 128 m.

2. After the php configuration is complete, nginx still cannot upload large files without the corresponding configuration.

413 Request Entity Too Large

You need to enable nginx. conf and add the following parameters in the http {} Configuration:

Client_max_body_size 50 m; // a maximum of 50 m files can be uploaded.

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.