How to Fix: The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.
So you have installed WordPress and you are ready to start uploading images.
In the WordPress Dashboard, you click on the Media Entry in the Menu and get the following on your browser.
NOTE: By default WordPress sets a Maximum upload file size: 2 MB or Maximum Image File Size of 2MB ).
Actually this Maximum upload file size is determined by a PHP Setting on the server. ( See How to Increase the Maximum upload file size )
So you Click on Select Files or Drag and Drop an image which is just smaller than 2MB ( and bigger than 1MB which is a clue for later) and BOOM, you get an error message like the following.
The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.
So that’s annoying! But hang on, our image is under the Maximum File Size of 2MB so what is going on?
If we attempt to upload an image that is larger than the specified Maximum File Size of 2MB, we get the expected error message of
If we attempt to upload an image that is 1.3MB, we get the unexpected error message
So What is happening?
This situation occurs when you are using NGINX as your webserver.
When you attempt to upload an image that is larger than 1MB and smaller than the Maximum upload file size: 2 MB, the server will respond with the Server Error message of:
413 Request Entity Too Large
The reason is, NGINX has a file upload size setting. By Default this setting is 1M ( That’s 1 Megabyte or 1024 bytes ). As a result, the NGINX Server returns a 413 Server Error and that results in the Server Error message.
What is the FIX?
There is a setting in NGINX called client_max_body_size.
To Apply this globally across all sites
To apply this to all sites, in the file /etc/nginx/nginx.conf, you will need to add client_max_body_size 2M; inside the http section.
# Default is 1M
To Apply this on a Per Website/Domain
If you are using virtual hosts. I.E you have configured individual sites by adding configuration files in /etc/nginx/sites-available/. For Example: your-domain.conf, you will need to add client_max_body_size 2M; inside the server section.
# Default is 1M
Check Changes made to NGINX Conf files are OK!
When you make changes to any configuration files it is a good idea just to check they are ok.
This can be done with the command sudo nginx -t.
oska@oska-VirtualBox:/var/www/wordpress-dev$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart the Server
And as always, if you make any changes to your webserver, you will need to restart it.
$ sudo systemctl restart nginx
How to Increase the Image Upload File Size.
In the Case where you want to upload larger files see – WordPress – How to change the Maximum Upload File Size
This is running on a Virtual Box running Mint Linux and NGINX with PHP 7.4.
The operating system has no impact on this and is just mentioned for reference only.
oska@oska-VirtualBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description: Linux Mint 20.3
This is the Culprit/Cause of this issue. Not sure if the versions are important but you’d expect this has been a setting since the early days.
oska@oska-VirtualBox:~$ nginx -v
nginx version: nginx/1.23.0