1. # 将 /opt/ecmc/ 下的 pub 目录,打个包
    2. cd /opt/ecmc/ && tar czvf ecmc.pub.tar.gz pub
    3. # 在已经在用的 nginx 机器上,创建 /home/ecmc/ 目录
    4. mkdir -p /home/ecmc
    5. # 修改 /home/ecmc 所有者
    6. # 当然,这个要看nginx实际用哪个账号跑的,以nginx账号为例
    7. chown nginx:nginx /home/ecmc
    8. # 将 ecmc.pub.tar.gz 放到已经在用的 nginx 机器上,解压到 /home/ecmc 目录下
    9. tar zxvf ecmc.pub.tar.gz -C /home/ecmc
    10. # 参考以下配置,修改现有的 nginx 配置文件
    1. upstream ecmc.monapi {
    2. server ip1:7910;
    3. server ip2:7910;
    4. keepalive 10;
    5. }
    6. upstream ecmc.index {
    7. server ip1:7904;
    8. server ip2:7904;
    9. keepalive 10;
    10. }
    11. upstream ecmc.transfer {
    12. server ip1:7900;
    13. server ip2:7900;
    14. keepalive 10;
    15. }
    16. upstream ecmc.job {
    17. server ip1:7970;
    18. server ip2:7970;
    19. keepalive 10;
    20. }
    21. upstream ecmc.hsp {
    22. server ip1:7980;
    23. server ip2:7980;
    24. keepalive 10;
    25. }
    26. upstream ecmc.uic {
    27. server ip1:7990;
    28. server ip2:7990;
    29. keepalive 10;
    30. }
    31. server {
    32. listen 80 default_server;
    33. server_name ecmc.example.com;
    34. root /usr/share/nginx/html;
    35. # Load configuration files for the default server block.
    36. include /etc/nginx/default.d/*.conf;
    37. location =/ {
    38. rewrite / /mon;
    39. }
    40. location /uic {
    41. root /home/ecmc/pub;
    42. index index.html;
    43. try_files $uri /uic/index.html;
    44. }
    45. location /hsp {
    46. root /home/ecmc/pub;
    47. index index.html;
    48. try_files $uri /hsp/index.html;
    49. }
    50. location /job {
    51. root /home/ecmc/pub;
    52. index index.html;
    53. try_files $uri /job/index.html;
    54. }
    55. location /mon {
    56. root /home/ecmc/pub;
    57. index index.html;
    58. try_files $uri /mon/index.html;
    59. }
    60. location /api/uic {
    61. proxy_pass http://ecmc.uic;
    62. }
    63. location /v1/uic {
    64. proxy_pass http://ecmc.uic;
    65. }
    66. location /api/hsp {
    67. proxy_pass http://ecmc.hsp;
    68. }
    69. location /v1/hsp {
    70. proxy_pass http://ecmc.hsp;
    71. }
    72. location /api/job {
    73. proxy_pass http://ecmc.job;
    74. }
    75. location /v1/job {
    76. proxy_pass http://ecmc.job;
    77. }
    78. location /api/mon {
    79. proxy_pass http://ecmc.monapi;
    80. }
    81. location /v1/mon {
    82. proxy_pass http://ecmc.monapi;
    83. }
    84. location /api/index {
    85. proxy_pass http://ecmc.index;
    86. }
    87. location /api/transfer {
    88. proxy_pass http://ecmc.transfer;
    89. }
    90. }