homelegance-chat.conf 1.4 KB

12345678910111213141516171819202122232425262728
  1. # Homelegance Chatbot — Apache 配置片段
  2. # 将以下内容添加到 www.homelegance.com 的 <VirtualHost *:443> 块内
  3. # 文件位于:/etc/httpd/conf.d/homelegance.com.conf(或对应的主站配置文件)
  4. # 修改后执行:sudo systemctl reload httpd
  5. #
  6. # 所需模块(通常已启用):
  7. # mod_proxy, mod_proxy_http, mod_rewrite, mod_alias
  8. # ── Chatbot API:代理到 Node.js :3000 ────────────────────────────────────────
  9. # ProxyPass 必须在 Alias 之前声明,否则 Alias 会优先匹配 /chat/api/
  10. ProxyPreserveHost On
  11. ProxyPass /chat/api http://127.0.0.1:3000/api
  12. ProxyPassReverse /chat/api http://127.0.0.1:3000/api
  13. # ── Chatbot 静态文件:由 Apache 直接服务 ─────────────────────────────────────
  14. Alias /chat /redant/web/homelegance-chatbot/dist/public
  15. <Directory /redant/web/homelegance-chatbot/dist/public>
  16. Options -Indexes
  17. AllowOverride None
  18. Require all granted
  19. </Directory>
  20. # ── SPA fallback:/chat/* 非文件请求一律返回 index.html ──────────────────────
  21. RewriteEngine On
  22. RewriteCond %{REQUEST_URI} ^/chat/
  23. RewriteCond %{REQUEST_URI} !/chat/api/
  24. RewriteCond %{REQUEST_FILENAME} !-f
  25. RewriteRule ^ /redant/web/homelegance-chatbot/dist/public/index.html [L]