nginx负载均衡

进入nginx目录:

nginx负载均衡

进入:conf配置文件目录:

nginx负载均衡

通过配置nginx.conf文件来实现负载均衡:

nginx负载均衡


如果想让哪台服务器配置得多一些,可以用weight属性。

nginx负载均衡

已上面为例:

默认是1,就是说server localhost:8081;的weight属性=1.

server localhost:8082 weight=2;的话,那么nginx分配给localhost:8082的数量就会比localhost:8081要多了。