Nginx负载均衡简单一二

    为了满足业务高可用,网上搜了下Nginx的负载均衡,直接上配置文件,感谢的技术支持twemoji-1f60f

upstream v_url {
    server 172.16.55.86:8080;
    server 172.16.55.86:8180;
    server 172.16.55.87:8080;
    server 172.16.55.89:8080 backup;
}

server {
    listen       8008;
    server_name bx.laomm.com;
    location / {
    index index.jsp;
    proxy_http_version 1.1;
    proxy_pass  http://v_url;
    proxy_redirect    off;
    proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header  HTTP_XIP  $remote_addr;
    proxy_set_header  Host $http_host;
    proxy_set_header  Accept-Encoding 'gzip,deflate';
        }
    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;
    error_page 404 /404.html;
        location = /40x.html {
    }
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

}

    简单能满足业务需要即可,前置就一台Nginx,也没什么压力,放在阿里云上,万年不重启,所以前置Nginx多活没鼓捣。

搜索