nginx.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. server {
  2. listen 22000 ssl;
  3. # server_name aqai.shudaodsj.com;
  4. # return 301 https://$host:22000$request_uri;
  5. # SSL 证书配置
  6. ssl_certificate /etc/nginx/conf.d/ssl/shudaodsj.com.pem;
  7. ssl_certificate_key /etc/nginx/conf.d/ssl/shudaodsj.com.key; # 私钥
  8. client_max_body_size 50M;
  9. # 推荐的 SSL 安全配置
  10. #ssl_protocols TLSv1.2 TLSv1.3;
  11. #ssl_ciphers ECDHE+AESGCM:DHE+AESGCM:AES256+EECDH:AES256+EDH;
  12. #ssl_prefer_server_ciphers off;
  13. #ssl_session_cache shared:SSL:10m;
  14. #ssl_session_timeout 10m;
  15. location ~ \.(zip|rar|tar|gz|bak|sql|env|git|log|ini|conf|md|txt)$ {
  16. deny all;
  17. return 404;
  18. }
  19. location /admin {
  20. alias /tmp/www/dist; # 替换为你的静态文件实际路径
  21. try_files $uri $uri/ /admin/index.html; # 支持前端路由(如 Vue Router history 模式)
  22. }
  23. location /admin/api/v1 {
  24. proxy_pass http://127.0.0.1:28000; # 替换为你后端服务的实际地址和端口
  25. proxy_set_header Host $host;
  26. proxy_set_header X-Real-IP $remote_addr;
  27. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  28. proxy_set_header X-Forwarded-Proto $scheme;
  29. }
  30. location /api/auth/login {
  31. proxy_pass http://127.0.0.1:28001; # 替换为你后端服务的实际地址和端口
  32. proxy_set_header Host $host;
  33. proxy_set_header X-Real-IP $remote_addr;
  34. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  35. proxy_set_header X-Forwarded-Proto $scheme;
  36. }
  37. location /api/auth/check-status {
  38. proxy_pass http://127.0.0.1:28001; # 替换为你后端服务的实际地址和端口
  39. proxy_set_header Host $host;
  40. proxy_set_header X-Real-IP $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. proxy_set_header X-Forwarded-Proto $scheme;
  43. }
  44. location /api/captcha/generate {
  45. proxy_pass http://127.0.0.1:28001; # 替换为你后端服务的实际地址和端口
  46. proxy_set_header Host $host;
  47. proxy_set_header X-Real-IP $remote_addr;
  48. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  49. proxy_set_header X-Forwarded-Proto $scheme;
  50. }
  51. # chroma 搜索接口
  52. location /api/chroma/search {
  53. proxy_pass http://127.0.0.1:24000/api/search; # 替换为你后端服务的实际地址和端口
  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. # chroma 心跳检测接口
  60. location /api/chroma/health {
  61. proxy_pass http://127.0.0.1:24000/api/health; # 替换为你后端服务的实际地址和端口
  62. proxy_set_header Host $host;
  63. proxy_set_header X-Real-IP $remote_addr;
  64. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  65. proxy_set_header X-Forwarded-Proto $scheme;
  66. }
  67. # TTS 接口
  68. location /tts/voice {
  69. proxy_pass http://172.16.35.50:8000/tts/voice;
  70. proxy_set_header Host $host;
  71. proxy_set_header X-Real-IP $remote_addr;
  72. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  73. proxy_set_header X-Forwarded-Proto $scheme;
  74. }
  75. location / {
  76. proxy_pass http://127.0.0.1:22001;
  77. proxy_set_header Host $host;
  78. proxy_set_header X-Real-IP $remote_addr;
  79. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  80. proxy_set_header X-Forwarded-Proto $scheme;
  81. # 关键:禁用代理缓冲,支持流式响应
  82. proxy_buffering off;
  83. proxy_cache off;
  84. proxy_http_version 1.1;
  85. # proxy_set_header Connection '';
  86. # chunked_transfer_encoding on;
  87. # 超时设置
  88. proxy_read_timeout 3600s;
  89. proxy_send_timeout 3600s;
  90. }
  91. }