docs: Several minor tweaks and fixes

This commit is contained in:
Matthew Holt 2020-04-15 10:34:47 -06:00
parent a80f20b385
commit cca0660339
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
7 changed files with 46 additions and 38 deletions

View file

@ -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. 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 ### Examples
Set a new active configuration: Set a new active configuration:

View file

@ -85,7 +85,7 @@ All hostnames (domain names and IP addresses) qualify for fully-managed certific
- consist only of alphanumerics, hyphens, dots, and wildcard (`*`) - 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)) - 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 localhost
- are not an IP address - are not an IP address

View file

@ -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: Let's do something interesting with our file server: serve a templated page. Create a new file and paste this into it:
<!-- We use zero-width space character () to trick templates into not evaluating in this tutorial. -->
```html ```html
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -84,7 +86,7 @@ Let's do something interesting with our file server: serve a templated page. Cre
<title>Caddy tutorial</title> <title>Caddy tutorial</title>
</head> </head>
<body> <body>
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"}}
</body> </body>
</html> </html>
``` ```
@ -94,7 +96,7 @@ Save this as `caddy.html` in the current directory and load it in your browser:
The output is: 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: 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:

View file

@ -27,6 +27,7 @@ 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: The `php_fastcgi` directive is the same as the following configuration:
``` ```
route {
# Add trailing slash for directory requests # Add trailing slash for directory requests
@canonicalPath { @canonicalPath {
file { file {
@ -50,6 +51,7 @@ reverse_proxy @phpFiles <php-fpm_gateway> {
split .php split .php
} }
} }
}
``` ```
Most modern PHP apps work well with this preset. If yours does not, feel free to borrow from this and customize it as needed instead of using the `php_fastcgi` shortcut. Most modern PHP apps work well with this preset. If yours does not, feel free to borrow from this and customize it as needed instead of using the `php_fastcgi` shortcut.

View file

@ -76,14 +76,14 @@ The ellipses `...` indicates a continuation, i.e. one or more parameters.
### `caddy adapt` ### `caddy adapt`
<pre><code class="cmd bash">caddy adapt <pre><code class="cmd bash">caddy adapt
--config &lt;path&gt; [--config &lt;path&gt;]
[--adapter &lt;name&gt;] [--adapter &lt;name&gt;]
[--pretty] [--pretty]
[--validate]</code></pre> [--validate]</code></pre>
Adapts a configuration to Caddy's native JSON config structure and writes the output to stdout, along with any warnings to stderr, then exits. 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`. `--adapter` specifies the config adapter to use; default is `caddyfile`.

View file

@ -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. This guide will show you how to get up and running with [fully-managed HTTPS](/docs/automatic-https) in no time.
<aside class="tip"> <aside class="tip">
Caddy uses HTTPS for all sites by default, as long as a host name is provided in the config. This tutorial assumes you want to get a publicly-trusted site up over HTTPS, which requires a public domain name (i.e. not "localhost") and external ports. Caddy uses HTTPS for all sites by default, as long as a host name is provided in the config. This tutorial assumes you want to get a publicly-trusted site (i.e. not "localhost") up over HTTPS, so we'll be using a public domain name and external ports.
</aside> </aside>
**Prerequisites:** **Prerequisites:**

View file

@ -1,3 +1,4 @@
<div class="wrapper">
<footer> <footer>
<div> <div>
<img src="/resources/images/caddy-logo.svg" alt="Caddy" id="footer-logo"> <img src="/resources/images/caddy-logo.svg" alt="Caddy" id="footer-logo">
@ -11,3 +12,4 @@
Caddy&reg; is a registered trademark of Light Code Labs, LLC. Caddy&reg; is a registered trademark of Light Code Labs, LLC.
</div> </div>
</footer> </footer>
</div>