nginx反向代理和负载均衡的区别

1、反向代理,不需要服务器池,直接代理某台服务器

复制代码
location / {
        proxy_pass      http://192.168.18.201;
        proxy_set_header Host  $host;
                  proxy_set_header X-Forwarded-For $remote_addr;
}
 proxy_set_header Host  $host;                                      nginx请求地址池时带着客户端请求的主机头
proxy_set_header X-Forwarded-For $remote_addr;      负载均衡器开启ip转发,将客户端ip映射到web服务器

2、负载均衡,后端有服务器池upstream

复制代码
upstream webservers {
      server 192.168.18.201 weight=1;
      server 192.168.18.202 weight=1;

location / {
              proxy_pass      http://webservers;
              proxy_set_header Host  $host;
                               proxy_set_header X-Forwarded-For $remote_addr;
      }
相关推荐
码农101号27 分钟前
Linux中shell编程表达式和数组讲解
linux·运维·服务器
powerfulzyh40 分钟前
非Root用户启动SSH服务经验小结
运维·ssh
云道轩1 小时前
升级centos 7.9内核到 5.4.x
linux·运维·centos
爱学习的小道长1 小时前
Ubuntu Cursor升级成v1.0
linux·运维·ubuntu
EelBarb1 小时前
seafile:ubuntu搭建社区版seafile12.0
linux·运维·ubuntu
402 Payment Required1 小时前
serv00 ssh登录保活脚本-邮件通知版
运维·chrome·ssh
小柏ぁ1 小时前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
Mintimate2 小时前
云服务器 Linux 手动 DD 安装第三方 Linux 发行版:原理与实战
linux·运维·服务器
RussellFans2 小时前
Linux 环境配置
linux·运维·服务器
高冷的肌肉码喽3 小时前
Linux-进程间的通信
linux·运维·服务器