mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-11 09:16:26 -04:00
Reindent with spaces and less indentation for clarity, add "root" to show how to set site root
parent
b6db30c1a4
commit
8f4d2389ae
@ -9,38 +9,39 @@ Empty HTTP server (responds with empty responses):
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"apps": {
|
"apps": {
|
||||||
"http": {
|
"http": {
|
||||||
"servers": {
|
"servers": {
|
||||||
"myserver": {
|
"myserver": {
|
||||||
"listen": [":80"],
|
"listen": [":80"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Static file server out of the current directory:
|
Static file server out of the specified directory:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"apps": {
|
"apps": {
|
||||||
"http": {
|
"http": {
|
||||||
"servers": {
|
"servers": {
|
||||||
"myserver": {
|
"myserver": {
|
||||||
"listen": [":80"],
|
"listen": [":80"],
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
"respond": {
|
"respond": {
|
||||||
"responder": "file_server"
|
"responder": "file_server",
|
||||||
}
|
"root": "/var/www"
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,28 +49,30 @@ Same as above, but with automatic HTTPS (including HTTP->HTTPS redirects):
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"apps": {
|
"apps": {
|
||||||
"http": {
|
"http": {
|
||||||
"servers": {
|
"servers": {
|
||||||
"myserver": {
|
"myserver": {
|
||||||
"listen": [":443"],
|
"listen": [":443"],
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
"match": [
|
"match": [
|
||||||
{
|
{
|
||||||
"host": ["example.com"]
|
"host": ["example.com"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"respond": {
|
"respond": {
|
||||||
"responder": "file_server"
|
"responder": "file_server",
|
||||||
}
|
"root": "/var/www"
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The reason the above config uses HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.
|
The reason the above config uses HTTPS is because the host matcher informs Caddy which hostnames to manage certificates for.
|
Loading…
x
Reference in New Issue
Block a user