
#user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream mysvr { #weigth参数表示权值,权值越高被分配到的几率越大 server 192.168.1.117:8080 weight=1;#配置Tomcat地址 server 192.168.1.117:8081 weight=3; server 192.168.1.117:8082 weight=3; } server { listen 80; server_name mysvr; location / { proxy_pass http://mysvr; #与upstream 这里的名字要一样mysvr index helloworld.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
多余部分删除了,主要是配置
upstream 和proxy_pass
如果没有安装NGINX参考 NGINX安装文章来源: NGINX负载均衡配置
人吐槽 | 人点赞 |
发表评论