-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaddy_http_server.txt
62 lines (52 loc) · 2.39 KB
/
caddy_http_server.txt
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
Caddy by Ardan Labs https://caddyserver.com/
- low-code/low-conf HTTP(s) server with TLS+OCSP Certificate automation.
- Container friendly (GOlang based with no dependencies, not even libc)
- Use-cases:
web server, WAF, ingress, reverse proxy,
TLS terminator, logging, caching, TLS Cert. Management.
- File compression.
- template evaluation
- Markdown rendering!!!
- HTTPS by default!!!
# PRODUCTION-READY 1-LINER COMMANDS:
$ caddy file-server <··· local file server
$ caddy file-server \ <··· Public HTTPS file server
--domain example.com (Requires domain's public
A/AAAA DNS records to host)
$ caddy reverse-proxy \ <··· HTTPS reverse proxy
--from example.com \
--to localhost:9000
$ caddy run <···· Run server with Caddyfile
in working directory (if present)
# "Caddyfile" (Optional) human-readable config file for "advanced" tasks.
(Alternative Config RESTful API also available ( POST /config/ + JSON body))
┌─ Caddyfile ──────────
│ localhost <·· Serve local-files
│
│ templates <·· give static sites some dynamic features
│ encode gzip zstd <·· Compress responses according to request headers
│ try_files {path}.html <·· Make HTML file ext. optional
│ {path}
│ reverse_proxy /api/* <·· Send API requests to backend
│ localhost:9005
│ file_server <·· Serve everything else from FS
└───────────────────────
┌─ Caddyfile ────────── HTTPS reverse proxy with custom
│ example.com load balancing and active health checks
│ between 3 backends with custom
│ reverse_proxy health─checks
│ 10.0.0.1:9000
│ 10.0.0.2:9000
│ 10.0.0.3:9000 {
│ lb_policy random_choose 2
│ health_path /ok
│ health_interval 10s
│ }
└───────────────────────
# Docker run:
$ docker pull caddy:2.6.2-alpine
$ docker inspect caddy:2.6.2-alpine
WorkingDir : "/srv",
ExposedPorts: "2019/tcp", "443/tcp" "443/udp" "80/tcp"
Cmd : caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
$ docker run --rm -v hostDir:/srv -p 8080:80 caddy:2.6.2-alpine