Update bind.md

This commit is contained in:
Aaron Paterson 2024-10-10 00:06:46 -04:00 committed by GitHub
parent 6db3af5c32
commit e590d29117
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,10 +16,13 @@ Note that binding sites inconsistently may result in unintended consequences. Fo
## Syntax ## Syntax
```caddy-d ```caddy-d
bind <hosts...> bind <hosts...> {
protocols <protocol> ...
}
``` ```
- **&lt;hosts...&gt;** is the list of host interfaces to bind which to bind the listener. - **&lt;hosts...&gt;** is the list of host interfaces to bind which to bind the listener.
- **&lt;protocols...&gt;** is an optional override of the HTTP protocols to enable for the listener.
## Examples ## Examples
@ -64,6 +67,39 @@ example.com {
} }
``` ```
To bind to a Unix domain socket at `/run/caddy/stream.sock` that serves h1 and h2, and another at `/run/caddy/dgram.sock` that serves h3:
```caddy
example.com {
bind unix//run/caddy/stream.sock {
protocols h1 h2
}
bind unixgram//run/caddy/dgram.sock {
protocols h3
}
}
```
To bind to inherited descriptors specified with [environment placeholders](/docs/conventions#placeholders):
```caddy
http://example.com {
bind fd/{env.CADDY_HTTP_FD} {
protocols h1
}
redir https://example.com{uri} permanent
}
https://example.com {
bind fd/{env.CADDY_HTTPS_FD} {
protocols h1 h2
}
bind fdgram/{env.CADDY_HTTP3_FD} {
protocols h3
}
}
```
To bind one domain to two different interfaces, with different responses: To bind one domain to two different interfaces, with different responses:
```caddy ```caddy