An app that has authorised a file can answer with an empty body and
"X-Accel-Redirect: /_accel/<path under storage/app>"; nginx then sends the file
itself (Range requests included). The location re-adds the CORS headers from the
upstream response, which nginx otherwise drops on this redirect. The php location
announces it to PHP as $_SERVER['X_ACCEL_STORAGE'] = '/_accel/'.
Harmless for an app that does not use it: the location is `internal`, reached
only through an X-Accel-Redirect the app itself returns, so no response of such
an app changes. The one visible difference is that an external request to
/_accel/... gets nginx's 404 instead of reaching the app's front controller; no
app here routes under /_accel/. The fastcgi param only adds a server variable
nothing reads unless the app asks for it (it is not a request header, so it
changes no headers, and Symfony's own X-Sendfile support ignores it). nginx -t
passes on 1.26.3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two recurring foot-guns in production stacks rolled into one image-level fix:
1. storage/ + bootstrap/cache/ ownership drift. ENABLE_LARAVEL_PERMS was
opt-in (default 0) and only chmod'd the top-level dir — so any subdir
created later by a different UID (root, nobody, …) stayed un-writable
for www-data. Symptom: workkit:db:backup pumping a multi-GB mysqldump
into a doomed bash redirect that fails with "Permission denied" only
after the pipeline starts. Now default-on (=1), recursive chown +
chmod ug+rwX, SGID on dirs so future files inherit the group, and we
pre-create the subdirs that ship empty (incl. storage/backups/) so
artisan never creates one as the wrong user.
2. mysql client TLS verification against self-signed in-cluster certs.
`php artisan db` failed with "TLS/SSL error: self-signed certificate
in certificate chain" because modern mysql/mariadb clients auto-enable
ssl-verify-server-cert when a password is on argv. Drops a
/etc/mysql/conf.d/00-laravel-client.cnf with ssl-verify-server-cert=OFF
so the connection still negotiates TLS but skips the chain check —
the right tradeoff for a private docker network. Override per-host
with MYSQL_CLIENT_VERIFY=ON or by mounting a stricter .cnf.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>