Doing timeout properly for NGINX
I develop micro services for a living. All my microservices are sitting behind the NGINX server which acts as load balancer.
So anytime my micro service takes more than 120 seconds to respond. it used to timeout at NGINX level.
This is how I solved it.
Open /etc/nginx/nginx.conf file
Under the http section add these lines based on how many seconds you want to wait. I want to wait max of 120 seconds
http{
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
send_timeout 120s;
}
Now reload the Nginx service
sudo systemctl reload nginx