nginx的负载均衡配置
nginx.conf:
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; ########指定转给哪个服务器########## upstream mynginx { server node3:8080; server node4:8080; } server { listen 80; server_name localhost; location / { #########反向代理出去,要和upstream 后的地址一样##### proxy_pass http://mynginx/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
upstream mynginx {
server node3:8080;
server node4:8080;
}
对应:
location / {
proxy_pass http://mynginx/;
}
阿里云服务器:最高¥2000云产品通用代金券领取:
https://www.aliyun.com/minisite/goods?userCode=3ls0qk0b