Open jduan00 opened 3 months ago
I suspect CADDY_SERVER_SERVER_NAME
is empty and it sees two global blocks. At least, that is what the error message you gave says is wrong.
Thanks for the pointer. It seems that using the --caddyfile
option will lose CADDY_SERVER_SERVER_NAME
and other variables.
I don't think $CADDY_SERVER_SERVER_NAME
is necessarily dropped. This example configuration works for me, at least for laravel/octane v2.4.0
laravel/framework v11.10.0
:
php artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000 --max-requests=10000 --caddyfile=/app/resources/caddy/backend.Caddyfile
Thebackend.Caddyfile
content:
{
{$CADDY_GLOBAL_OPTIONS}
admin localhost:{$CADDY_SERVER_ADMIN_PORT}
frankenphp {
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
}
}
{$CADDY_SERVER_SERVER_NAME} {
log {
level {$CADDY_SERVER_LOG_LEVEL}
# Redact the authorization query parameter that can be set by Mercure...
format filter {
wrap {$CADDY_SERVER_LOGGER}
fields {
uri query {
replace authorization REDACTED
}
}
}
}
route {
root * "{$APP_PUBLIC_PATH}"
encode zstd br gzip
# Mercure configuration is injected here...
{$CADDY_SERVER_EXTRA_DIRECTIVES}
@static {
file
path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *ttf *.svg
}
header @static Cache-Control max-age=5184000
php_server {
index frankenphp-worker.php
# Required for the public/storage/ directory...
# resolve_root_symlink
}
}
}
Describe you feature request
Hi there,
I am trying to tweak the Caddyfile for Laravel Octane. What is the proper way to do it?
Here is what I have tried, but the server does not start. Any help will be greatly appreciated.
1) Make a copy for the Caddyfile
cp <laravel path>/vendor/laravel/octane/src/Commands/stubs/Caddyfile /etc/frankenphp/Caddyfile-octane
2) Modify Caddyfile-octane
3) Start laravel octane + frankenphp
php artisan octane:start --server=frankenphp --port=8100 --host=0.0.0.0 --caddyfile /etc/frankenphp/Caddyfile-octane
Error received: