Created v2: Config from Scratch (markdown)

Matt Holt 2019-07-02 16:12:27 -06:00
parent adb5afee39
commit fb3a9aed0f

@ -0,0 +1,75 @@
Empty config (does nothing):
```json
{}
```
Empty HTTP server (responds with empty responses):
```json
{
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
}
}
}
}
}
```
Static file server out of the current directory:
```json
{
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
"routes": [
{
"respond": {
"responder": "file_server"
}
}
]
}
}
}
}
}
```
Same as above, but with automatic HTTPS (including HTTP->HTTPS redirects):
```json
{
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":443"],
"routes": [
{
"match": [
{
"host": ["example.com"]
}
],
"respond": {
"responder": "file_server"
}
}
]
}
}
}
}
}
```
The reason the above config uses HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.