<div dir="ltr">Hi Francis,<div><br></div><div>Thanks a lot for all your help and support. It worked. I have configured the below settings in nginx after a few attempts by tweaking it. It worked like a charm. </div><div><br></div><div>location /apis {<br> # First attempt to serve request as file, then<br> # as directory, then fall back to displaying a 404.<br> fastcgi_intercept_errors off;<br> add_header "X-Debug-JSON-APIS" $http_accept always;</div><div> fastcgi_pass <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br> include fastcgi.conf;<br> fastcgi_param SCRIPT_FILENAME $document_root/index.php;</div><div> }<br></div><div><br></div><div>I have a follow up question related to the below error which appears in html instead of JSON format when I hit rest api calls <a href="http://mydomain.com/apis" target="_blank">http://mydomain.com/apis</a> in case of when the MySQL Database service is down as part of testing the end to end flow. The flow is as follows: </div><div><br></div><div>User -> Nginx webserver -> PHP-FPM upstream server -> MySQL Database. <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><b><font color="#ff0000"><i>The Website Encountered an Unexpected Error. Please try again Later </br></i></font></b></blockquote><div><br></div><div>Is there a way to display the above string in JSON format? <br></div><div><br></div><div>Please guide me. Thanks in advance. </div><div><br></div><div>Best Regards,</div><div><br></div><div>Kaushal</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 23, 2022 at 11:39 PM Francis Daly <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Nov 23, 2022 at 11:27:35PM +0530, Kaushal Shriyan wrote:<br>
> On Wed, Nov 23, 2022 at 11:20 PM Francis Daly <<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>> wrote:<br>
<br>
Hi there,<br>
<br>
> I am not sure about this line error_page 555 /dummyfile; what does 555<br>
> code mean and what will be the contents of dummyfile?<br>
> <br>
> location ^~ /apis/ {<br>
> fastcgi_intercept_errors off;<br>
> error_page 555 /dummyfile;<br>
> fastcgi_pass <a href="http://127.0.0.1:9000" rel="noreferrer" target="_blank">127.0.0.1:9000</a>;<br>
> include fastcgi.conf;<br>
> fastcgi_param SCRIPT_FILENAME<br>
> /var/www/html/gsmaidp/web/index.php;<br>
> }<br>
<br>
I thought I had explained it in the previous mails?<br>
<br>
555 is an error code that you do not care about (because you do not<br>
expect to see it).<br>
<br>
You can remove either the "error_page" or the "fastcgi_intercept_errors"<br>
line (or leave them both in).<br>
<br>
What happened when you tried it?<br>
<br>
f<br>
-- <br>
Francis Daly <a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a><br>
_______________________________________________<br>
nginx mailing list -- <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
To unsubscribe send an email to <a href="mailto:nginx-leave@nginx.org" target="_blank">nginx-leave@nginx.org</a><br>
</blockquote></div>