1.在nginx的conf目录新建一个***.conf,配置如下
upstream tomcat_server{
#配置多个tomcat的ip和端口号 weight权重
server 127.0.0.1:8086;
server 127.0.0.1:8087;
}
server {
listen 80;
server_name www.***.com;
location / {
proxy_pass http://tomcat_server;
index index.html index.htm;
}
}
2.在nginx.conf引入***.conf
include ***.conf;
3.修改本地host文件
127.0.0.1 www.***.com
4.启动nginx,访问www.***.com即可。