cloudpanel-io / cloudpanel-ce

1.27k stars 106 forks source link

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

Closed peixotorms closed 3 months ago

peixotorms commented 3 months ago

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

cloudpanel-io commented 3 months ago

Thanks for letting us know, we will put it on our internal list.