我的 CentOS 7 服务器上安装了 nginx 版本 1.19.3。我的 Rocketchat 应用程序在端口 3000、3001 和 3002 上工作。但是我的 nginx 服务器无法将代理路由到 Rocketchat。它给了我 502 Bad Gateway 错误。
这是我的 default.conf
# Upstreams
upstream backend {
least_conn;
server [::1]:3000 max_fails=3 fail_timeout=30s;
server [::1]:3001 max_fails=3 fail_timeout=30s;
server [::1]:3002 max_fails=3 fail_timeout=30s;
}
# HTTPS Server
server {
listen 443 ssl http2;
server_name example.com;
error_log /var/log/nginx/rocketchat.access.log;
ssl_certificate /etc/nginx/certs/example.com.crt;
ssl_certificate_key /etc/nginx/certs/example.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx-Proxy true;
proxy_read_timeout 5m;
proxy_pass http://backend;
proxy_redirect off;
}
}
这是我遇到的错误/var/log/nginx/rocketchat.access.log
2020/10/21 16:08:23 [error] 12532#12532: *25 no live upstreams while connecting to upstream, client: local-ip-address, server: example.com, request: "GET /favicon.ico HTTP/2.0", upstream: "http://backend/favicon.ico", host: "example.com", referrer: "https://example.com/"
我启用了 3000、3001、3002 并且可以通过本地 IP 地址访问 RocketChat。
我已经尝试了通过 stackoverfollow 找到的所有解决方案,但它不起作用。有人可能是什么问题吗?