nginx 502 - нет прямых апстримов при подключении к апстриму
Nginx показывает мне ошибку 502 (нет прямых восходящих потоков при подключении к восходящему потоку). Для nginx у меня есть varnihs, прослушивающие порт 6081.
Моя конфигурация:
upstream varnish {
server 127.0.0.1:6081;
server 127.0.1.1:6081;
}
location ~ / {
proxy_pass http://varnish;
proxy_intercept_errors on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_request_buffering off;
proxy_buffering off;
}
access_log /var/log/nginx/access.log upstream_time;
access_log /var/log/nginx/upstream.log upstream_log;
error_log /var/log/nginx/error.log error;
################################################ ############################################### #
user www-data;
worker_processes auto;
pid /run/nginx.pid;
worker_rlimit_nofile 100480;
events {
worker_connections 3000;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
types_hash_max_size 2048;
server_tokens off;
reset_timedout_connection on;
client_body_timeout 12;
send_timeout 2;
keepalive_requests 100;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
}
Журналы (ошибка):
2020/08/03 21:02:43 [error] 3692#3692: *3505459612 no live upstreams while connecting to upstream, client: X.X.X.X, server: XXXXXXXXX, request: "GET XXXXXXXXXXXXXXXXXXXX HTTP/1.0", upstream: "http://varnish/XXXXXXXXXX", host: "XXXXXXXXX"
2020/08/03 21:02:43 [error] 3692#3692: *3505459613 no live upstreams while connecting to upstream, client: X.X.X.X, server: XXXXXXXXX, request: "GET XXXXXXXXXXXXXXXXXXXX HTTP/1.0", upstream: "http://varnish/XXXXXXXXXX", host: "XXXXXXXXX"
2020/08/03 21:02:43 [error] 3692#3692: *3505459614 no live upstreams while connecting to upstream, client: X.X.X.X, server: XXXXXXXXX, request: "GET XXXXXXXXXXXXXXXXXXXX HTTP/1.0", upstream: "http://varnish/XXXXXXXXXX", host: "XXXXXXXXX"
[03/Aug/2020:21:02:48 +0200] X.X.X.X - - - XXXXX hostX to: varnish: GET XXXXXXXXXXX HTTP/1.0 502 upstream_response_time 0.000 msec 1596481368.967 request_time 0.000
[03/Aug/2020:21:02:48 +0200] X.X.X.X - - - XXXXX hostX to: varnish: GET XXXXXXXXXXX HTTP/1.0 502 upstream_response_time 0.000 msec 1596481368.968 request_time 0.000
[03/Aug/2020:21:02:48 +0200] X.X.X.X - - - XXXXX hostX to: varnish: GET XXXXXXXXXXX HTTP/1.0 502 upstream_response_time 0.000 msec 1596481368.969 request_time 0.000
Logs (success):
[03/Aug/2020:00:08:31 +0200] X.X.X.X - - - XXXXX hostX to: 127.0.1.1:6081: GET XXXXXXXXXXX HTTP/1.1 200 upstream_response_time 0.000 msec 1596406111.634 request_time 0.000
[03/Aug/2020:00:08:31 +0200] X.X.X.X - - - XXXXX hostX to: 127.0.0.1:6081: GET XXXXXXXXXXX HTTP/1.0 200 upstream_response_time 0.016 msec 1596406111.634 request_time 0.017
[03/Aug/2020:00:08:31 +0200] X.X.X.X - - - XXXXX hostX to: 127.0.0.1:6081: GET XXXXXXXXXXX HTTP/1.1 200 upstream_response_time 0.004 msec 1596406111.635 request_time 0.004
как вы можете видеть, когда запрос получает правильный ответ, в журналах написано "hostX to: 127.0.1.1:6081" или "hostX to: 127.0.0.1:6081"
при получении неправильного ответа на запрос мы видим в логах: "hostX to: varnish"
У вас есть идеи, что может быть не так