NGINX: upstream timed out (110: Connection timed out) while reading
response header from upstream
I have puma running as the upstream app server and riak as my background
db cluster. When I send a request that map reduces a chunk of data for
about 25K users and returns it from riak to app I get an error in the
nginx log "upstream timed out (110: Connection timed out) while reading
response header from upstream". If I query my upstream directly without
nginx proxy, with the same request, I get the required data.
Nginx time out occurs once proxy is put in.
**nginx.conf**
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 4000;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
types_hash_max_size 2048;
proxy_cache_path /opt/cloud/cache levels=1 keys_zone=cloud:10m;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/sites-enabled/*.conf;
}
**virtual host conf**
upstream ss_api {
server 127.0.0.1:3000 max_fails=0 fail_timeout=600;
}
server {
listen 81;
server_name xxxxx.com; # change to match your URL
if ($http_x_forwarded_proto != 'https') {
return 301 https://$server_name$request_uri;
}
location / {
proxy_pass http://ss_api; # match the name of upstream directive which
is defined above
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache cloud;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
proxy_cache_bypass $http_authorization;
proxy_cache_bypass http://ss_api/account/;
add_header X-Cache-Status $upstream_cache_status;
}
location ~ /\. { deny all; }
}
Nginx has a bunch of timeout directives. I don't know if I'm missing
something important. Any help would be highly appreciated....
No comments:
Post a Comment