Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple domains on Laravel Octane (Single Server) #770

Closed
JohnDotOwl opened this issue May 8, 2024 · 1 comment
Closed

Multiple domains on Laravel Octane (Single Server) #770

JohnDotOwl opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JohnDotOwl
Copy link

What happened?

Is it actually possible to run multiple laravel octane with franken php based on 1 configuration file?

I'm getting

INFO Error: adapting config using caddyfile: /root/projects/Caddyfile:6: unrecognized global option: abc.example.com

{
    {$CADDY_GLOBAL_OPTIONS}
    admin localhost:{$CADDY_SERVER_ADMIN_PORT}

    # Project 1: abc
    abc.example.com {
        log {
            level {$CADDY_SERVER_LOG_LEVEL}
            format filter {
                wrap {$CADDY_SERVER_LOGGER}
                fields {
                    uri query {
                        replace authorization REDACTED
                    }
                }
            }
        }
        route {
            root * "/root/projects/abc/public"
            encode zstd br gzip
            {$CADDY_SERVER_EXTRA_DIRECTIVES}
            php_server {
                worker "/root/projects/abc/public/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
                index frankenphp-worker.php
                resolve_root_symlink
            }
        }
    }

    # Project 2: xyz
    xyz.example.com {
        log {
            level {$CADDY_SERVER_LOG_LEVEL}
            format filter {
                wrap {$CADDY_SERVER_LOGGER}
                fields {
                    uri query {
                        replace authorization REDACTED
                    }
                }
            }
        }
        route {
            root * "/root/projects/xyz/public"
            encode zstd br gzip
            {$CADDY_SERVER_EXTRA_DIRECTIVES}
            php_server {
                worker "/root/projects/xyz/public/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
                index frankenphp-worker.php
                resolve_root_symlink
            }
        }
    }
}

Build Type

Standalone binary

Worker Mode

No

Operating System

Other (tell us more in the description)

CPU Architecture

x86_64

PHP configuration

.

Relevant log output

No response

@JohnDotOwl JohnDotOwl added the bug Something isn't working label May 8, 2024
@dunglas
Copy link
Owner

dunglas commented May 8, 2024

You have a bracket issue, the global options block must be closed before defining the server blocks. Try something like this:

{
    {$CADDY_GLOBAL_OPTIONS}
    admin localhost:{$CADDY_SERVER_ADMIN_PORT}
}

# Project 1: abc
abc.example.com {
    log {
        level {$CADDY_SERVER_LOG_LEVEL}
        format filter {
            wrap {$CADDY_SERVER_LOGGER}
            fields {
                uri query {
                    replace authorization REDACTED
                }
            }
        }
    }
    route {
        root * "/root/projects/abc/public"
        encode zstd br gzip
        {$CADDY_SERVER_EXTRA_DIRECTIVES}
        php_server {
             worker "/root/projects/abc/public/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
             index frankenphp-worker.php
             resolve_root_symlink
        }
    }
}

# Project 2: xyz
xyz.example.com {
    log {
        level {$CADDY_SERVER_LOG_LEVEL}
        format filter {
            wrap {$CADDY_SERVER_LOGGER}
            fields {
                uri query {
                    replace authorization REDACTED
                }
            }
        }
    }
    route {
        root * "/root/projects/xyz/public"
        encode zstd br gzip
        {$CADDY_SERVER_EXTRA_DIRECTIVES}
        php_server {
            worker "/root/projects/xyz/public/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
            index frankenphp-worker.php
            resolve_root_symlink
        }
    }
}

@dunglas dunglas closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants