WordPress change the upload limit(Nginx)

I recently adjusted a lot of contents and settings of the blog, and found that the previous upload file size setting has been reset to 2M, so I write this article to record how to modify this limit.

First of all, we need to make sure if it the php.ini in the server that limits it, execute:

php -i | grep 'php.ini'

and terminal says:

Loaded Configuration File => /etc/php/7.2/cli/php.ini

where your php.ini locates.

Then open it using your preferred editor, change or add the following contents:

upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300

save and restart services:

service php-fpm restart
service nginx reload

Then it should be possible now to change the upload limit in WordPress. There are several ways to do that, and I chose the “simplest” way: adding an addon to change it.
There are also some other ways to realize, e.g., changing function.php or .htcaccess, I will not repeat them here.

translated 2021-09-26

Leave a Reply