400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

Nginx_upstream

Nginx_upstream 负载均衡&高可用

负载均衡调度算法:

upstream duanserver {
    server 192.168.4.41:80 weight=1 max_fails=3 fail_timeout=10s;
    server 192.168.4.42:80 weight=2 max_fails=3 fail_timeout=10s;
}

server {
    listen       80;
    server_name  www.xxx.com;
    root         /usr/local/nginx/html;
    
    location / {
        root   html;
        index  index.html index.htm;
        proxy_pass  http://duanserver;
        #后端服务出现以下错误情况,实现故障转移(可自动切走 & 切回);
        proxy_next_upstream http_403 http_404 http_500 http_502 http_503 error timeout invalid_header;
        include     /usr/local/nginx/conf/proxy.conf;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

Any question, please contact me!


标题名称:Nginx_upstream
标题URL:http://mbwzsj.com/article/gjgiio.html

其他资讯

让你的专属顾问为你服务