nginx 配置负载均衡

主要代码
proxy_pass http://upstream_name;
proxy_set_header Host $host;
upstream_name****名字可以自定义要和http://**对应上
upstream upstream_name{
server 120.55.101.185:7777;
server 123.57.151.153:8080;
}


upstream upstream_name{
        server 120.55.101.185:7777;
        server 123.57.151.153:8080;
    }
    server {
        listen       8086;
        listen       127.0.0.1;
        server_name  127.0.0.1  alias  another.alias;
        location / {#
            root   html;
            index  index.html index.htm;
			 proxy_pass http://upstream_name;
			proxy_set_header Host $host;
        }
    }

你可能感兴趣的:(nginx,负载均衡,服务器)