suppose the requirement is as follows:
Nginx listens on port 80, the domain name of the backend server assumes http://hello.com,
Nginx accepts requests from the client as a proxy, and then Nginx forwards the request to http://hello.com. If the connection between Nginx and the back-end server times out, you have to return the data in json format to the client. The data is assumed to be like this:
{
"code": -1
"message":"failed to connect remote error"
}
and the status code you want the client to receive is 500.
I would like to ask the seniors to achieve this function, how to configure Nginx?