在負載平衡器伺服器中,我已經配置了這些內容/etc/nginx/conf.d/load-balancer.conf

在負載平衡器伺服器中,我已經配置了這些內容/etc/nginx/conf.d/load-balancer.conf

這是我的 3 台伺服器。

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

在負載平衡器伺服器中,我已經配置了這些內容/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;
  }
}

在 server-01 中,我已經配置了這個東西/usr/share/nginx/html/index.html

cat index.html
This is server-01

在 server-02 中,我已經配置了這個東西/usr/share/nginx/html/index.html

cat index.html
This is server-02

問題

配置成功。但是當我,我得到空響應(這是負載平衡器curl localhost:80的內容。)/usr/share/nginx/html

這裡有什麼問題以及如何解決它。我懷疑這與DNS有關。但我不知道該如何解決這個問題?

我添加了

192.168.1.72 localhost

/etc/hosts負載平衡器伺服器。

我該如何解決這個問題?

相關內容