book.rrbrr.com.conf 992 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. server
  2. {
  3. listen 80;
  4. server_name book.rrbrr.com;
  5. root /data/ai/frontend/build/h5;
  6. index index.html;
  7. # API 请求反向代理到后端
  8. location /api/ {
  9. proxy_pass http://127.0.0.1:3000;
  10. proxy_http_version 1.1;
  11. proxy_set_header Host $host;
  12. proxy_set_header X-Real-IP $remote_addr;
  13. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  14. }
  15. # 静态资源
  16. location ~ ^/uploads/(.*)$ {
  17. alias /data/ai/server/uploads/$1;
  18. expires 7d;
  19. add_header Cache-Control "public, immutable";
  20. }
  21. location ~ ^/audio/(.*)$ {
  22. alias /data/ai/audio/$1;
  23. expires 7d;
  24. add_header Cache-Control "public, immutable";
  25. }
  26. location ~ .*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  27. expires 1y;
  28. add_header Cache-Control "public, immutable";
  29. }
  30. # 其他路由 - Vue SPA fallback
  31. location / {
  32. try_files $uri $uri/ /index.html;
  33. }
  34. }