一个简单的负载均衡案例,很好很强大
upstream backend {
server 127.0.0.1:9011 weight=2 max_fails=3 fail_timeout=30s;
server 127.0.0.1:9012 weight=2 max_fails=3 fail_timeout=30s;
}
server {
listen 9000;
location / {
proxy_pass http://backend;
proxy_redirect off;
proxy_set_header Host $host:9000;
proxy_set_header X-Real-IP $remote_addr;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
}