From cca066033940410a7f77b504dfcac74106a5482e Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Wed, 15 Apr 2020 10:34:47 -0600 Subject: [PATCH] docs: Several minor tweaks and fixes --- src/docs/markdown/api.md | 2 + src/docs/markdown/automatic-https.md | 2 +- src/docs/markdown/caddyfile-tutorial.md | 6 ++- .../caddyfile/directives/php_fastcgi.md | 40 ++++++++++--------- src/docs/markdown/command-line.md | 4 +- src/docs/markdown/quick-starts/https.md | 2 +- src/includes/footer.html | 28 +++++++------ 7 files changed, 46 insertions(+), 38 deletions(-) diff --git a/src/docs/markdown/api.md b/src/docs/markdown/api.md index f66362a..d383a5c 100644 --- a/src/docs/markdown/api.md +++ b/src/docs/markdown/api.md @@ -46,6 +46,8 @@ Sets Caddy's configuration, overriding any previous configuration. It blocks unt This endpoint supports different config formats using config adapters. The request's Content-Type header indicates the config format used in the request body. Usually, this should be `application/json` which represents Caddy's native config format. For another config format, specify the appropriate Content-Type so that the value after the forward slash / is the name of the config adapter to use. For example, when submitting a Caddyfile, use a value like `text/caddyfile`; or for JSON 5, use a value such as `application/json5`; etc. +If the new config is the same as the current one, no reload will occur. To force a reload, set `Cache-Control: must-revalidate` in the request headers. + ### Examples Set a new active configuration: diff --git a/src/docs/markdown/automatic-https.md b/src/docs/markdown/automatic-https.md index bb4647c..3e9af97 100644 --- a/src/docs/markdown/automatic-https.md +++ b/src/docs/markdown/automatic-https.md @@ -85,7 +85,7 @@ All hostnames (domain names and IP addresses) qualify for fully-managed certific - consist only of alphanumerics, hyphens, dots, and wildcard (`*`) - do not start or end with a dot ([RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5)) -In addition, hostnams qualify for publicly-trusted certificates if they: +In addition, hostnames qualify for publicly-trusted certificates if they: - are not localhost - are not an IP address diff --git a/src/docs/markdown/caddyfile-tutorial.md b/src/docs/markdown/caddyfile-tutorial.md index 0baa001..069ea0c 100644 --- a/src/docs/markdown/caddyfile-tutorial.md +++ b/src/docs/markdown/caddyfile-tutorial.md @@ -77,6 +77,8 @@ Save your Caddyfile, then refresh your browser tab. You should either see a list Let's do something interesting with our file server: serve a templated page. Create a new file and paste this into it: + + ```html @@ -84,7 +86,7 @@ Let's do something interesting with our file server: serve a templated page. Cre Caddy tutorial - Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}} + Page loaded at: {​{now | date "Mon Jan 2 15:04:05 MST 2006"}​} ``` @@ -94,7 +96,7 @@ Save this as `caddy.html` in the current directory and load it in your browser: The output is: ``` -Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}} +Page loaded at: {​{now | date "Mon Jan 2 15:04:05 MST 2006"}​} ``` Wait a minute. We should see today's date. Why didn't it work? It's because the server hasn't yet been configured to evaluate templates! Easy to fix, just add a line to the Caddyfile so it looks like this: diff --git a/src/docs/markdown/caddyfile/directives/php_fastcgi.md b/src/docs/markdown/caddyfile/directives/php_fastcgi.md index 249cd9f..ed8d009 100644 --- a/src/docs/markdown/caddyfile/directives/php_fastcgi.md +++ b/src/docs/markdown/caddyfile/directives/php_fastcgi.md @@ -27,27 +27,29 @@ Since this directive is an opinionated wrapper over a reverse proxy, you can ope The `php_fastcgi` directive is the same as the following configuration: ``` -# Add trailing slash for directory requests -@canonicalPath { - file { - try_files {path}/index.php +route { + # Add trailing slash for directory requests + @canonicalPath { + file { + try_files {path}/index.php + } + not { + path */ + } } - not { - path */ + redir @canonicalPath {path}/ 308 + + # If the requested file does not exist, try index files + try_files {path} {path}/index.php index.php + + # Proxy PHP files to the FastCGI responder + @phpFiles { + path *.php } -} -redir @canonicalPath {path}/ 308 - -# If the requested file does not exist, try index files -try_files {path} {path}/index.php index.php - -# Proxy PHP files to the FastCGI responder -@phpFiles { - path *.php -} -reverse_proxy @phpFiles { - transport fastcgi { - split .php + reverse_proxy @phpFiles { + transport fastcgi { + split .php + } } } ``` diff --git a/src/docs/markdown/command-line.md b/src/docs/markdown/command-line.md index f10e68e..f7dbf0a 100644 --- a/src/docs/markdown/command-line.md +++ b/src/docs/markdown/command-line.md @@ -76,14 +76,14 @@ The ellipses `...` indicates a continuation, i.e. one or more parameters. ### `caddy adapt`
caddy adapt
-	--config <path>
+	[--config <path>]
 	[--adapter <name>]
 	[--pretty]
 	[--validate]
Adapts a configuration to Caddy's native JSON config structure and writes the output to stdout, along with any warnings to stderr, then exits. -`--config` is the path to the config file. If blank, will default to `Caddyfile` in current directory if it exists; otherwise, this flag is required. +`--config` is the path to the config file. If omitted, assumes `Caddyfile` in current directory if it exists; otherwise, this flag is required. `--adapter` specifies the config adapter to use; default is `caddyfile`. diff --git a/src/docs/markdown/quick-starts/https.md b/src/docs/markdown/quick-starts/https.md index 459c62f..bf5521e 100644 --- a/src/docs/markdown/quick-starts/https.md +++ b/src/docs/markdown/quick-starts/https.md @@ -7,7 +7,7 @@ title: HTTPS quick-start This guide will show you how to get up and running with [fully-managed HTTPS](/docs/automatic-https) in no time. **Prerequisites:** diff --git a/src/includes/footer.html b/src/includes/footer.html index 7ec7438..c4ff509 100644 --- a/src/includes/footer.html +++ b/src/includes/footer.html @@ -1,13 +1,15 @@ -
-
- - An open source Go community project -
- in partnership with Ardan Labs -
- -
+
+ +
\ No newline at end of file