nginx 負載均衡

nginx能夠實例負載均衡。html

  1. 準備工做
    操做系統:歐拉2.8 arm
    ecs-cecd-0002:192.168.0.141 #Nginx服務器
    ecs-cecd-0001:192.168.0.8 #Web服務器
    ecs-cecd-0003:192.168.0.92 #Web服務器nginx

  2. 配置web訪問
    在ecs-cecd-0001與ecs-cecd-0003上安裝httpd:
    yum install -y httpd
    在ecs-cecd-0001:
    echo 001 >> /var/www/html/index.html
    在ecs-cecd-0003:
    echo 003 >> /var/www/html/index.html
    在ecs-cecd-0001與ecs-cecd-0003啓動httpd:
    chmod 755 /var/www/html/index.html
    systemctl start httpdweb

  3. 配置nginx負載均衡
    在ecs-cecd-0002:
    yum install -y nginx
    在/etc/nginx/nginx.conf輸入如下內容:wq保存退出:
    nginx 負載均衡

systemctl start nginx服務器

  1. 驗證配置
    在ecs-cecd-0001:
    echo "192.168.0.141 tests" >> /etc/hosts
    在ecs-cecd-0002:
    echo "192.168.0.141 tests" >> /etc/hosts
    在ecs-cecd-0003:
    echo "192.168.0.141 tests" >> /etc/hosts
    nginx 負載均衡

nginx 負載均衡

nginx 負載均衡

相關文章
相關標籤/搜索