nginx 负载均衡

陆佃

关注

阅读 217

2022-08-02


示例:

#配置nginx 负载均衡
upstream www.hello.com {
server 127.0.0.1:8081 weight=1;
server 127.0.0.1:8082 weight=2;
}

#server配置
server {
listen 80;
server_name www.hello.com;

location / {
#重点是这里 和上边的域名一样
proxy_pass http://www.hello.com;
proxy_redirect default;
}
}

网址访问:​​http://www.hello.com/examples/index2.html​​

8081出现一次

8082出现俩次

 

精彩评论(0)

0 0 举报