Choose the best explanation for why nginx uses keepalive connections.
Think about how reusing connections affects speed and resource use.
Keepalive connections allow nginx to reuse the same TCP connection for multiple HTTP requests, which reduces the overhead of opening new connections and improves performance.
Which configuration snippet correctly enables keepalive connections for upstream servers in nginx?
upstream backend {
server backend1.example.com;
server backend2.example.com;
# Which line enables keepalive?
}Look for the directive that sets the number of idle keepalive connections.
The keepalive directive inside an upstream block sets how many idle keepalive connections nginx keeps open to upstream servers.
Given the following snippet from nginx_status output, what does the Keep-Alive field represent?
Active connections: 291 server accepts handled requests 166309 166309 310704 Reading: 12 Writing: 14 Waiting: 265 Keep-Alive: 150
Focus on what 'Waiting' and 'Keep-Alive' mean in nginx status.
The 'Keep-Alive' field shows how many connections are currently kept open and idle, ready to accept new requests without reopening TCP connections.
After enabling keepalive connections, nginx closes them too soon. Which configuration is most likely causing this?
Consider which setting controls how long idle connections stay open.
The keepalive_timeout directive sets how long nginx keeps idle connections open. A low value like 5 seconds causes early closing.
Put these steps in the correct order to enable and confirm keepalive connections work in nginx.
Think about configuration first, then client setup, then reload, then verification.
First configure nginx upstream with keepalive, then ensure clients send keepalive headers, reload nginx to apply changes, and finally verify with status.