Nginx + Nodejs: upstream timed out (110: Connection timed out) while connecting to upstream

Viewed 1845

I'm using Nginx reverse proxy so that when visitors viewing example.com they are actually viewing example.com:8888. Previously it's working fine but suddenly this morning it's not accessible through domain anymore, but still can be accessing using IP address with port 8888.

So I suspect that the issue was causing by Nginx, when I view the log I found multiple lines showing upstream timed out error and I found out that the upstream IP address was Cloudflare's IP (I pointed my domain to Cloudflare).

I'm not sure why it cannot be accessible anymore suddenly. Anyone able to help? Thanks. Here is the error log:

2017/07/17 07:53:41 [error] 25707#25707: *31 no live upstreams while connecting to upstream, client: [MY IP], server: www.example.com$, request: "GET / HTTP/1.1", upstream: "http://www.example.com/", host: "www.example.com"
2017/07/17 07:53:41 [error] 25707#25707: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: [MY IP], server: www.example.com$, request: "GET / HTTP/1.1", upstream: "http://104.18.51.97:8888/", host: "www.example.com"

And here is the Nginx config:

server {
    listen       80;
    server_name  example.com;
    return       301 http://www.example.com$request_uri;
}

server {
    listen 80 default_server;
    server_name ~^(?<subdomain>.+)\.example\.com$;
    location / {
        proxy_pass http://www.example.com:8888;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $subdomain.example.com;
        proxy_cache_bypass $http_upgrade;
    }
}
0 Answers
Related