[英]nginx -- no live upstreams while connecting to upstream
我的 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 上找到的所有解決方案,但它不起作用。 有沒有人可能是什么問題?
您的 Rocketchat 應用是否在 IPv6 本地主機地址 ::1 或 IPv4 127.0.0.1 上運行/可訪問?
通過在上游將 keepalive 設置為 8 對我有用。
# 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;
keepalive 8;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.