HTTP upstream directives

server directive (HTTP upstream)

HTTP upstream context; no default member. Declares a peer and optional limits, weight, availability and failure parameters.

Formal Syntax & Structure

nginx syntaxnginx
server address [parameters];

Parameters & Attributes

NameTypeDescription
addresshost[:port] | IP[:port] | unix:pathPeer endpoint; default port 80 for host/IP.
weightweight=positive integerRelative peer weight.
max_connsmax_conns=nonnegative integerActive connection cap; zero unlimited, per worker without zone. Idle cache can increase total.
max_failsmax_fails=nonnegative integerFailure threshold; zero disables accounting.
fail_timeoutfail_timeout=durationFailure window and exclusion interval.
rolebackup | downBackup selection or administratively disabled peer; algorithm restrictions apply.
resolveliteral resolveDynamic DNS with shared zone and resolver; OSS since 1.27.3.
serviceservice=nameSRV lookup with resolve and hostname without port; OSS since 1.27.3.
slow_startslow_start=durationCommercial recovery ramp; check balancing algorithm compatibility.
routeroute=identifierAffinity route identifier; check edition and version.

Working Example

Example Snippetnginx
server 127.0.0.1:18171 weight=2;
Nginx Reference