Repository navigation
Expand file tree
/
Copy pathCaddyfile
More file actions
65 lines (55 loc) · 2.02 KB
/
Copy pathCaddyfile
File metadata and controls
65 lines (55 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# The placeholders below are what lets this one file serve both a local
# `frankenphp run --config Caddyfile` and the container (see /docker); unset, every
# one of them falls back to the local default, so nothing changes for a native run.
{
# The container turns the admin API on so its healthcheck can read /metrics.
admin {$CADDY_ADMIN:off}
frankenphp
}
(performance) {
encode zstd br gzip
file_server {
precompressed zstd br gzip
}
}
(cache) {
# Images & fonts: 1 year
@static path *.ico *.jpg *.jpeg *.png *.gif *.webp *.svg *.woff *.woff2 *.ttf *.eot
header @static Cache-Control "max-age=31536000, public"
# JS & CSS: 1 week
@scripts path *.js *.css
header @scripts Cache-Control "max-age=604800, public"
}
(security) {
@svg path *.svg
@not_svg not path *.svg
header @svg Content-Security-Policy "sandbox; default-src 'none'; style-src 'unsafe-inline'; img-src data:"
header @not_svg Content-Security-Policy "base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self' {$CADDY_LIVE_ORIGIN:}"
header {
Permissions-Policy "camera=(), geolocation=(), microphone=(), payment=(), usb=()"
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options nosniff
X-Frame-Options SAMEORIGIN
Referrer-Policy strict-origin-when-cross-origin
-Server
}
}
# Defaults to `:0` — the first available port, like `symfony server:start`. The
# container sets CADDY_SERVER_NAME to `:80` (or to your domain, which also gets Caddy
# to provision the TLS certificate).
{$CADDY_SERVER_NAME::0} {
root * public/
php_server {
resolve_root_symlink
# Worker mode (a long-running kernel) is opt-in: set FRANKENPHP_WORKER_CONFIG
# to `worker ./public/index.php 1` once `runtime/frankenphp-symfony` is
# installed. Safe — see docs/content/performance.md. The gain mostly amortizes
# the kernel boot, so it helps light pages most.
{$FRANKENPHP_WORKER_CONFIG}
}
import performance
import cache
import security
}
# -- If you use static import Caddyfile generated --
# import static/example.tld/.Caddyfile