WordPress/Nginx issue with Fileupload

I recently encountered a strange issue within the combination of Nginx and WordPress. I worte an article, and uploaded a bunch of images for this purpose. Most images uploaded fine, but a few threw http-errors. My php.ini had a lot higher limit and on the filesystem there was space. The only thing the images which did not upload had in common were, that they are rotated by 90 degrees. I have taken the images with my cellphone, and i knew that some phones put EXIF-tags that say „rotated by 90 degrees clockwise“ instead of actually transforming it.

But this was not the issue. As i took a closer look, I saw that the rotated images had a different filesize. Even though they all had the same resolution (~8mp) the landscape images were about half in size the portrait ones were. Very strange…

And this is exactly where a Limit is beeing hit. But at first i grepped some logs, which had shown a more detailed view on this:

A search for this offered, that there is a limit of 1MB default active in Nginx for files uploaded via POST-request. You might miss that, because (at least on debian & ubuntu  so far i have seen) this is by default not in the nginx-config somewhere, so the default of 1MB is active.

Luckily you can just add this to your Nginx conf; either to /etc/nginx/nginx.conf or to a site-conf if not needed globally, but the following statement has to be somewhere inside the http{ } block:

after restarting nginx everything worked like a charm. It took me some time to figure out where the actual problem was, I hope you will save some time then.

-zeus

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert