小编Jac*_*ack的帖子

NGINX 代理传递给 NodeJS 应用程序:返回 502 错误

我正在尝试将 NGINX 设置为我的 NodeJS 应用程序的前端,该应用程序已上线127.0.0.1:3000,但我无法解决此 502 错误。NGINX 可在本地访问http://55.55.55.5/或访问http://dev.example

dev.example(文件在:/etc/nginx/sites-available 并符号链接到启用站点)

upstream up_dev.example {
    server 127.0.0.1:3000;
}

server {
    listen 0.0.0.0:80;
    server_name dev.example example;
    access_log /var/log/nginx/dev.example.log;

    location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

      proxy_pass http://up_dev.example/;
      proxy_redirect off;
    }
 }
Run Code Online (Sandbox Code Playgroud)

错误日志

2014/09/17 19:38:26 [错误] 1679#0:*1 connect() 失败(111:连接被拒绝),同时连接到上游,客户端:55.55.55.1,服务器:,请求:“GET / HTTP/ 1.1",上游:$

configuration nginx proxy 502

3
推荐指数
1
解决办法
8129
查看次数

标签 统计

502 ×1

configuration ×1

nginx ×1

proxy ×1