**
nginx实现简单的负载均衡
**
上手前需要准备:
-
两个tomcat(可以在linux多个运行)
-
两个简单的war包
-
nginx(需要安装好nginx)
步骤:
-
首先我们需要修改tomcat端口号并启动,使其可以在linux上多个运行。
具体博文请见:
https://blog.csdn.net/qq_42448476/article/details/90319947
-
其次进入到nginx的配置文件nginx.conf,加上以下内容
保存:wq重启nginx
-
打开浏览器访问 http://你的虚拟机ip:nginx监听的端口/项目名
我的是http://192.168.10.151:8089/项目名
操作很简单,关键要懂其中的流程知道负载均衡的意义。