nginx.conf 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. server {
  2. listen 22000 ssl;
  3. # server_name aqai.shudaodsj.com;
  4. # SSL 证书配置
  5. ssl_certificate /etc/nginx/conf.d/ssl/shudaodsj.com.pem;
  6. ssl_certificate_key /etc/nginx/conf.d/ssl/shudaodsj.com.key;
  7. client_max_body_size 50M;
  8. # 安全:禁止访问敏感文件
  9. location ~ \.(zip|rar|tar|gz|bak|sql|env|git|log|ini|conf|md|txt)$ {
  10. deny all;
  11. return 404;
  12. }
  13. # ==================== 管理后台 ====================
  14. location /admin {
  15. alias /tmp/www/dist;
  16. try_files $uri $uri/ /admin/index.html;
  17. }
  18. location /admin/api/v1 {
  19. proxy_pass http://127.0.0.1:28000;
  20. proxy_set_header Host $host;
  21. proxy_set_header X-Real-IP $remote_addr;
  22. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  23. proxy_set_header X-Forwarded-Proto $scheme;
  24. }
  25. # ==================== 认证网关 (auth-server:28004) ====================
  26. # /auth/api/xxx -> http://127.0.0.1:28004/api/xxx
  27. location /auth/ {
  28. proxy_pass http://127.0.0.1:28004/;
  29. proxy_set_header Host $host;
  30. proxy_set_header X-Real-IP $remote_addr;
  31. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  32. proxy_set_header X-Forwarded-Proto $scheme;
  33. }
  34. # ==================== AI对话服务 (ReportGenerator:28002) ====================
  35. # /chatwithai/api/v1/xxx -> http://127.0.0.1:28002/api/v1/xxx
  36. location /chatwithai/ {
  37. proxy_pass http://127.0.0.1:28002/;
  38. proxy_set_header Host $host;
  39. proxy_set_header X-Real-IP $remote_addr;
  40. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  41. proxy_set_header X-Forwarded-Proto $scheme;
  42. # SSE 流式响应支持
  43. proxy_buffering off;
  44. proxy_cache off;
  45. proxy_http_version 1.1;
  46. proxy_read_timeout 3600s;
  47. proxy_send_timeout 3600s;
  48. }
  49. # ==================== 旧版认证接口 (兼容) ====================
  50. location /api/auth/login {
  51. proxy_pass http://127.0.0.1:28001;
  52. proxy_set_header Host $host;
  53. proxy_set_header X-Real-IP $remote_addr;
  54. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  55. proxy_set_header X-Forwarded-Proto $scheme;
  56. }
  57. location /api/auth/check-status {
  58. proxy_pass http://127.0.0.1:28001;
  59. proxy_set_header Host $host;
  60. proxy_set_header X-Real-IP $remote_addr;
  61. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  62. proxy_set_header X-Forwarded-Proto $scheme;
  63. }
  64. location /api/captcha/generate {
  65. proxy_pass http://127.0.0.1:28001;
  66. proxy_set_header Host $host;
  67. proxy_set_header X-Real-IP $remote_addr;
  68. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  69. proxy_set_header X-Forwarded-Proto $scheme;
  70. }
  71. # ==================== ChromaDB 向量搜索 (24000) ====================
  72. location /api/chroma/search {
  73. proxy_pass http://127.0.0.1:24000/api/search;
  74. proxy_set_header Host $host;
  75. proxy_set_header X-Real-IP $remote_addr;
  76. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  77. proxy_set_header X-Forwarded-Proto $scheme;
  78. }
  79. location /api/chroma/health {
  80. proxy_pass http://127.0.0.1:24000/api/health;
  81. proxy_set_header Host $host;
  82. proxy_set_header X-Real-IP $remote_addr;
  83. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  84. proxy_set_header X-Forwarded-Proto $scheme;
  85. }
  86. # ==================== TTS 语音合成 ====================
  87. location /tts/ {
  88. proxy_pass http://172.16.35.50:8000/tts/;
  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. # ==================== 系统后端 (shudao-go-backend:22001) ====================
  95. # 默认路由,所有未匹配的请求转发到系统后端
  96. location / {
  97. proxy_pass http://127.0.0.1:22001;
  98. proxy_set_header Host $host;
  99. proxy_set_header X-Real-IP $remote_addr;
  100. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  101. proxy_set_header X-Forwarded-Proto $scheme;
  102. # SSE 流式响应支持
  103. proxy_buffering off;
  104. proxy_cache off;
  105. proxy_http_version 1.1;
  106. proxy_read_timeout 3600s;
  107. proxy_send_timeout 3600s;
  108. }
  109. }