【发布时间】:2016-03-09 12:07:55
【问题描述】:
我有一个 Yeoman 全栈应用程序 @2.0.13,其目录结构与 this tutorial 完全相同。
一切正常 - grunt serve:dist 等工作没有任何错误。现在我想投入生产,并使用mod_proxy 将应用程序部署为example.com/xxx 在apache 服务器上。我将grunt build 生成的/dist 目录复制到主目录并启动服务器应用程序:
NODE_ENV=production node server/app.js
应用启动,填充用户等等。一切正常。现在我为节点应用设置虚拟主机设置:
<Location /html/xxx/>
ProxyPass http://127.0.0.1:9000/
ProxyPassReverse http://127.0.0.1:9000/
</Location>
这类作品。奇怪的是,来自 dist 目录的 index.html 加载正确
dist
├── public
│ ├── app
│ ├── assets
│ ├── bower_components
│ └─ index.html <---
|
└── server
├── api
├── auth
├── components
├── config
├── views
├─ app.js
└─ router.js
proxyPass 有效,index.html 已加载-但文件index.html 指的是(4 个组装的public/app 文件/vendor.js、app.js 等)不是。无论我尝试了什么,无论我测试过的任何指南中的什么设置,我都会得到404
在这方面确实花了很多时间。对我来说,反向代理似乎以某种方式改变了内部网址?如果我用仅侦听端口 9000 并返回 hello world 的节点脚本替换 dist/,则设置有效。
我错过了什么?有没有其他方法可以做到这一点?
【问题讨论】:
标签: angularjs apache gruntjs yeoman angular-fullstack