nginx+tomcat集群方法

下载地址:wget http://nginx.org/download/nginx-1.16.1.tar.gz

解压:tar -zxvf 

预编译

nginx+tomcat集群方法:

在server前加入#服务器组

#动态服务器组
upstream wangxy.xyz{
server 192.168.1.209:8080;
server 192.168.1.104:8080;

}

在location后面加入#反向代理

#其他页面反向代理到tomcat容器中

location ~ .*$ {
#index index.jsp index.html;
proxy_pass http://wangxy.xyz;
proxy_set_header Host $host:$server_port;
}

关闭nginx

./nginx -s -stop

重启nginx

./nginx 

猜你喜欢

转载自www.cnblogs.com/Dreamsoft/p/12404662.html