Reindent with spaces and less indentation for clarity, add "root" to show how to set site root

mathew 2019-07-03 12:56:13 -05:00
parent b6db30c1a4
commit 8f4d2389ae

@ -9,38 +9,39 @@ Empty HTTP server (responds with empty responses):
```json
{
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
}
}
}
}
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
}
}
}
}
}
```
Static file server out of the current directory:
Static file server out of the specified directory:
```json
{
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
"routes": [
{
"respond": {
"responder": "file_server"
}
}
]
}
}
}
}
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":80"],
"routes": [
{
"respond": {
"responder": "file_server",
"root": "/var/www"
}
}
]
}
}
}
}
}
```
@ -48,28 +49,30 @@ 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"
}
}
]
}
}
}
}
"apps": {
"http": {
"servers": {
"myserver": {
"listen": [":443"],
"routes": [
{
"match": [
{
"host": ["example.com"]
}
],
"respond": {
"responder": "file_server",
"root": "/var/www"
}
}
]
}
}
}
}
}
```
The reason the above config uses HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.