首页 > 其他 > 详细

nginx 负载均衡

时间:2020-08-03 09:47:51      阅读:82      评论:0      收藏:0      [点我收藏+]
nginx可以实例负载均衡。

  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服务器

  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 httpd

  3. 配置nginx负载均衡
    在ecs-cecd-0002:
    yum install -y nginx
    在/etc/nginx/nginx.conf输入以下内容:wq保存退出:
    技术分享图片

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 负载均衡

原文:https://blog.51cto.com/4708948/2516029

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!