0

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

user122875
  • 209
  • 1
  • 2
  • 5

1 Answers1

0

Tell the load balancer to check a URL which forwards to the backend service. TCP checks or requesting a static file are not sufficient.

womble
  • 96,255
  • 29
  • 175
  • 230
  • Thanks but I am using level 4 load balancing, so not sure I can do that(plus the load balancer is basically out of my control, I have to use the GUI provided by the cloud service, and it doesnt have those kinds of options) – user122875 Aug 06 '12 at 10:08
  • The layer at which load balancing takes place is unrelated to the possible health checks. Find a better load balancer or cloud service if the one you have doesn't support HTTP health checks. Even ELB supports HTTP health checks. – womble Aug 06 '12 at 10:10
  • Not really under my control. – user122875 Aug 06 '12 at 10:14
  • Of course it's under your control. – womble Aug 06 '12 at 10:19
  • Maybe you and your employer have a different relationship than me and mine have then.... anyway this is getting way off topic. – user122875 Aug 06 '12 at 10:24