ngix

ngix是个反向代理服务器

能够使用Nginx搭建Tomcat集群,并完成负载均衡.

http://nginx.org/en/download.html 官网下载

稳定版

部署tomcat

修改配置文件tomcat1conf下的server.xml文件

安装nigix

解压即可

关闭nginx需要使用:

相当于找到nginx进程kill

nginx -s stop

重新加载配置文件:

nginx -s reload

可以不关闭nginx的情况下更新配置文件.

修改 ginx-1.8.0conf ginx.conf这个文件:

 

upstream server_lb{
        server 127.0.0.1:8081;  //weight = 10
        server 127.0.0.1:8082;  //weight = 2
    }
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            proxy_pass http://server_lb;
            index  index.html index.htm;
        }

 

保存中期启动nigix     nginx -s reload

修改公网为本地网址

 

 

 

原文地址:https://www.cnblogs.com/hudj/p/7427558.html