Welcome! Log In Create A New Profile

Advanced

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

All files from this thread

File Name File Size   Posted by Date  
nginxtest.conf 7.2 KB open | download kaushalshriyan 12/15/2022 Read message
nginxtest.conf 7.2 KB open | download kaushalshriyan 12/16/2022 Read message
nginxtest.conf 7.7 KB open | download kaushalshriyan 01/04/2023 Read message
Dan Swaney
January 07, 2023 12:10PM
To query your MySql database, I propose you use a REST interface to
decouple it from your Front End.

The REST interface should be a HTTP Web Service either self hosted or
hosted by another Web Server locally on the NGINX Server. (This allows
NGINX to handle authentication and HTTPS encryption centrally.)

As a result, use your REST Web Servive to also determine if tthe MySql DB s
up or down when servicing the request and return a 200 message to NGINX
indicating if there is an error in a JSON payload.

I propose avoiding use of HTTP error codes yourself. Let NGINX or the Web
Server or the Client to deal with underlying network issues use status
codes beyond 2000.

This also will guarantee your message will not be stripped and you can
provide whatever level of detail needed for your client code or Front End
to understand and handle.

Let NGINX proxy all traffic between the REST Web Service and your Client.
Adjust cookie details as needed for the domain security sabdboxing.





On Fri, Jan 6, 2023, 9:58 PM Kaushal Shriyan <kaushalshriyan@gmail.com>
wrote:

>
>
> On Sat, Jan 7, 2023 at 2:56 AM Francis Daly <francis@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@daoine.org
>> _______________________________________________
>> nginx mailing list
>> nginx@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
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

kaushalshriyan December 15, 2022 11:24AM

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

kaushalshriyan December 15, 2022 11:28AM

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

Maxim Dounin December 15, 2022 03:10PM

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

kaushalshriyan December 15, 2022 08:54PM

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

kaushalshriyan December 16, 2022 01:24PM

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

Maxim Dounin December 16, 2022 05:20PM

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

Maxim Dounin December 21, 2022 08:36PM

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

kaushalshriyan January 04, 2023 12:24PM

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

kaushalshriyan January 05, 2023 11:46AM

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

Francis Daly January 06, 2023 04:26PM

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

kaushalshriyan January 06, 2023 10:00PM

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

Dan Swaney January 07, 2023 12:10PM

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

Francis Daly January 09, 2023 04:24AM

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

Dan Swaney January 05, 2023 01:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 139
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready