Hello everyone,
I am having a 502 gateway error that I have tried to debug but nothing I have tried so far is working. I have an app running on Nginx with Let’s Encrypt using a domain connected through DO. All the other DNS records using the same system (Let’s encrypt and Nginx) are working fine but this new DNS records isn’t quite connecting and I can’t trace it. Maybe I have been looking at it for too long.
Here is my error long from Nginx:
2023/01/02 09:20:57 [error] 58437#58437: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 76.113.138.139, server: repair.tech-works.xyz, request: "GET /login HTTP/1.1", upstream: "http://[::1]:3011/login", host: "repair.tech-works.xyz"
2023/01/02 09:20:57 [error] 58437#58437: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 76.113.138.139, server: repair.tech-works.xyz, request: "GET /login HTTP/1.1", upstream: "http://127.0.0.1:3011/login", host: "repair.tech-works.xyz"
2023/01/02 09:20:57 [error] 58437#58437: *2 no live upstreams while connecting to upstream, client: 76.113.138.139, server: repair.tech-works.xyz, request: "GET /favicon.ico HTTP/1.1", upstream: "http://localhost/favicon.ico", host: "repair.tech-works.xyz", referrer: "https://repair.tech-works.xyz/login"
Here is my Nginx sites-available code(I only added the server block for the affected DNS record):
server {
listen 80;
listen [::]:80;
root /home/ifeasome/projects/repair-shop;
index index.html index.htm index.nginx-debian.html;
server_name repair.tech-works.xyz www.repair.tech-works.xyz;
location / {
proxy_pass http://localhost:3011;
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; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tech-works.xyz/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tech-works.xyz/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
}
If it helps, my Nginx conf. file check returns ‘successful’ message. Please can you point to me towards what I am missing. I have been agonising over this for a while
Thank you so much!
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!
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
The error that you are seeing in your logs indicates that the problem is with the backend service that is supposed to be running on port
3011
rather than the Nginx service itself:You need to make sure that your backend service is actually up and running, you can quickly check that with:
If you don’t see any output, then you need to make sure that you start the backend service so that it could handle the requests.
Let me know how it goes.
Best,
Bobby Source