Upstream service php-fpm is up and running but reports {"errors": {"status_code": 502,"status": "php-fpm server is down"}}

Kaushal Shriyan kaushalshriyan at gmail.com
Sat Jan 7 02:58:17 UTC 2023


On Sat, Jan 7, 2023 at 2:56 AM Francis Daly <francis at daoine.org> wrote:

> On Thu, Jan 05, 2023 at 10:15:34PM +0530, Kaushal Shriyan wrote:
>
> Hi there,
>
> > When I hit http://mydomain.com/apis for conditions when MySQL DB is
> down. I
> > get the below output and it works as expected.
> >
> > {"errors": "MySQL DB Server is down"}
> >
> > When I hit http://mydomain.com/apis for conditions when MySQL DB is up
> and
> > running fine, I get the below output in spite of MySQL DB server being
> > fine.
> >
> > {"errors": "MySQL DB Server is down"}
>
> Your config is
>
>     location /apis {
>         return 500 '{"errors": "MySQL DB Server is down"}';
>     }
>
> Whenever you make a request that is handled in that location{}, your
> nginx will return that response.
>
> It looks like your nginx is doing what it was told to do.
>
> No part of your config indicates that nginx knows (or cares) whether
> MySQL DB is up or down. Does something outside of nginx know that?
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx



Thanks Francis for the detailed explanation. Is there a way to configure
Nginx for the below conditions?

When I hit http://mydomain.com/apis for conditions when MySQL DB is down. I
get the below output and it works as expected.

{"errors": "MySQL DB Server is down"}

When I hit http://mydomain.com/apis for conditions when MySQL DB is up and
running fine, I get the below output in spite of MySQL DB server being fine.

{"errors": "MySQL DB Server is down"}

Please suggest. Thanks in advance. I appreciate your help as always.

Best Regards,

Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20230107/ac44b667/attachment.htm>


More information about the nginx mailing list