Limit on the maximum size of uploaded files
In this guide, which I will use as a reminder in the future, I want to insert all the methods I know to increase the maximum file size uploaded to WordPress, in the Nginx + PHP5-FPM environment.
Index:
- Edit the PHP5-FPM configuration file
- Edit the Nginx configuration file
- Edit the WordPress configuration file
- Change the settings in WordPress Multisite
The first thing to do is to check the PHP configuration file.
Edit the PHP5-FPM configuration file
The PHP configuration file is called php.ini and you can usually find it here /etc/php5/fpm/php.ini.
Make sure the options listed below are without comments in your configuration file. Increase the values if necessary.
Edit the Nginx configuration file
Now you need to set up Nginx and you have two possibilities to do it: edit the single site configuration file, the Server Block – Virtual Hosts (/etc/nginx/sites-available/example.com) or edit the Nginx configuration file (/ etc / nginx / nginx.conf) According to CTN News. The first choice will have an impact only on the single site, while the second will modify all the sites hosted on the web server.
The client_max_body_size 128m parameter; you have to enter it globally.
Local option: single site
Global option: all sites
Edit the WordPress configuration file
The WordPress configuration file is located in the root and is called wp-config.php. Add the following line to this file.
Change the settings in WordPress Multisite
If your site runs in a WordPress multisite installation, the administrator can define not only the space available to you but also the maximum file size that you can upload.
The option to change is found in the file: ../wp-admin/network/settings.php.
In English: Network Admin Dashboard >> Settings, look for the Upload Settings option.
In Italian you can find it under: Settings >> Network settings >> File upload settings.
Increase the size of uploaded files on WordPress Multisite
Restart the web server
Now you need to restart the web server to load the new settings. Open the terminal and type:At this point you will be able to upload files of the size you have set.