windows下nginx+tomcat模拟应用集群

在windows下,配置两个tomcat,使用nginx反向代理访问,模拟应用集群。怕忘记录下

下载地址:

nginx:https://pan.baidu.com/s/1okIaf9WI7dhWtIg2lOfY7Q 密码:2p13

tomcat:https://pan.baidu.com/s/16QRgRXBecuVIoo2-uogxUQ 密码:yvco

配置nginx

配置nginx\conf\nginx.conf

   upstream server_tomcat{ // 应用地址端口
		# ip_hash;
		server 127.0.0.1:8090 weight=2; // weight表示访问权重比例,越高访问此应用越多
		server 127.0.0.1:8080 weight=1;
	}
	
    server {
        listen       80; // 代理端口
        server_name  localhost; // 代理地址
	location ~ \.(js|css|html|jpg|gif|png|swf|flv|wma|wmv|asf|mp3|zip|mmf|rar)$ { // 静态文件缓存配置
		root E:\student\nginx\staticresource;
	}	
        location / {
            root   /cblock/; // 应用名称
            index  index.html index.htm;
	    proxy_pass http://server_tomcat; //对应上面应用地址
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 
    }

配置tomcat端口分别为8080,8090


打开浏览器访问80端口




猜你喜欢

转载自blog.csdn.net/czijun1990914/article/details/79971243
今日推荐