工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.wdlinux.cn 注册 | 登陆

nginx.conf负载均衡

 upstream nginx{

server 192.168.1.10:88 weight=3;
server 192.168.1.11:80 weight=10;
ip_hash;
}
 
server{ 
 listen 80; 
 server_name nginx.test.wdlinux.cn;
 location / { 
 index index.html; 
 root /usr/html; 
 proxy_pass http://nginx;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}
 
 
# hash $cookie_jsessionid;
 hash $remote_addr consistent;
 server 192.168.142.128:8080 weight=3;
 server 192.168.142.129:80 weight=10;
# hash $cookie_jsessionid;
# server 192.168.142.130:80;
# ip_hash;
# hash_again 1;
# consistent_hash $remote_addr:可以根据客户端ip映射
# consistent_hash $request_uri: 根据客户端请求的uri映射
# consistent_hash $args:根据客户端携带的参数进行映射

« 上一篇 | 下一篇 »

Trackbacks

点击获得Trackback地址,Encode: UTF-8

发表评论

评论内容 (必填):