nginx负载均衡

第一步:设置服务器组

  upstream backend{
    #weight为权重,不设置默认为轮询 server 192
.168.98.92:8081 weight=5; server 192.168.98.100:8081 weight=5; server 192.168.98.98:8081 weight=1; }

第二步:设置反向代理后端服务器

server{
  listen 80;
  server_name cx.com;
  index index.html index.php;
  location / {
    proxy_pass http://backend;
    proxy_set_header Host $host;   } }

 

posted @ 2018-04-22 09:24  山上小和尚  阅读(357)  评论(0编辑  收藏  举报