一、nginx负载均衡与反选代理的区别?
答:我觉得没什么区别,一台就叫反向代理,多台就叫负载均衡,它们相结合使用
二、nginx 负载均衡原理
三、配置nginx负载均衡
修改nginx.conf
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream backend { (backend:集群模块) server 172.16.1.7:80 weight=1; (地址池) server 172.16.1.8:80 weight=1; (地址池) } server { listen 80; server_name blog.etiantian.org; location / { proxy_pass http://backend; (调用集群模块) proxy_set_header Host $host; (带主机头请求后端集群) } } server { listen 80; server_name bbs.etiantian.org; location / { proxy_pass http://backend; proxy_set_header Host $host; } } server { listen 80; server_name www.etiantian.org; location / { proxy_pass http://backend; proxy_set_header Host $host; } } }
时间: 2024-11-05 20:33:57