Skip to content

Commit 01bd566

Browse files
authored
Add support for custom caddyfile (#106)
1 parent 24ac364 commit 01bd566

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
{$CADDY_GLOBAL_OPTIONS}
3+
4+
admin {$CADDY_SERVER_ADMIN_HOST}:{$CADDY_SERVER_ADMIN_PORT}
5+
6+
frankenphp {
7+
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
8+
}
9+
10+
servers {
11+
metrics
12+
}
13+
}
14+
15+
{$CADDY_SERVER_SERVER_NAME} {
16+
log {
17+
level WARN
18+
19+
format filter {
20+
wrap {$CADDY_SERVER_LOGGER}
21+
fields {
22+
uri query {
23+
replace authorization REDACTED
24+
}
25+
}
26+
}
27+
}
28+
29+
route {
30+
root * "{$APP_PUBLIC_PATH}"
31+
encode zstd br gzip
32+
33+
{$CADDY_SERVER_EXTRA_DIRECTIVES}
34+
35+
request_body {
36+
max_size 500MB
37+
}
38+
39+
@static {
40+
file
41+
path *.js *.css *.jpg *.jpeg *.webp *.weba *.webm *.gif *.png *.ico *.cur *.gz *.svg *.svgz *.mp4 *.mp3 *.ogg *.ogv *.htc *.woff2 *.woff
42+
}
43+
44+
@staticshort {
45+
file
46+
path *.json *.xml *.rss
47+
}
48+
49+
header @static Cache-Control "public, immutable, stale-while-revalidate, max-age=31536000"
50+
51+
header @staticshort Cache-Control "no-cache, max-age=3600"
52+
53+
@rejected `path('*.bak', '*.conf', '*.dist', '*.fla', '*.ini', '*.inc', '*.inci', '*.log', '*.orig', '*.psd', '*.sh', '*.sql', '*.swo', '*.swp', '*.swop', '*/.*') && !path('*/.well-known/')`
54+
error @rejected 401
55+
56+
php_server {
57+
index frankenphp-worker.php
58+
resolve_root_symlink
59+
}
60+
}
61+
}

deployment/octane/FrankenPHP/supervisord.frankenphp.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:octane]
22
process_name=%(program_name)s_%(process_num)s
3-
command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000 --admin-port=2019
3+
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
44
user=%(ENV_USER)s
55
autostart=true
66
autorestart=true

0 commit comments

Comments
 (0)