a project


bind overrides the interface to which the server's socket should bind. Normally, the listener binds to the empty (wildcard) interface. However, you may force the listener to bind to another hostname or IP instead. (This directive accepts only a host, not a port.)

Note that binding sites inconsistently may result in unintended consequences. For example, if two sites on the same port resolve to and only one of those sites is configured with bind, then only one site will be accessible since the other will bind to the port without a specific host; the OS will choose the more specific matching socket. (Virtual hosts are not shared across different listeners.)

bind also accepts an optional network name: <network>/<host>.


bind <hosts...>
  • <hosts...> is the list of host interfaces to bind which to bind the listener.


To make a socket accessible only on the current machine, bind to the loopback interface (localhost):


To include IPv6:

bind ::1

To bind to a Unix domain socket at /run/caddy:

bind unix//run/caddy