xin

listen

Selects the address, port and protocol for a server.

Syntaxlisten address[:port] [ssl] [http2] [default_server] [reuseport] [backlog=number];
Contextsserverstream server

Behavior

IPv4, bracketed IPv6 and port-only forms are supported. Server selection first groups blocks by listening socket, then applies server_name matching.

Availability. QUIC listeners require HTTP/3 support and the corresponding TLS configuration. listen cftunnel:name attaches a server to a Cloudflare Tunnel (see cloudflare_tunnel).

Example

listen 443 ssl default_server;

Related directives

server_name · ssl_certificate