mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-11 09:16:26 -04:00
Updated v2: Config from Scratch (markdown)
parent
8f4d2389ae
commit
21497d9397
@ -1,11 +1,10 @@
|
||||
Empty config (does nothing):
|
||||
An empty config does nothing:
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
|
||||
Empty HTTP server (responds with empty responses):
|
||||
This is an empty HTTP server, which responds on port 80 to any host, but with an empty response:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -21,7 +20,7 @@ Empty HTTP server (responds with empty responses):
|
||||
}
|
||||
```
|
||||
|
||||
Static file server out of the specified directory:
|
||||
This is a static file server out of the the `/var/www` directory:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -45,7 +44,7 @@ Static file server out of the specified directory:
|
||||
}
|
||||
```
|
||||
|
||||
Same as above, but with automatic HTTPS (including HTTP->HTTPS redirects):
|
||||
And this is the same, but with automatic HTTPS (notice that we now serve on the HTTPS port; any port will do, as long as it's not the HTTP port):
|
||||
|
||||
```json
|
||||
{
|
||||
@ -56,11 +55,7 @@ Same as above, but with automatic HTTPS (including HTTP->HTTPS redirects):
|
||||
"listen": [":443"],
|
||||
"routes": [
|
||||
{
|
||||
"match": [
|
||||
{
|
||||
"host": ["example.com"]
|
||||
}
|
||||
],
|
||||
"match": [{"host": ["example.com"]}],
|
||||
"respond": {
|
||||
"responder": "file_server",
|
||||
"root": "/var/www"
|
||||
@ -72,7 +67,6 @@ Same as above, but with automatic HTTPS (including HTTP->HTTPS redirects):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The reason the above config uses HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.
|
||||
The reason this particular config gets automatic HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.
|
||||
|
Loading…
x
Reference in New Issue
Block a user