Nginx负载均衡使用ip
upstream test1{
server 192.168.1.213;
server 192.168.1.37;
}
server {
listen 80; # default backlog=2048;
# listen 443 default ssl;
# ssl on;
# ssl_certificate ./ssl2/server.crt;
# ssl_certificate_key ./ssl2/server.key;
server_name www.nginx2.com ;
# server_name www.ghj.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
# proxy_redirect off;
# proxy_pass https://www.taobao.com;
# root /var/www/html;
# index index.html index.htm index.php;
#转发头中包含ip和代理ip
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#不使用缓存
proxy_buffering off;
proxy_pass http://test1;
}