[clug] force Apache to close connection on error

Bob Edwards Robert.Edwards at anu.edu.au
Mon Sep 21 05:55:14 UTC 2015

On 21/09/15 15:17, Steve Kieu wrote:
> Hi,
> One idea might be that you can use nagios - write your own plugin to
> implement the logic and when the check failed, run a nagios handler to
> shut down apache  on that host and alert sysadmin. Nginx will see it
> down and not passing request to it automatically.
> I prefer that as monitoring does good job and is designed to do so and
> not depending on any other third party solutions with nginx so we can
> keep it standard.
> cheers

Thanks Steve - an interesting variation. One problem is that the Apache
server may still be serving other content correctly (to other clients)
and so killing it because one part of the site cannot (in this case)
connect to it's backend database is a little more brutal than I would
like. Also, the database may come back again, of it's own volition,
some time later, but the Apache server would need to be manually


Bob Edwards.

> On Mon, Sep 21, 2015 at 2:53 PM, Bob Edwards <Robert.Edwards at anu.edu.au
> <mailto:Robert.Edwards at anu.edu.au>> wrote:
>     Hi all,
>     I am running a site with Nginx in front of Apache (actually in front
>     of lots of things, but am interested in Apache at the moment).
>     The FOSS version of Nginx can do rudimentary fail-over if an "upstream"
>     (back-end) server is not responding.
>     The commercial version of Nginx (Nginx Plus) can do fancier tricks like
>     detecting if the upstream server is responding with error code 500.
>     Alas, if my site is "half-dead", Apache responds with error code 500
>     and my FOSS version of Nginx determines that as a valid response and so
>     keeps on sending requests to it.
>     What I would like to do is get Apache to close the connection instead
>     of responding with error code 500. This probably breaks all kinds of
>     HTTP standards, but should suffice to trigger my Nginx to fail-over
>     to the backup server.
>     Any ideas?
>     cheers,
>     Bob Edwards.
>     --
>     linux mailing list
>     linux at lists.samba.org <mailto:linux at lists.samba.org>
>     https://lists.samba.org/mailman/listinfo/linux
> --
> Steve Kieu

More information about the linux mailing list