Wordpress on Nginx upload size limit

Written by
Date: 2015-03-08 19:00:00 00:00

How to increase upload file size limit for Wordpress running on PHP-FPM and Nginx

I am running some Wordpress blogs on Ubuntu LTS server, with Nginx and PHP-FPM, it is really fast and using Nginx caching capabilities incredible scalable.

I had some problems uploading big theme files, so I had to adjust the configurations a little bit, here are some tips for future references in case I may need to check it out again later, or if anyone need to do the same I did.

There are two places where you need make some changes in order to increase the upload size limit.

Nginx

Let's check Nginx first, there was my problem, so adding this line to the http block of your Nginx configuration, will solve the problem.

client_max_body_size 20m;

That line inside the http block will make Nginx to accept files up to 20 Megabytes, that is enough for me, you may want to adjust to your own needs.

PHP-FPM

If the problem is not on Nginx side, PHP may be the culprit, so edit the file /etc/php5/fpm/php.ini and be sure to have these lines.

upload_max_filesize = 20M
post_max_size = 20M

It is almost sure you will find them, so just edit them to meet your needs.

Now you have a Wordpress installation running on PHP-FPM and Nginx with an appropriate upload file size limit