Skip to content

fix: prevent duplicate nginx location block for Laravel apps - #7893

Open
fzengin19 wants to merge 1 commit into
coollabsio:nextfrom
fzengin19:fix/nixpacks-php-node-duplicate-location
Open

fix: prevent duplicate nginx location block for Laravel apps#7893
fzengin19 wants to merge 1 commit into
coollabsio:nextfrom
fzengin19:fix/nixpacks-php-node-duplicate-location

Conversation

@fzengin19

Copy link
Copy Markdown

Fixes #7867

When deploying Laravel applications with Nixpacks, the nginx configuration was failing with 'duplicate location "/"' error.

Root cause:

  • Nixpacks nginx template has two conditional 'location /' blocks:
    1. When IS_LARAVEL=true (detected automatically for Laravel apps)
    2. When NIXPACKS_PHP_FALLBACK_PATH is set
  • Coolify was setting NIXPACKS_PHP_FALLBACK_PATH for Laravel apps, causing both conditions to be true and creating duplicate blocks.

Solution:

  • Remove NIXPACKS_PHP_FALLBACK_PATH for Laravel apps since IS_LARAVEL=true already configures the correct nginx routing.
  • Keep NIXPACKS_PHP_ROOT_DIR to ensure proper public directory configuration.

Tested with TALL stack (Tailwind, Alpine, Livewire, Laravel) project containing both composer.json and package.json - nginx now starts correctly.

Fixes coollabsio#7867

When deploying Laravel applications with Nixpacks, the nginx configuration
was failing with 'duplicate location "/"' error.

Root cause:
- Nixpacks nginx template has two conditional 'location /' blocks:
  1. When IS_LARAVEL=true (detected automatically for Laravel apps)
  2. When NIXPACKS_PHP_FALLBACK_PATH is set
- Coolify was setting NIXPACKS_PHP_FALLBACK_PATH for Laravel apps,
  causing both conditions to be true and creating duplicate blocks.

Solution:
- Remove NIXPACKS_PHP_FALLBACK_PATH for Laravel apps since IS_LARAVEL=true
  already configures the correct nginx routing.
- Keep NIXPACKS_PHP_ROOT_DIR to ensure proper public directory configuration.

Tested with TALL stack (Tailwind, Alpine, Livewire, Laravel) project
containing both composer.json and package.json - nginx now starts correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant