Fixed [HTTP Error] client intended to send too large body [Media Upload WordPress]

"HTTP Error”Is a common error among users of WordPress using the classic upload method photos, documents, and other files.
Every time we encounter an SQL, HTTP error, it's a good idea to check the logs on the server. They can give us more information about the error message displayed in the browser.

Here is an example of an “HTTP error”In the browser when trying to upload a .PDF file:

The same error in server logs looks altogether different. Much more detailed and easy to move the solution to the problem. Depending on the configuration of the web server and HTTP services / HTTPS, the file containing error data can be of the form: error.log, error_log, domain-name.error.log, etc.

 2019/06/10 12:58:14 [error] 25084#25084: *22825511 client intended to send too large body: 1143385 bytes, client: 84.XX.XX.XX, server:, request: "POST /wp-admin/async-upload.php HTTP/1.1", host: "", referrer: "" 

The above error tells us that the file we want to climb on the server is higher than the allowed server limit per upload session. This limit is routed to the general configuration file NGINX (nginx.conf) or in the custom NGINX config file of the domain that we encountered.
“HTTP error"Appears most often when we have a file with large MB volume or we do upload simultaneously to multiple files.

How to resolve the error "client intended to send too large body - HTTP error"

The easiest way is to edit the file "nginx.conf”And establish a directive to change the upload limit allowed per session. In our case we set the limit of 10 MB per body of upload files.

 client_max_body_size 10M;

The above directive will be added to the http (server / location) section.

We are saving the file "nginx.conf”Edited with“ vi ”or“ nano ”, then test the nginx configuration.

nginx -t

 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /etc/nginx/nginx.conf test is successful

We restart the nginx service:

 service nginx restart


 systemctl restart nginx

After these steps, resume the upload process. Everything should go smoothly and the error "HTTP error" to disappear.

Very many users WordPress blogs / sites hosted on NGINX servers have been facing this limitation lately. Most likely this limitation comes with the new security features introduced in the latest version of NGINX.

Passionate about technology, I enjoy writing on since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » Linux » Fixed [HTTP Error] client intended to send too large body [Media Upload WordPress]
Leave a Comment