-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaddyfile
76 lines (62 loc) · 1.44 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
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
{
email {env.CLOUDFLARE_EMAIL}
}
(cloudflare) {
tls email@example.com {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
}
(add_static_file_serving_features) {
# Allow accessing files without requiring .html:
try_files {path} {path}.html
# Enable Static File Server and Directory Browsing:
file_server {
browse
hide .* _*
}
# Enable templating functionality:
templates
# Enable Compression for Output:
encode zstd gzip
handle_errors {
respond "<pre>{http.error.status_code} {http.error.status_text}</pre>"
}
}
#Simple Site Hosting
example.com {
root * /path/{host}
file_server
import cloudflare
}
#PHP Example
domain.com {
root * /path/{host}
#local php: php_fastcgi unix//run/php/php-version-fpm.sock
php_fastcgi php-fpm:9000
file_server
}
#SPA Site
sub.anotherexample.com {
import add_static_file_serving_features
import cloudflare
}
# HTTP->HTTPS redirects
http://xyz.example, http://api.xyz.example {
redir https://{host}{uri}
}
#Sub Domain Wildcard Cert
*.example.com {
import cloudflare
@foo host foo.example.com
handle @foo {
reverse_proxy http://192.168.1.51:8080
}
@bar host bar.example.com
handle @bar {
respond "Bar!"
}
# Fallback for otherwise unhandled domains
handle {
abort
}
}