unnik
unnik

Reputation: 1153

Nginx Proxy timeout correct configuration

My request to the upstream are timing out after 60 seconds. I have configured the below proxy details.

 location /myapp/ {
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Host $http_host;
                    proxy_redirect off;
                    proxy_pass http://aws-elb:80/myapp/;
                    proxy_read_timeout 300s;

                }

Is there any other way to increase timeout or wait till I get response from my upstream

Upvotes: 2

Views: 8637

Answers (2)

Muzammil Hasnain
Muzammil Hasnain

Reputation: 149

you have to add this line fastcgi_read_timeout 300s; because by default server timeout is 60s

location ~ \.php$ {
 fastcgi_read_timeout 300s;

after this you have to stop and start the server:

sudo service nginx stop
sudo service nginx start

Upvotes: 0

cejast
cejast

Reputation: 1007

To configure the connection timeout you can change proxy_connect_timeout, which is 60 seconds by default.

This most likely won't solve your problem, however - have you confirmed that you receive a response if you curl your backend service?

Is your ELB successfully forwarding requests to your application? Your application would have to be listening on a port defined under your load balancers listeners.

Upvotes: 6

Related Questions