这里拿Nginx和之前做的Tomcat 多实例来实现tomcat负载均衡
1.准备多实例与nginx
tomcat单机多实例部署-CSDN博客
2.配置nginx做负载均衡
upstream tomcat{
server 192.168.60.11:8081;
server 192.168.60.11:8082;
server 192.168.60.11:8083;}
server {
listen 80;
server_name localhost;#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.php index.html index.htm;
proxy_pass http://tomcat;
}
3.测试
配置成功!