Raise WordPress upload limits and prevent false-positive upload 403s#33
Conversation
There was a problem hiding this comment.
Pull request overview
Raises WordPress upload limits end-to-end by aligning PHP-FPM per-directory upload caps with the (per-route) Nginx request body limits, addressing 413s and PHP’s default 2M upload ceiling.
Changes:
- Add PHP-FPM per-directory overrides via a new
var/www/html/.user.ini. - Set
upload_max_filesize/post_max_sizeto support larger plugin and media uploads.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
|
@copilot - this solution will not solve the 403 error. The user upload limits is 120M already. This is not a solution |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
Updated in |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
| upload_max_filesize = 95M | ||
| post_max_size = 100M |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Max Barrett <34328348+MaximillianGroup@users.noreply.github.com>
| upload_max_filesize = 95M | ||
| post_max_size = 100M |
Uploading large plugins (e.g. Gutenberg at ~35 MB) returned
413 Request Entity Too Largefrom nginx because/wp-admin/update.phpinherited the global10mdefault. PHP-FPM'supload_max_filesizedefaulted to2M, silently blocking media uploads that nginx would otherwise pass. Upload handlers were also returning403in some valid cases due to$block_reasonUA/geo checks.nginx (
nginx/snippets/spx-upload-limits.conf)Per-route
client_max_body_sizeoverrides, included by the HTTPS vhost:/wp-admin/update.php64m— plugin/theme ZIPs/wp-admin/async-upload.php100m— media library uploader/wp-json/wp/v2/media100m— REST API media endpointAll values stay at or below Cloudflare's 100 MB per-request cap. Global default remains
10m.Upload routes now bypass soft UA/geo
$block_reasonfalse-positive checks but still enforce hard malicious-signature blocks via$hard_block_reason(fromnginx/conf.d/spx-bot-mitigation-logic.conf). Method restrictions and rate limiting remain in place, and upload authorization is still enforced by WordPress.PHP-FPM (
var/www/html/.user.ini) — new filePHP-FPM scans
.user.inifrom the document root for every request.upload_max_filesize/post_max_sizearePHP_INI_PERDIRand cannot be set viaini_set()at runtime.Direct web access is blocked by perimeter dotfile deny rules.