问题描述
我要部署具有角fullstack做了一个简单的角度谟。
I want to deploy a simple angular projet made with angular fullstack.
https://github.com/DaftMonk/generator-angular-fullstack
我试过:
yo angular-fullstack test
grunt build
然后,在DIST我有2个文件夹:服务器和公共
Then, in dist I got 2 folders: server and public.
如何将它们在Linux服务器上部署?
how to deploy them on a linux server ?
与永远/节点和nginx的?
我想自我主办我的项目。
with forever/node and nginx ???I want to self host my project.
感谢
推荐答案
1)安装nginx的
2)的代理着nginx的以您的节点端口。见Digital海洋操作方法的。
2.) Proxy forward nginx to your node port. See Digital Oceans How-To.
nginx.conf
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://localhost:9000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
3)开始app.js 与正确的变量在DIST文件夹节点:
3.) Start app.js with node in your dist folder with the correct variables:
$ export NODE_ENV=production; export PORT=9000; node dist/server/app.js
4)浏览到主机名在nginx的配置步骤2中。
4.) Browse to the hostname configured in nginx in step 2.
在情况下,你会得到很多的 404 的你最有可能使用的在HTML5模式angular.js 并需要重新电线你的路由服务静态angular.js内容。我描述这个问题以及如何对解决您可能会在我的博客文章中面临着许多其他错误:
In case you get many 404's you most likely are using angular.js in HTML5 mode and need to re-wire your routes to serve static angular.js content. I described this and how-to tackle many other bugs that you may face in my blog article: "Continous Integration with Angular Fullstack".
这篇关于如何部署自耕农角fullstack项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!