Score:1

Load Balancer Server Accessible in Browser But not via `curl localhost`

qa flag

These are my 3 servers.

Load Balancer-192.168.1.72
Server-01-192.168.1.79
Server-02-192.168.1.80

In Load Balancer Server, I've configured these things in /etc/nginx/conf.d/load-balancer.conf

upstream backend{
  server 192.168.1.79:80;
  server 192.168.1.80:80;
}

server {
  listen 80;
  server_name localhost;
  
  location / {
  proxy_pass http://backend;
  }
}

In server-01, I've configured this thing in /usr/share/nginx/html/index.html

cat index.html
This is server-01

In server-02, I've configured this thing in /usr/share/nginx/html/index.html

cat index.html
This is server-02

The problem

The configuration is successful. But when I curl localhost:80 , I am getting empty response(which is the content at /usr/share/nginx/html for load-balancer.)

What's the issue here and how can I resolve it. I suspect it's something related to DNS. But I'm not aware how I fix this issue?

I added

192.168.1.72 localhost

to /etc/hosts of load-balancer server.

How do I solve this issue?

br flag
Do you have other configs in `/etc/nginx/conf.d` or `/etc/nginx/sites-enabled`?
achhainsan avatar
qa flag
No, I only have `load-balancer.conf` in that place.
achhainsan avatar
qa flag
The issue is fixed once I changed server_name to something else, But I don't know why it fixed that.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.