方向代理:
修改nginx的配置文件
upstream tomcatS{
server http://144.34.134.37:8080;
server http://144.34.134.37:8081
}
server {
listen 88;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass tomcatS;
index index.html index.htm;
}
}
负载均衡:
添加权重weight,默认为1,越高处理的越多
upstream tomcatS{
server http://144.34.134.37:8080 weight=2;
server http://144.34.134.37:8081;
}
server {
listen 88;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass tomcatS;
index index.html index.htm;
}
}