WishMeLz

生活其实很有趣

Nginx 负载均衡

轮询:
upstream  dalaoyang-server {
        server    localhost:11000;
        server    localhost:11001;
        server    localhost:11002;
    }

权重:
upstream  dalaoyang-server {
       server    localhost:10001 weight=1;
       server    localhost:10002 weight=2;
}

worker_processes  1;

events {
    worker_connections  1024;
}


http {
   upstream  dalaoyang-server {
       server    localhost:11000;
       server    localhost:11001;
       server    localhost:11002;
   }

   server {
       listen       10000;
       server_name  localhost;

       location / {
        proxy_pass http://dalaoyang-server;
        proxy_redirect default;
      }

    }

}