Answer the question
In order to leave comments, you need to log in
Why is load balancing not working in nginx?
The first time I work with distribution, here is the config. It listens to 2 different ports and in response gives the server number: 1 or 2. But it connects either always only to the first one, or only to the second one. And as far as I understand, according to the standard, it works in round-robin, and therefore it must alternate answers (1,2,1,2,1 ...). What's wrong?
upstream backends {
server localhost:3222;
server localhost:3221;
}
server {
listen 443 ssl;
ssl_certificate /etc/ssl/site.crt;
ssl_certificate_key /etc/ssl/site.key;
server_name site.xyz www.site.xyz;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://backends/;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question