Nginx load balancing personal understanding

Nginx load balancing is to distribute requests to multiple servers,
through the Nginx configuration:


# 这样会随机让一台服务器为浏览器请求服务
upstream load_balancing {
server 第一台服务器地址;
server 第二台服务器地址;
}

location /index/ {
proxy_pass http://load_balancing/;      # 监听浏览器访问index页面的时候 重定向到 load_balancing中
}

Such as:

At this time we use gin to start two servers.

You can see that using the browser to access the local ip, the

two servers serve the browser randomly, and
nginx can achieve load balancing in this way.

Guess you like

Origin www.cnblogs.com/tnan/p/12674957.html