Skip to content

Commit

Permalink
Add support for custom caddyfile (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
smortexa authored Dec 20, 2024
1 parent 24ac364 commit 01bd566
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions deployment/octane/FrankenPHP/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
{$CADDY_GLOBAL_OPTIONS}

admin {$CADDY_SERVER_ADMIN_HOST}:{$CADDY_SERVER_ADMIN_PORT}

frankenphp {
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
}

servers {
metrics
}
}

{$CADDY_SERVER_SERVER_NAME} {
log {
level WARN

format filter {
wrap {$CADDY_SERVER_LOGGER}
fields {
uri query {
replace authorization REDACTED
}
}
}
}

route {
root * "{$APP_PUBLIC_PATH}"
encode zstd br gzip

{$CADDY_SERVER_EXTRA_DIRECTIVES}

request_body {
max_size 500MB
}

@static {
file
path *.js *.css *.jpg *.jpeg *.webp *.weba *.webm *.gif *.png *.ico *.cur *.gz *.svg *.svgz *.mp4 *.mp3 *.ogg *.ogv *.htc *.woff2 *.woff
}

@staticshort {
file
path *.json *.xml *.rss
}

header @static Cache-Control "public, immutable, stale-while-revalidate, max-age=31536000"

header @staticshort Cache-Control "no-cache, max-age=3600"

@rejected `path('*.bak', '*.conf', '*.dist', '*.fla', '*.ini', '*.inc', '*.inci', '*.log', '*.orig', '*.psd', '*.sh', '*.sql', '*.swo', '*.swp', '*.swop', '*/.*') && !path('*/.well-known/')`
error @rejected 401

php_server {
index frankenphp-worker.php
resolve_root_symlink
}
}
}
2 changes: 1 addition & 1 deletion deployment/octane/FrankenPHP/supervisord.frankenphp.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[program:octane]
process_name=%(program_name)s_%(process_num)s
command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000 --admin-port=2019
command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000 --admin-port=2019 --caddyfile=./deployment/octane/FrankenPHP/Caddyfile
user=%(ENV_USER)s
autostart=true
autorestart=true
Expand Down

0 comments on commit 01bd566

Please sign in to comment.