diff --git a/.env.nginx.example b/.env.nginx.example index 7ed23d0..122f5bb 100644 --- a/.env.nginx.example +++ b/.env.nginx.example @@ -11,8 +11,9 @@ # Request limits ### # Max request body size accepted by nginx. Must be >= PHP_UPLOAD_MAX_FILESIZE -# in .env.php, otherwise large uploads get truncated at the proxy. Default: 140m. -NGINX_MAX_BODY_SIZE=140m +# in .env.php and >= MEDIA_MAX_UPLOAD_SIZE_MB in .env.symfony (app cap, default +# 200 MiB), otherwise large uploads get truncated at the proxy. Default: 210m. +NGINX_MAX_BODY_SIZE=210m ### # Upstream FPM (rarely needs tuning — only useful with custom topology) diff --git a/.env.php.example b/.env.php.example index 15194b3..f524256 100644 --- a/.env.php.example +++ b/.env.php.example @@ -13,11 +13,14 @@ PHP_MAX_EXECUTION_TIME=30 # Memory cap per PHP process. Default: 128M. PHP_MEMORY_LIMIT=256M -# Total POST body size accepted by PHP. Default: 8M. Raise in lockstep with -# NGINX_MAX_BODY_SIZE. -PHP_POST_MAX_SIZE=140M -# Maximum size of an uploaded file. Default: 2M. -PHP_UPLOAD_MAX_FILESIZE=128M +# Total POST body size accepted by PHP. Default: 8M. Keep in lockstep with +# NGINX_MAX_BODY_SIZE and >= PHP_UPLOAD_MAX_FILESIZE plus multipart overhead. +PHP_POST_MAX_SIZE=210M +# Maximum size of an uploaded file. Default: 2M. The Symfony app caps media +# uploads at MEDIA_MAX_UPLOAD_SIZE_MB (.env.symfony, default 200 MiB); this +# must be >= that value, otherwise PHP rejects the upload before the app +# validator sees it. +PHP_UPLOAD_MAX_FILESIZE=200M # Default timezone. Default: Europe/Copenhagen. PHP_TIMEZONE=Europe/Copenhagen diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cc8f98..a10d4e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,10 @@ See the [v2.x.x — Skipped](#v2xx---skipped) entry below for why this major ski `logs:access`, `logs:disk`. - Global JSON-file log rotation (10MB × 3 files per service), tunable via `LOG_MAX_SIZE` / `LOG_MAX_FILE`. +- Aligned media-upload limits with the upstream 3.0.0 app cap: `.env.php.example` ships + `PHP_UPLOAD_MAX_FILESIZE=200M` / `PHP_POST_MAX_SIZE=210M` and `.env.nginx.example` ships + `NGINX_MAX_BODY_SIZE=210m`, matching the new `MEDIA_MAX_UPLOAD_SIZE_MB=200` Symfony validator + ceiling that 3.0.0 introduces. UPGRADE.md §5 explains the four-layer alignment rule. ### Local development diff --git a/UPGRADE.md b/UPGRADE.md index baf271d..1e80838 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -175,6 +175,25 @@ $EDITOR .env.mariadb task env:traefik ``` +##### Media upload size: align all three layers + +v3 adds an app-level cap on media uploads, `MEDIA_MAX_UPLOAD_SIZE_MB` (default `200`, +in MiB), enforced by the Symfony validator on `Media::$file`. Because uploads cross +nginx → PHP-FPM → Symfony, all three layers must agree, or the lowest wins (and the +operator sees a confusing 413 / `UPLOAD_ERR_INI_SIZE` instead of the app's clear +"file exceeds N MiB" error). Defaults shipped in `.env.php.example` and +`.env.nginx.example` are aligned to `200`; if you've customised any of them, keep +the inequality intact: + +```text +NGINX_MAX_BODY_SIZE >= PHP_POST_MAX_SIZE >= PHP_UPLOAD_MAX_FILESIZE >= MEDIA_MAX_UPLOAD_SIZE_MB +``` + +`task env:migrate` carries `MEDIA_MAX_UPLOAD_SIZE_MB` over from the image's bundled +`.env`, so it lands in `.env.symfony` automatically. Verify with `task env:diff` after +`env:init` — if the diff shows the key only on the image side, your migrated file +predates this var and you should copy the line over by hand. + #### 6. MariaDB 10.x → 11.4 upgrade The bundled MariaDB is `mariadb:11.4.10` in 3.x (was `mariadb:10.x` in 1.x). Three things must