Question

no live upstreams while connecting to upstream

Hi Guys,

no live upstreams while connecting to upstream - Really fed up from this error. any help would be really appreciated.

below is the file content of /etc/nginx/sites-available/example.com

server {
        server_name example.com www.example.com;
        root /var/www/shopify/First/html;
        index index.html;
        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        listen 80;
        listen [::]:80;
        server_name example.com www.example.com;
        return 404; # managed by Certbot
        }

It is working for IP address(but only index.html). Path for node js app is not opening for IP address.

node js app is working for localhost:3000

kindly help.

thanks in advance.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
August 31, 2023

Heya,

The error usually indicates that Nginx is unable to send the request to the node.js server. Here are a few things to check:

  1. Make sure that your Node.js application is running correctly and accessible without any issues on localhost:3000.

  2. If you’re in a Docker environment, replace localhost with the name of your Node.js container.

  3. Add an additional line under your proxy_pass directive to handle proxy errors:

  1. proxy_next_upstream error timeout` `http_500 http_502 http_503 http_504;

You can find more about Nginx reverse proxy setup in our DigitalOcean tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-22-04

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
August 28, 2023

Heya,

The error # no live upstreams while connecting to upstream usually indicates an issue with the application rather than your Nginx configuration. Check your nodejs error logs to see what errors are displayed there and you’ll be able to track the issue.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel