简体   繁体   English

nginx - 连接到上游时没有实时上游

[英]nginx -- no live upstreams while connecting to upstream

I have nginx version 1.19.3 installed on my CentOS 7 server.我的 CentOS 7 服务器上安装了 nginx 版本 1.19.3。 My rocketchat application working on port 3000, 3001 and 3002. But my nginx server is not able to route proxy to Rocketchat.我的 Rocketchat 应用程序在端口 3000、3001 和 3002 上工作。但我的 nginx 服务器无法将代理路由到 Rocketchat。 It is giving me 502 Bad Gateway error.它给了我 502 Bad Gateway 错误。

Here is my default.conf这是我的 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;
    }
}

Here is the error which i got in /var/log/nginx/rocketchat.access.log这是我在/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/"

I have enabled 3000, 3001, 3002 and I am able to access RocketChat through local ip address.我已经启用了 3000、3001、3002,我可以通过本地 IP 地址访问 RocketChat。

I have tried every solution which I found over stackoverfollow but it doesn't work.我已经尝试了我在 stackoverfollow 上找到的所有解决方案,但它不起作用。 Do anybody what could be the issue?有没有人可能是什么问题?

您的 Rocketchat 应用是否在 IPv6 本地主机地址 ::1 或 IPv4 127.0.0.1 上运行/可访问?

By setting keepalive to 8 in upstream works for me.通过在上游将 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.

相关问题 nginx 连接到上游 https 时没有实时上游 - nginx no live upstreams while connecting to upstream https NGINX:连接到上游时没有实时上游 - NGINX : no live upstreams while connecting to upstream 在Nginx后面变薄“在连接到上游时没有上游上游” - Thin behind Nginx “no live upstreams while connecting to upstream” 如何解决 nginx - 连接上游客户端时没有实时上游? - How to solve nginx - no live upstreams while connecting to upstream client? 连接到上游时没有上游,但是上游是可以的 - No live upstreams while connecting to upstream, but upsteam is OK 连接到上游客户端时不进行实时上游负载平衡 - loadbalancing no live upstreams while connecting to upstream client uwsgicluster - 连接上游客户端时没有上游 - uwsgicluster - no live upstreams while connecting to upstream client Nginx + Docker - 与上游“连接到上游时没有实时上游”,但与 proxy_pass 一起工作正常 - Nginx + Docker - "no live upstreams while connecting to upstream" with upstream but works fine with proxy_pass NGINX + NODE JS-连接到上游时没有实时上游,客户端:127.0.0.1 - NGINX+NODE JS - no live upstreams while connecting to upstream, client: 127.0.0.1 Nginx:抛出自定义错误页面,以在连接到上游时没有实时上游 - Nginx : Throw customized error page for no live upstream while connecting to upstream
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM