| 1234567891011121314151617181920212223242526272829303132 |
- # Homelegance Chatbot — Apache 配置片段
- # 将以下内容添加到 www.homelegance.com 的 <VirtualHost *:443> 块内
- # 文件位于:/etc/httpd/conf.d/homelegance.com.conf(或对应的主站配置文件)
- # 修改后执行:sudo systemctl reload httpd
- #
- # 所需模块(通常已启用):
- # mod_proxy, mod_proxy_http, mod_rewrite, mod_alias
- # ── Chatbot API:代理到 Node.js :3000 ────────────────────────────────────────
- # ProxyPass 必须在 Alias 和 AJP catch-all 之前声明
- ProxyPreserveHost On
- ProxyPass /chat/api http://127.0.0.1:3000/api
- ProxyPassReverse /chat/api http://127.0.0.1:3000/api
- # 阻止 /chat/ 被 AJP catch-all 拦截
- ProxyPass /chat/ !
- # ── Chatbot 静态文件:由 Apache 直接服务 ─────────────────────────────────────
- Alias /chat /redant/web/homelegance-chatbot/dist/public
- <Directory "/redant/web/homelegance-chatbot/dist/public">
- Options -Indexes +FollowSymlinks
- AllowOverride None
- Require all granted
- </Directory>
- # ── SPA fallback:/chat/* 路由请求返回 index.html ─────────────────────────────
- # 用扩展名排除静态文件(不能用 %{REQUEST_FILENAME} !-f,Alias 下路径映射不对)
- RewriteEngine On
- RewriteCond %{REQUEST_URI} ^/chat/
- RewriteCond %{REQUEST_URI} !/chat/api
- RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|gif|ico|svg|woff2|woff|ttf|eot|map|json|webp|txt)$
- RewriteRule ^ /redant/web/homelegance-chatbot/dist/public/index.html [L]
|