标签:
nginx config解析
/usr/local/nginx/conf/conf.conf
user nobody
worker_process 4;#四个进程
events{
worker_connection 1024;
}
http{
upstram mypro{
ip_hash;#代表同一个用户所有操作都在同一台服务器
server ip1:port weight=2;
server ip2:port;#默认weight=1
}
#监听端口,负载访问地址
server{
listen 80;
location / {
proxy_pass http://mypro
}
}
}
nginx指令
ip_hash
通过hash算法指定同一个用户只能访问同一台服务器
server指令
指定服务器ip地址及权重,权重越大,访问概率越高
默认负载均衡方式为轮询
标签:
原文地址:http://my.oschina.net/chworld/blog/524435