Destroyed Caddyfile (markdown)

Matt Holt 2015-04-15 16:15:15 -06:00
parent 55819896e9
commit 4a6fe10863

@ -1,51 +0,0 @@
The Caddyfile is how you configure Caddy. Generally you have one Caddyfile per website.
By default, Caddy will look for the Caddyfile in the current directory, but you can specify any other path when you launch Caddy:
```
$ caddy -conf=/path/to/Caddyfile
```
And when you do that, the Caddyfile can have any filename, but we will call it the Caddyfile in the docs.
## Structure
The Caddyfile is very easy to use. It can configure either one or multiple servers (virtual hosts).
The first line is always an address to listen on:
```
mydomain.com:80
```
The rest of the file consists of lines with directives and parameters (arguments), for example:
```
mydomain.com:80
gzip
ext .html
```
To configure multiple servers (virtual hosts) in the same Caddyfile, wrap the directives pertaining for each server in a curly brace block, for example:
```
mydomain.com:80 {
redirect / :443 301
}
# Curly braces must open at the end of a line
mydomain.com:443 {
gzip
ext .html .htm
tls cert.pem key.pem
}
```
Notice that a `#` token turns the rest of the line into a comment.
In the above file, the keywords `redirect`, `gzip`, `ext`, and `tls` are directives. There are others. Each directive is bound to a unique piece of middleware that wraps every request in order to satisfy the Caddyfile.
To learn about what directives are available, please see the list of directives in this wiki.
As you can tell, whitespace separates different arguments/parameters. You can group multiple words into a single argument by enclosing it "in quotes".