Start nginx with all servers weighted=0

Vladimir Homutov vl at
Wed Dec 19 20:18:25 UTC 2018

On 19.12.2018 22:47, Pablo Fischer wrote:
> Hi all,
> Sorry for posting to nginx-devel but looking to see if I'm missing any
> details. I'm building a service discovery integration on top of our
> Nginx, things work fine but there are two caveats:
> - Nginx does not allow you to start with an empty upstream (aka no hosts).

the reason is that such configuration is meaningless,
at least with unmodified nginx version

> - Nginx errors out with invalid configuration if you set a weight to "0".

to disable a particular server, use 'down' flag.

> I'm wondering if there is any technical reason of why I _should not_
> make a patch that would allow the weight to be 0 during startup
> configuration (or reload), looking specifically at this:
> or... if there is a known patch that does this already then even better
> We have a module that allows us set the weights dynamically via a URL
> we have without reloading nginx (we can't execute continuous reloads
> since our buffers are maxed out so this could potentially throw the
> host into a OOM case).

you may be interested in functionality, available in commercial version,

More information about the nginx-devel mailing list