How do you configure zero-downtime deployments with NGINX?

Neil Millard

NGINX is often used as a load balancer. It can manage web endpoints and monitor health. As a proxy it can also balance load across endpoints.

As you can configure multiple endpoint or upstreams, these can be updated to point to new resources during either a Blue-green or rolling update, depending on your choice of deployment.

The upstream configuration will be updated to point to the new endpoints and the old endpoints removed.

In practice this is an upstream block with multiple server entries plus a health check, so NGINX stops routing to an endpoint the moment it fails, rather than waiting for the next deploy to notice.

Need help with your DevOps setup?

Get personalised advice from Neil Millard — DevOps consultant based in Weston-super-Mare.