美文网首页
nginx 负载均衡配置

nginx 负载均衡配置

作者: 炒面Z | 来源:发表于2021-03-29 17:50 被阅读0次
    server {
       .........
    
       location  /admin-api{
            rewrite  ^/admin-api/(.*)$ /$1 break;
            client_max_body_size 20M;
            proxy_read_timeout 40;  # 秒
            proxy_pass http://admin-api;
            proxy_cookie_path / /admin-api;
            proxy_set_header Host $host;
            add_header Nginx-Res "http://admin-api";
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    
    }
    
    # admin-api 负载均衡
    upstream admin-api{
      server IP1:PORT weight=1;
      server IP2:PORT weight=1;
    }
    

    相关文章

      网友评论

          本文标题:nginx 负载均衡配置

          本文链接:https://www.haomeiwen.com/subject/zsnbhltx.html