zoukankan      html  css  js  c++  java
  • nginx负载均衡

    第一步:下载nginx
    ╭─root@zxw ~
    ╰─➤ yum install nginx -y
    第二步:编写负载均衡规则
    ─root@zxw ~
    ╰─➤ vim /etc/nginx/nginx.conf
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    upstream zhao {
    server 192.168.126.6 weight=6 max_fails=2 fail_timeout=2;
    server 192.168.126.7 weight=2 max_fails=2 fail_timeout=2;
    }
    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    proxy_pass http://zhao;
    }
    第三步:检查并重启
    ╭─root@zxw ~
    ╰─➤ nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    ╭─root@zxw ~
    ╰─➤ systemctl restart nginx

    访问网站

  • 相关阅读:
    后缀数组模板~~~
    CF 196 Div2 D&&HDU 4679 && HDU 2196
    .......
    ~~~~~
    主站点~~~~
    C++抽象,封装,继承,多态
    查缺补漏知识点(二)
    Qt的简介
    C语言指针及C++引用
    C++单例模式
  • 原文地址:https://www.cnblogs.com/itzhao/p/11249938.html
Copyright © 2011-2022 走看看