0

使用我的域连接到我的 NodeBB 安装时出现 502 错误网关 NodeBB 在默认端口 (4567) 上运行

我的 nginx 似乎配置正确(使用 IP 连接时):http : //puu.sh/mLI7U/0e03691d4c.png 我的 nodebb 似乎配置正确(使用 IP 连接时 ): http ://puu.sh /mLI95/5fdafcaed9.png 我的 A 记录将 IP 定向到我的 VPS 配置正确。

这是我的 etc/nginx/conf.d/example.com.conf

server {
listen 80;

server_name sporklounge.com;

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://127.0.0.1:4567/;
    proxy_redirect off;

    # Socket.IO Support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

}

My NodeBB config.json
{
    "url": "http://localhost:4567",
    "secret": "25d0d6a2-0444-49dc-af0c-bd693f5829d8",
    "database": "redis",
    "redis": {
        "host": "127.0.0.1",
        "port": "6379",
        "password": "",
        "database": "0"
    }
}

这是我的 var/log/nginx/error.log

    2016/01/27 12:04:42 [error] 22026#0: *4062 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:80/favicon.ico", host: "sporklounge.com", referrer: "http://sporklounge.com/"
2016/01/27 12:21:06 [crit] 974#0: *1 connect() to 127.0.0.1:4567 failed (13: Permission denied) while connecting to upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "sporklounge.com"
2016/01/27 12:21:07 [crit] 974#0: *1 connect() to 127.0.0.1:4567 failed (13: Permission denied) while connecting to upstream, client: 50.186.224.26, server: sporklounge.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:4567/favicon.ico", host: "sporklounge.com", referrer: "http://sporklounge.com/"

非常感谢所有帮助,我将回答所有我能帮助获得解决方案的问题,谢谢!

4

1 回答 1

0

我看到的一件事是,根据文档,您的url配置值应该是 指向您的 NodeBB 的完整 Web 可访问地址。那将是sporklounge.com,而不是当前值。

也可能是后端有时响应缓慢。在 Nginx 中尝试使用非常高的值来查看后端是否最终响应:

 # For testing, allow very long response times.
 proxy_read_timeout 5m;

此外,使用 netstat 确认后端正在端口 4567 上运行:

sudo netstat -nlp | grep ':4567'

等等,答案可能在您的日志中,这会告诉您连接失败的原因:

(13:权限被拒绝)同时连接到上游

请参阅相关问题:

于 2016-01-27T17:59:38.037 回答