nginx.conf 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. server {
  2. listen 80;
  3. server_name _;
  4. # Admin UI
  5. location /admin/ {
  6. alias /usr/share/nginx/admin/;
  7. try_files $uri $uri/ /admin/index.html;
  8. add_header Cache-Control "no-cache, no-store, must-revalidate";
  9. add_header Pragma "no-cache";
  10. add_header Expires "0";
  11. }
  12. # Builder UI
  13. location /builder/ {
  14. alias /usr/share/nginx/builder/;
  15. try_files $uri $uri/ /builder/index.html;
  16. }
  17. # Chat UI
  18. location /chat/ {
  19. alias /usr/share/nginx/chat/;
  20. try_files $uri $uri/ /chat/index.html;
  21. }
  22. # Backend API
  23. location /admin/api/ {
  24. proxy_pass http://web:8080;
  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 /builder/api/ {
  31. proxy_pass http://web:8080;
  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 /chat/api/ {
  38. proxy_pass http://web:8080;
  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. # Static files
  45. location /doc/ {
  46. proxy_pass http://web:8080;
  47. }
  48. location /schema/ {
  49. proxy_pass http://web:8080;
  50. }
  51. location /static/ {
  52. proxy_pass http://web:8080;
  53. }
  54. # OpenAI 兼容网关
  55. location /api/v1/ {
  56. proxy_pass http://web:8080;
  57. proxy_set_header Host $host;
  58. proxy_set_header X-Real-IP $remote_addr;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. proxy_set_header X-Forwarded-Proto $scheme;
  61. proxy_buffering off;
  62. proxy_cache off;
  63. chunked_transfer_encoding off;
  64. }
  65. # OSS files
  66. location ~ ^/(admin|builder|chat)/oss/ {
  67. proxy_pass http://web:8080;
  68. }
  69. # Default redirect to admin
  70. location / {
  71. return 302 /admin/;
  72. }
  73. }