# 将 /opt/ecmc/ 下的 pub 目录,打个包
cd /opt/ecmc/ && tar czvf ecmc.pub.tar.gz pub
# 在已经在用的 nginx 机器上,创建 /home/ecmc/ 目录
mkdir -p /home/ecmc
# 修改 /home/ecmc 所有者
# 当然,这个要看nginx实际用哪个账号跑的,以nginx账号为例
chown nginx:nginx /home/ecmc
# 将 ecmc.pub.tar.gz 放到已经在用的 nginx 机器上,解压到 /home/ecmc 目录下
tar zxvf ecmc.pub.tar.gz -C /home/ecmc
# 参考以下配置,修改现有的 nginx 配置文件
upstream ecmc.monapi {
server ip1:7910;
server ip2:7910;
keepalive 10;
}
upstream ecmc.index {
server ip1:7904;
server ip2:7904;
keepalive 10;
}
upstream ecmc.transfer {
server ip1:7900;
server ip2:7900;
keepalive 10;
}
upstream ecmc.job {
server ip1:7970;
server ip2:7970;
keepalive 10;
}
upstream ecmc.hsp {
server ip1:7980;
server ip2:7980;
keepalive 10;
}
upstream ecmc.uic {
server ip1:7990;
server ip2:7990;
keepalive 10;
}
server {
listen 80 default_server;
server_name ecmc.example.com;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location =/ {
rewrite / /mon;
}
location /uic {
root /home/ecmc/pub;
index index.html;
try_files $uri /uic/index.html;
}
location /hsp {
root /home/ecmc/pub;
index index.html;
try_files $uri /hsp/index.html;
}
location /job {
root /home/ecmc/pub;
index index.html;
try_files $uri /job/index.html;
}
location /mon {
root /home/ecmc/pub;
index index.html;
try_files $uri /mon/index.html;
}
location /api/uic {
proxy_pass http://ecmc.uic;
}
location /v1/uic {
proxy_pass http://ecmc.uic;
}
location /api/hsp {
proxy_pass http://ecmc.hsp;
}
location /v1/hsp {
proxy_pass http://ecmc.hsp;
}
location /api/job {
proxy_pass http://ecmc.job;
}
location /v1/job {
proxy_pass http://ecmc.job;
}
location /api/mon {
proxy_pass http://ecmc.monapi;
}
location /v1/mon {
proxy_pass http://ecmc.monapi;
}
location /api/index {
proxy_pass http://ecmc.index;
}
location /api/transfer {
proxy_pass http://ecmc.transfer;
}
}