From 8f4d2389ae3855f20d028d247a079db61feb5234 Mon Sep 17 00:00:00 2001 From: mathew Date: Wed, 3 Jul 2019 12:56:13 -0500 Subject: [PATCH] Reindent with spaces and less indentation for clarity, add "root" to show how to set site root --- v2:-Config-from-Scratch.md | 97 ++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/v2:-Config-from-Scratch.md b/v2:-Config-from-Scratch.md index 113821a..49c9095 100644 --- a/v2:-Config-from-Scratch.md +++ b/v2:-Config-from-Scratch.md @@ -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. \ No newline at end of file