ยง2023-07-01
At its core, Caddy's configuration is simply a JSON document.
- caddy.json
{
"apps": {
"http": {
"servers": {
"example": {
"listen": [":2015"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Hello, world!"
}]
}
]
}
}
}
}
}
- test
$ curl localhost:2019/load \
-H "Content-Type: application/json" \
-d @caddy.json
$ curl localhost:2019/config/
{"apps":{"http":{"servers":{"example":{"listen":[":2015"],"routes":[{"handle":[{"body":"Hello, world!","handler":"static_response"}]}]}}}}}
$ curl localhost:2015
Hello, world!