Nginx负载均衡

以宝塔举例:

点击网站->配置文件:

upstream photo.zyxweb.cn{
    server 127.0.0.1:9000 weight=3;  // 本地既是负载均衡器也是服务器 权重为3,所有权重是6也就是六次有三次连接到这个服务器
    server america.zyxweb.cn weight=2;   
    server wlcb.zyxweb.cn:29761 weight=1;
}



server
{
    listen 80;
    server_name photo.zyxweb.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/photo.zyxweb.cn;
    location / {   // 这段是要加的,其他不用动
      
      proxy_pass http://$host;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

......

}

 

上一篇 使用Psexec命令行连接另一台计算机
下一篇 Python-封禁RDP攻击IP
ZYX

ZYX管理员

无论你遇见谁他都是你生命中该出现的 绝非偶然

本月创作热力图

目录
文章列表
1 Linux-网络调试和进程管理
Linux-网络调试和进程管理
2
windows桌面美化
windows桌面美化
3
Kali工具使用
Kali工具使用
4
使用VMware安装黑苹果
使用VMware安装黑苹果
5
Nginx负载均衡
Nginx负载均衡