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
| Name | Type | Description |
|---|---|---|
| address | host[:port] | IP[:port] | unix:path | Peer endpoint; default port 80 for host/IP. |
| weight | weight=positive integer | Relative peer weight. |
| max_conns | max_conns=nonnegative integer | Active connection cap; zero unlimited, per worker without zone. Idle cache can increase total. |
| max_fails | max_fails=nonnegative integer | Failure threshold; zero disables accounting. |
| fail_timeout | fail_timeout=duration | Failure window and exclusion interval. |
| role | backup | down | Backup selection or administratively disabled peer; algorithm restrictions apply. |
| resolve | literal resolve | Dynamic DNS with shared zone and resolver; OSS since 1.27.3. |
| service | service=name | SRV lookup with resolve and hostname without port; OSS since 1.27.3. |
| slow_start | slow_start=duration | Commercial recovery ramp; check balancing algorithm compatibility. |
| route | route=identifier | Affinity route identifier; check edition and version. |
Working Example
Example Snippetnginx
server 127.0.0.1:18171 weight=2;