5

I am looking for a nginx solution that would display a temporary down message when the underling server is down.

I am looking or a solution that would behave like this:

  • display a maintenance page (503) if the upstream server is down
  • display a timeout (504) if the upstream server did not return any content in 60 seconds (it could take more to return the entire content)
  • optionally: find a way of measuring the time spend from when the service went down first time so I can display a maintenance message: but send an email to the admin if this still happens for more than 5 minutes.

To reiterate, the whole point is to make a config that allows the server administrator to restart the upstream servers without having to manage the maintenance messages.

sorin
  • 161,544
  • 178
  • 535
  • 806
  • 1
    This seems like a duplicate of [5031818](http://stackoverflow.com/questions/5031818/show-a-custom-503-page-if-upstream-is-down), plus using something like http://pingdom.com – Elliot Foster May 13 '13 at 16:25

1 Answers1

0

If you set the timeout values for proxy or fcgi requests (depending on your setup) to your liking, you can indeed use the error_page directive to configure different error pages for specific error codes.

The nginx documentation has the details, as already pointed out by kashyap.

Your optional requirement basically amounts to a monitoring service, this is not something best done inside a frontend server, most likely.

Community
  • 1
  • 1
Gnarfoz
  • 3,146
  • 1
  • 17
  • 15