I am running an nginx server behind a separate (L-4) load balancer that basically just serves static files and forwards requests to a downstream web server. This works great as long as all the services are running.
The problem is that if the downstream web server goes down, I want nginx to stop accepting all requests(so that the load balancer will notice it is down). Is it possible to do this? According to the nginx documentation, if there is only one server in the upstream group(say localhost), the max_failures setting is ignored, meaning nginx will continue to forward requests to the dead app server. Can I basically tell nginx to just stop everything after a certain number of failures?
EDIT Using L4 load balancing
Tell the load balancer to check a URL which forwards to the backend service. TCP checks or requesting a static file are not sufficient.