一、上游服务器组配置
1. 公共基础服务集群
监听端口:8090
权重说明:可通过weight参数设置各节点权重,若不配置则默认采用同等权重。
nginx
upstream base {
server 10.238.177.144:8090 weight=3;
server 10.238.177.144:8090 weight=2;
}
2. 应用A集群
监听端口:8089
nginx
upstream appA{
server 10.238.177.144:8089;
server 10.238.177.144:8089;
}
3. q前端端静态页面集群
监听端口:8090
nginx
upstream ebank {
server 10.238.177.119:8090;
server 10.238.177.56:8090;
}
二、反向代理路由配置
nginx
location /base{
proxy_pass http://base;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 120;
}
location /appA {
proxy_pass http://appA;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 120;
}
location /dist {
proxy_pass http://ebank;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 120;
}
location /egate {
proxy_pass http://base;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 120;
}
三、网银端相关配置说明
1. 请求转发逻辑
- 当访问
10.238.177.119:8090/dist时,Nginx 将请求转发至上游ebank集群。 - 集群中的每台 Web 服务器接收到
/dist请求后,需返回本机存储的静态文件。 - 前端静态文件访问后端接口时,统一调用 Nginx 服务地址
10.238.177.119:8090/egate/xxx,该请求会经 Nginx 转发至后端egate服务。 - 请求到达
egate后,由统一登录平台进行服务路由与转发。
2. WebNet 静态文件配置
nginx
location /dist {
root /home/bes/tpa/webnet-ebak/html;
}