Score:0

nginx always serves 502 Bad Gateway

fr flag

I am trying to run a proxy with Nginx and I implemented the following tutorial as preparation. I did exactly as instructed here and I was served a 502 Bad Gateway result when I entered http://develop.microideation.local

https://blog.microideation.com/2020/04/19/setup-a-local-development-proxy-using-nginx-handling-cors/#:~:text=%20Setup%20a%20local%20development%20proxy%20using%20Nginx,to%20configure%20Nginx%20for%20resolving%20the...%20More%20

I am on Ubuntu 18.04 and Nginx 1.14. I checked whether my firewall was blocking Nginx but it was deactivated even. Can anyone help me troubleshoot why I would get a 502 Bad Gateway given these configurations?

The log errors when querying the domain:

2021/11/02 19:15:05 [error] 10754#10754: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "develop.microideation.local"
2021/11/02 19:15:05 [error] 10754#10754: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "develop.microideation.local", referrer: "http://develop.microideation.local/"
2021/11/02 19:15:11 [error] 10754#10754: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "develop.microideation.local"
2021/11/02 19:15:11 [error] 10754#10754: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "develop.microideation.local", referrer: "http://develop.microideation.local/"
2021/11/02 19:16:53 [error] 10754#10754: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "develop.microideation.local"
2021/11/02 19:16:53 [error] 10754#10754: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: develop.microideation.local, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "develop.microideation.local", referrer: "http://develop.microideation.local/"

Results when querying via curl:

user@workspace:/etc/nginx/conf.d$ curl http://develop.microideation.local
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>
Ivan Shatsky avatar
gr flag
Check the nginx error log, what is the corresponding message?
Mnemosyne avatar
fr flag
@IvanShatsky hi, I added the error logs in my post
Ivan Shatsky avatar
gr flag
Can you do something like `curl http://127.0.0.1:3000/` from the command line? Is it refused too?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.