Repository navigation
Expand file tree
/
Copy pathCaddyfile.frankenphp
More file actions
89 lines (75 loc) · 1.95 KB
/
Copy pathCaddyfile.frankenphp
File metadata and controls
89 lines (75 loc) · 1.95 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ddev-generated
# Adapted from https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile
#
# The Caddyfile is an easy way to configure FrankenPHP and the Caddy web server.
#
# https://frankenphp.dev/docs/config
# https://caddyserver.com/docs/caddyfile
{
skip_install_trust
servers {
trusted_proxies static private_ranges
}
{$CADDY_GLOBAL_OPTIONS}
frankenphp {
{$FRANKENPHP_CONFIG}
}
}
{$CADDY_EXTRA_CONFIG}
(common_config) {
root {$DDEV_APPROOT}/{$DDEV_DOCROOT}
encode zstd br gzip
{$CADDY_SERVER_EXTRA_DIRECTIVES}
# Without index.php, serve files directly, so Caddy's 403 and 404 show the DDEV error pages.
# Caddy v2.11.8+ would send these requests to index.php even when it doesn't exist.
@noIndexFile {
not file index.php
not path *.php *.php/*
}
handle @noIndexFile {
file_server
}
@noIndexMissingScript {
not file index.php
path *.php *.php/*
not file {path}
}
error @noIndexMissingScript 404
# DDEV error pages (v1.25.4+) for 403/404 from Caddy itself, PHP responses pass through
handle_errors 403 404 {
@ddevErrorPage file {
root /usr/local/share
try_files /ddev-webserver-{err.status_code}-error.html
}
handle @ddevErrorPage {
root * /usr/local/share
rewrite * {file_match.relative}
header X-Ddev-{err.status_code}-Source "ddev-webserver (frankenphp)"
file_server
}
}
}
:80 {
import common_config
@secure header X-Forwarded-Proto https
php_server @secure {
env HTTPS on
env SERVER_PORT 443
env REQUEST_SCHEME https
root {$DDEV_APPROOT}/{$DDEV_DOCROOT}
}
php_server {
root {$DDEV_APPROOT}/{$DDEV_DOCROOT}
}
}
:443 {
import common_config
tls /etc/ssl/certs/master.crt /etc/ssl/certs/master.key
php_server {
root {$DDEV_APPROOT}/{$DDEV_DOCROOT}
}
}
# As an alternative to editing the above site block, you can add your own site
# block files in the Caddyfile.d directory, and they will be included as long
# as they use the .caddyfile extension.
import Caddyfile.d/*.caddyfile