ngnix负载均衡最简配置

in 笔记 with 0 comment
upstream tomcat_nginx_test{
    server 127.0.0.1:8081 weight=1;
    server 127.0.0.1:8082 weight=2;
}

server
{
    #监听端口
    listen 80;
    #监听的请求域名
    server_name localhost;

    location / {
    #反向代理 将所有请求反向代理到8111端口,最好在后面加一个/
    proxy_pass "https://localhost:8111/";
    }
    location /test{
    proxy_pass "https://tomcat_nginx_test/bz_web_backend/";
    }
}
Responses