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.
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:

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 (`*`)
- 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

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:
<!-- We use zero-width space character () to trick templates into not evaluating in this tutorial. -->
```html
<!DOCTYPE html>
<html>
@ -84,7 +86,7 @@ Let's do something interesting with our file server: serve a templated page. Cre
<title>Caddy tutorial</title>
</head>
<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>
</html>
```
@ -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:

View file

@ -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 <php-fpm_gateway> {
transport fastcgi {
split .php
reverse_proxy @phpFiles <php-fpm_gateway> {
transport fastcgi {
split .php
}
}
}
```

View file

@ -76,14 +76,14 @@ The ellipses `...` indicates a continuation, i.e. one or more parameters.
### `caddy adapt`
<pre><code class="cmd bash">caddy adapt
--config &lt;path&gt;
[--config &lt;path&gt;]
[--adapter &lt;name&gt;]
[--pretty]
[--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.
`--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`.

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.
<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>
**Prerequisites:**