Resolving HTTP Error WordPress on Nginx

It turns out that if long did not run into problems can (few) forget what the solution. This morning I was troubleshooting a problem uploading images in WordPress, instead of success but appeared HTTP Error. The problem is that the solution on the internet averages the Apache assumption, which I use is Nginx.

Resolving HTTP Error WordPress on Nginx
Resolving HTTP Error WordPress on Nginx

Because I check the Nginx error log is clean or has nothing to do with the current problem and check the error log PHP-FPM itself is also not enlightening. Fortunately, when trying an alternative method to upload media files in WordPress (which is without JavaScript) instead appears an error message 413 Request Entity Too Large. I was happy immediately because at least what causes. The file size is too big, but the picture is only 2 MB.

So the solution is easy once we increase the maximum size limit that can be uploaded to Nginx:

nano /etc/nginx/nginx.conf

Then edit:

client_max_body_size 20m;

I model a ride so 20MB.

After that restart Nginx:

service nginx restart

If still problematic means the cause exists in PHP-FPM. We first modify its configuration:

nano /etc/php.ini

And edit the two settings below:

upload_max_filesize = 20M
post_max_size = 20M

So we increase the file size limit to 20MB.

Same with Nginx earlier, do not forget to restart PHP-FPM:

service php-fpm restart

Done

Tags: