Development environment: CentOS + Nginx + PHP + MySql + phpmyadmin
In the use of phpMyAdmin SQL database import, often need to upload large SQL data files, and at this time will often encounter Nginx error: 413 Request Entity Too Large.
To solve this problem, depending on the size of the uploaded data file, you need to adjust the parameter configuration in two locations:
1, php default upload file size limit of 2M, if more than 2M you need to modify the PHP configuration file php.ini inside the parameters
Post_max_size = 8M (the maximum limit for form submissions, which is not to limit the size of an uploaded individual file, but to limit the data submitted by the entire form). )
Upload_max_filesiz e = 2M (maximum limit of individual files uploaded)
Need to guarantee post_max_size >= Upload_max_filesize, namely the former is not less than the latter.
Be sure to restart PHP-FPM after the modification.
2. In addition to modifying the PHP configuration, you also need to modify the Nginx configuration file nginx.conf
Open the Nginx profile nginx.conf, locate the http{} segment and add one row of configuration to it:
Client_max_body_size 8m;
8m can be uploaded according to the size of the file itself set.
Be sure to reload the Nginx (service Nginx Reload) after the modification.