Description and Error Message
The official Laravel guide (https://coolify.io/docs/applications/laravel) ships a nixpacks.toml whose nginx.template.conf sets the document root from an env var:
$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
) else (
root /app;
)
The template is rendered at container start by prestart.mjs, which reads process.env. The docs tell you to set NIXPACKS_PHP_ROOT_DIR=/app/public in the dashboard.
Since PR #9117 (merged 2026-05-11, released in v4.1.0), Coolify filters every NIXPACKS_/RAILPACK_-prefixed variable out of the runtime environment via scopeWithoutBuildpackControlVariables on EnvironmentVariable. So NIXPACKS_PHP_ROOT_DIR is present at build time but empty in the running container.
Result: the $if sees an empty string (falsy), nginx falls back to root /app, and every route returns 404 while /public/index.php returns 200. The docs example and the current runtime behavior contradict each other.
Actual
GET /up → 404 (from nginx, not Laravel)
GET /public/index.php → 200
- Inside the container:
grep root /etc/nginx.conf → root /app;, and env | grep NIXPACKS_PHP → both variables are empty.
Expected Behavior
GET / → Laravel responds (nginx root is /app/public).
Steps to Reproduce
- Fresh Laravel app, no
package.json (pure API).
- New Coolify application, Build Pack = Nixpacks, Port 80.
- Add
nixpacks.toml exactly as in the Laravel docs.
- In the dashboard set
NIXPACKS_PHP_ROOT_DIR=/app/public and NIXPACKS_PHP_FALLBACK_PATH=/index.php, both marked "available during build" and "available in the container".
- Deploy.
Example Repository URL
No response
Coolify Version
v4.3.17
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
ubuntu 22.04
Screenshots / Visuals
Additional Information
No response
Description and Error Message
The official Laravel guide (https://coolify.io/docs/applications/laravel) ships a
nixpacks.tomlwhosenginx.template.confsets the document root from an env var:The template is rendered at container start by
prestart.mjs, which readsprocess.env. The docs tell you to setNIXPACKS_PHP_ROOT_DIR=/app/publicin the dashboard.Since PR #9117 (merged 2026-05-11, released in v4.1.0), Coolify filters every
NIXPACKS_/RAILPACK_-prefixed variable out of the runtime environment viascopeWithoutBuildpackControlVariablesonEnvironmentVariable. SoNIXPACKS_PHP_ROOT_DIRis present at build time but empty in the running container.Result: the
$ifsees an empty string (falsy), nginx falls back toroot /app, and every route returns 404 while/public/index.phpreturns 200. The docs example and the current runtime behavior contradict each other.Actual
GET /up→ 404 (from nginx, not Laravel)GET /public/index.php→ 200grep root /etc/nginx.conf→root /app;, andenv | grep NIXPACKS_PHP→ both variables are empty.Expected Behavior
GET /→ Laravel responds (nginx root is/app/public).Steps to Reproduce
package.json(pure API).nixpacks.tomlexactly as in the Laravel docs.NIXPACKS_PHP_ROOT_DIR=/app/publicandNIXPACKS_PHP_FALLBACK_PATH=/index.php, both marked "available during build" and "available in the container".Example Repository URL
No response
Coolify Version
v4.3.17
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
ubuntu 22.04
Screenshots / Visuals
Additional Information
No response