mirror of
https://github.com/caddyserver/website.git
synced 2025-04-22 04:56:17 -04:00
globalopts: Add servers
name (#292)
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
parent
0956f710c1
commit
24d9769d61
1 changed files with 33 additions and 0 deletions
|
@ -96,6 +96,7 @@ Possible options are:
|
||||||
|
|
||||||
# Server Options
|
# Server Options
|
||||||
servers [<listener_address>] {
|
servers [<listener_address>] {
|
||||||
|
name <name>
|
||||||
listener_wrappers {
|
listener_wrappers {
|
||||||
<listener_wrappers...>
|
<listener_wrappers...>
|
||||||
}
|
}
|
||||||
|
@ -360,6 +361,38 @@ For example, to configure different options for the servers on ports `:80` and `
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### `name`
|
||||||
|
|
||||||
|
A custom name to assign to this server. Usually helpful to identify a server by its name in logs and metrics. If not set, Caddy will define it dynamically using a `srvX` pattern, where `X` starts with 0 and increments based on the number of servers in the config.
|
||||||
|
|
||||||
|
<aside class="tip">
|
||||||
|
|
||||||
|
Keep in mind there's a caveat if you want to name your HTTP server and are using Auto-HTTPS. The server name config doesn't persist past adapting the config, and Auto-HTTPS happens at runtime, from the JSON config.
|
||||||
|
To overcome this, you'll need to create an empty `:80` or `http://` site block and set this option. With that Auto-HTTPS will add its redirect routes to that server.
|
||||||
|
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```caddy
|
||||||
|
{
|
||||||
|
servers :443 {
|
||||||
|
name https
|
||||||
|
}
|
||||||
|
|
||||||
|
servers :80 {
|
||||||
|
name http
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
example.com {
|
||||||
|
}
|
||||||
|
|
||||||
|
http:// {
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
##### `listener_wrappers`
|
##### `listener_wrappers`
|
||||||
|
|
||||||
Allows configuring [listener wrappers](/docs/json/apps/http/servers/listener_wrappers/), which can modify the behaviour of the socket listener. They are applied in the given order.
|
Allows configuring [listener wrappers](/docs/json/apps/http/servers/listener_wrappers/), which can modify the behaviour of the socket listener. They are applied in the given order.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue