mirror of
https://github.com/caddyserver/website.git
synced 2025-04-25 06:26:17 -04:00
Big Caddyfile docs update (#374)
This commit is contained in:
parent
3ec3033602
commit
22301d6a81
34 changed files with 1732 additions and 512 deletions
|
@ -37,11 +37,30 @@ basicauth [<matcher>] [<hash_algorithm> [<realm>]] {
|
|||
|
||||
## Examples
|
||||
|
||||
Protect all resources in /secret so only Bob can access them with the password "hiccup":
|
||||
Require authentication for all requests to `example.com`:
|
||||
|
||||
```caddy-d
|
||||
basicauth /secret/* {
|
||||
Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
|
||||
```caddy
|
||||
example.com {
|
||||
basicauth {
|
||||
# Username "Bob", password "hiccup"
|
||||
Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
|
||||
}
|
||||
respond "Welcome, {http.auth.user.id}" 200
|
||||
}
|
||||
```
|
||||
|
||||
Protect files in `/secret/` so only `Bob` can access them (and anyone can see other paths):
|
||||
|
||||
```caddy
|
||||
example.com {
|
||||
root * /srv
|
||||
|
||||
basicauth /secret/* {
|
||||
# Username "Bob", password "hiccup"
|
||||
Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
|
||||
}
|
||||
|
||||
file_server
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue