nginx 总是提供 502 Bad Gateway

nginx 总是提供 502 Bad Gateway

我正在尝试使用 Nginx 运行代理,并实施了以下教程作为准备。我完全按照此处的说明进行操作,但当我输入时,出现了 502 Bad Gateway 结果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

我使用的是 Ubuntu 18.04 和 Nginx 1.14。我检查了我的防火墙是否阻止了 Nginx,但它甚至被停用了。有人能帮我排除故障吗?为什么在这些配置下会出现 502 Bad Gateway?

查询域时的日志错误:

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/"

通过 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>

相关内容