Skip to content

[Bug]: Laravel docs example broken since v4.1.0 — NIXPACKS_PHP_ROOT_DIR is stripped from runtime, nginx serves /app → 404 #11628

Description

@mpoweredo

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.confroot /app;, and env | grep NIXPACKS_PHP → both variables are empty.

Expected Behavior

GET / → Laravel responds (nginx root is /app/public).

Steps to Reproduce

  1. Fresh Laravel app, no package.json (pure API).
  2. New Coolify application, Build Pack = Nixpacks, Port 80.
  3. Add nixpacks.toml exactly as in the Laravel docs.
  4. 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".
  5. 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

Image

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔍 TriageIssues that need assessment and prioritization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions