forked from dunglas/frankenphp-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Caddyfile
47 lines (35 loc) · 1.31 KB
/
Caddyfile
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
# Adapted from https://caddy.community/t/caddyfile-for-drupal-10/21607/5
{
{$CADDY_GLOBAL_OPTIONS}
frankenphp {
{$FRANKENPHP_CONFIG}
}
# https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
order php_server before file_server
order php before file_server
}
{$CADDY_EXTRA_CONFIG}
{$SERVER_NAME:localhost} {
root * web/
encode zstd br gzip
@hiddenPhpFilesRegexp path_regexp \..*/.*\.php$
error @hiddenPhpFilesRegexp 403
@notFoundPhpFiles path_regexp /vendor/.*\.php$
error @notFoundPhpFiles 404
@notFoundPhpFilesRegexp path_regexp ^/sites/[^/]+/files/.*\.php$
error @notFoundPhpFilesRegexp 404
@privateDirRegexp path_regexp ^/sites/.*/private/
error @privateDirRegexp 403
@protectedFilesRegexp {
not path /.well-known*
path_regexp \.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^/(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config|yarn\.lock|package\.json)$|^\/#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$
}
error @protectedFilesRegexp 403
@static {
file
path *.avif *.css *.eot *.gif *.gz *.ico *.jpg *.jpeg *.js *.otf *.pdf *.png *.svg *.ttf *.webp *.woff *.woff2
}
header @static Cache-Control "max-age=31536000,public,immutable"
{$CADDY_SERVER_EXTRA_DIRECTIVES}
php_server
}