1.负载均衡策略
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
upstream httpds{
server 127.0.0.1:8081 weight=8 down;
server 127.0.0.1:8082 weight=2 ;
server 127.0.0.1:8083 weight=1 backup;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http:
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8081;
server_name localhost;
location / {
root html/dist8081;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8082;
server_name localhost;
location / {
root html/dist8082;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
1. 权重:weight
2. 上下线:down
4. 备用机:backup