Nginx (client_max_body_size) Error 413 – Request Entity Too Large. #214

Closed
opened 2026-04-05 20:25:58 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @peixotorms on 7/8/2024

CloudPanel version(s) affected

2.4.2

Description

Just a quick note, but there is an issue on Nginx related to the file uploads.
client_max_body_size on nginx, needs to match with the php upload settings, else when we upload a larger file, it will trigger an HTTP error 413 – Request Entity Too Large.

How to reproduce

Install a WordPress site.
Adjust the PHP Settings on the GUI to use 128 MB or more.
Try to upload a PDF file with more than 64 Mb via the media upload on wp-admin.
It triggers a 413 error: https://share.raisercdn.com/raul/DEpIvOYe37.png

Possible Solution

Always match the Nginx client_max_body_size option on the vhost config location block for PHP, to match the PHP setting,
ie: client_max_body_size 128M;

Note that it needs it both in the initial http request and also in the reverse proxy.

Additional Context

No response

*Originally created by @peixotorms on 7/8/2024* ### CloudPanel version(s) affected 2.4.2 ### Description Just a quick note, but there is an issue on Nginx related to the file uploads. client_max_body_size on nginx, needs to match with the php upload settings, else when we upload a larger file, it will trigger an HTTP error 413 – Request Entity Too Large. ### How to reproduce Install a WordPress site. Adjust the PHP Settings on the GUI to use 128 MB or more. Try to upload a PDF file with more than 64 Mb via the media upload on wp-admin. It triggers a 413 error: https://share.raisercdn.com/raul/DEpIvOYe37.png ### Possible Solution Always match the Nginx client_max_body_size option on the vhost config location block for PHP, to match the PHP setting, ie: `client_max_body_size 128M;` Note that it needs it both in the initial http request and also in the reverse proxy. ### Additional Context _No response_
Sign in to join this conversation.