nginx.conf 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # nginx.conf
  2. worker_processes 5;
  3. events {
  4. worker_connections 1024;
  5. }
  6. http {
  7. include mime.types;
  8. default_type application/octet-stream;
  9. client_max_body_size 200m;
  10. sendfile on;
  11. keepalive_timeout 65;
  12. server {
  13. listen 80; # 容器内端口
  14. server_name localhost;
  15. # 前端静态资源目录(对应容器内的 /usr/share/nginx/html)
  16. root /usr/share/nginx/html;
  17. index index.html;
  18. # 关键:处理 VUE Router history 模式(避免刷新 404)
  19. location / {
  20. try_files $uri $uri/ /index.html; # 所有路由指向 index.html
  21. }
  22. # 反向代理 - fs-company(8006) 租户服务端API
  23. # 以下路径前缀只有fs-company有Controller,需代理到8006
  24. location /prod-api/adv/ {
  25. proxy_pass http://192.168.58.159:8006/adv/;
  26. proxy_set_header Host $host;
  27. proxy_set_header X-Real-IP $remote_addr;
  28. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  29. proxy_set_header X-Forwarded-Proto $scheme;
  30. }
  31. location /prod-api/aicall/ {
  32. proxy_pass http://192.168.58.159:8006/aicall/;
  33. proxy_set_header Host $host;
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  36. proxy_set_header X-Forwarded-Proto $scheme;
  37. }
  38. location /prod-api/common/ {
  39. proxy_pass http://192.168.58.159:8006/common/;
  40. proxy_set_header Host $host;
  41. proxy_set_header X-Real-IP $remote_addr;
  42. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  43. proxy_set_header X-Forwarded-Proto $scheme;
  44. }
  45. location /prod-api/company/ {
  46. proxy_pass http://192.168.58.159:8006/company/;
  47. proxy_set_header Host $host;
  48. proxy_set_header X-Real-IP $remote_addr;
  49. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  50. proxy_set_header X-Forwarded-Proto $scheme;
  51. }
  52. location /prod-api/companyWorkflow/ {
  53. proxy_pass http://192.168.58.159:8006/companyWorkflow/;
  54. proxy_set_header Host $host;
  55. proxy_set_header X-Real-IP $remote_addr;
  56. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  57. proxy_set_header X-Forwarded-Proto $scheme;
  58. }
  59. location /prod-api/qwAssignRule/ {
  60. proxy_pass http://192.168.58.159:8006/qwAssignRule/;
  61. proxy_set_header Host $host;
  62. proxy_set_header X-Real-IP $remote_addr;
  63. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  64. proxy_set_header X-Forwarded-Proto $scheme;
  65. }
  66. location /prod-api/qwCustomerLink/ {
  67. proxy_pass http://192.168.58.159:8006/qwCustomerLink/;
  68. proxy_set_header Host $host;
  69. proxy_set_header X-Real-IP $remote_addr;
  70. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  71. proxy_set_header X-Forwarded-Proto $scheme;
  72. }
  73. location /prod-api/qwGroupActual/ {
  74. proxy_pass http://192.168.58.159:8006/qwGroupActual/;
  75. proxy_set_header Host $host;
  76. proxy_set_header X-Real-IP $remote_addr;
  77. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  78. proxy_set_header X-Forwarded-Proto $scheme;
  79. }
  80. location /prod-api/qwGroupLiveCode/ {
  81. proxy_pass http://192.168.58.159:8006/qwGroupLiveCode/;
  82. proxy_set_header Host $host;
  83. proxy_set_header X-Real-IP $remote_addr;
  84. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  85. proxy_set_header X-Forwarded-Proto $scheme;
  86. }
  87. location /prod-api/shop/ {
  88. proxy_pass http://192.168.58.159:8006/shop/;
  89. proxy_set_header Host $host;
  90. proxy_set_header X-Real-IP $remote_addr;
  91. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  92. proxy_set_header X-Forwarded-Proto $scheme;
  93. }
  94. location /prod-api/workflow/ {
  95. proxy_pass http://192.168.58.159:8006/workflow/;
  96. proxy_set_header Host $host;
  97. proxy_set_header X-Real-IP $remote_addr;
  98. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  99. proxy_set_header X-Forwarded-Proto $scheme;
  100. }
  101. # 关键:反向代理 API(默认代理到 fs-admin 平台管理端)
  102. location /prod-api/ {
  103. proxy_pass http://192.168.58.159:7772/; # fs-admin 后端 API 地址(末尾加 / 避免路径拼接问题)
  104. proxy_set_header Host $host;
  105. proxy_set_header X-Real-IP $remote_addr;
  106. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  107. proxy_set_header X-Forwarded-Proto $scheme; # 传递 HTTPS 协议
  108. }
  109. }
  110. }