javascript – ngnix 502 : failed (111: Connection refused) while connecting to upstream-ThrowExceptions

Exception or error:
server {
listen 80;
server_name example1.com;
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;
}
}

server {

listen 80;
server_name example2.com;
location / {

proxy_pass http://localhost:8080;
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;

}

}

Error Log :

2020/03/17 14:13:44 [error] 1880#1880: *88 connect() failed (111: Connection refused) while connecting to upstream, client: 157.37.238.120, server: example1.com, request: "GET /HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "www.example1.com"
2020/03/17 14:13:44 [error] 1880#1880:*88 connect() failed (111: Connection refused) while connecting to upstream, client: 157.37.238.120, server: example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "www.example1.com", referrer: "http://www.example1.com/"
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *