简体   繁体   English

如何部署yeoman angular-fullstack项目?

[英]how to deploy yeoman angular-fullstack project?

I want to deploy a simple angular projet made with angular fullstack. 我想部署一个简单的角度projet,使用角度fullstack。

https://github.com/DaftMonk/generator-angular-fullstack https://github.com/DaftMonk/generator-angular-fullstack

I tried : 我试过了 :

yo angular-fullstack test

grunt build

Then, in dist I got 2 folders: server and public. 然后,在dist我有2个文件夹:server和public。

how to deploy them on a linux server ? 如何在Linux服务器上部署它们?

with forever/node and nginx ??? 与forever / node和nginx ??? I want to self host my project. 我想自己主持我的项目。

thanks 谢谢

1.) Install nginx 1.) 安装nginx

2.) Proxy forward nginx to your node port. 2.)将代理转发nginx到您的节点端口。 See Digital Oceans How-To . 请参阅Digital Oceans How-To

nginx.conf 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.) Start app.js with node in your dist folder with the correct variables: 3.)使用正确的变量启动带有dist文件夹中节点的app.js

$ export NODE_ENV=production; export PORT=9000; node dist/server/app.js

4.) Browse to the hostname configured in nginx in step 2. 4.) 浏览到步骤2中在nginx中配置的主机名

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. 如果你得到很多404 ,你最有可能在HTML5模式下使用angular.js并需要重新连线你的路线以提供静态angular.js内容。 I described this and how-to tackle many other bugs that you may face in my blog article: " Continous Integration with Angular Fullstack ". 我描述了这个以及如何解决您在我的博客文章中可能遇到的许多其他错误:“ 与Angular Fullstack的持续集成 ”。

You can try pm2 as well which is straightforward and easy, it comes with lots of useful features. 您也可以尝试使用pm2,它简单易用,具有许多实用功能。

https://github.com/Unitech/pm2 https://github.com/Unitech/pm2

// Start new node process
$ pm2 start dist/server/app.js

// list all process
$ pm2 list

Also, if you're running a mongo db with a host you will need to change the /server/config/environment/production.js uri to match development.js and it should work. 此外,如果您正在运行带有主机的mongo数据库,则需要更改/server/config/environment/production.js uri以匹配development.js,它应该可以工作。

With MongoLab you have something to this effect: mongodb://user:pass@XXXXX.mongolab.com:XXXXX/yourdatabase 使用MongoLab,您可以获得以下效果:mongodb:// user:pass@XXXXX.mongolab.com:XXXXX/yourdatabase

then run the grunt serve:dist command in your app directory. 然后在你的app目录中运行grunt serve:dist命令。

This worked for me. 这对我有用。

Install generator-angular-fullstack: 安装generator-angular-fullstack:

npm install -g generator-angular-fullstack

Make a new directory, and cd into it: 创建一个新的目录, cd到其中:

mkdir my-new-project && cd $_

Run yo angular-fullstack , optionally passing an app name: 运行yo angular-fullstack ,可选择传递应用名称:

yo angular-fullstack [app-name]

Run grunt for building, grunt serve for preview, and grunt serve:dist` for a preview of the built app 运行grunt用于构建,grunt serve for preview, and grunt serve:dist`用于预览构建的应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将yeoman angular-fullstack项目部署到Azure - Deploy yeoman angular-fullstack project to Azure 向eoman角全栈项目中添加新的依赖项 - Adding new dependencies to yeoman angular-fullstack project 如何在不缩小的情况下构建约曼角全堆栈 - how to build yeoman angular-fullstack without minification Yeoman Angular-fullstack生成器发布错误 - Yeoman Angular-fullstack generator post error Angular.js身份验证重定向不适用于Yeoman Angular-Fullstack - Angular.js authentication redirect not working with Yeoman Angular-Fullstack 身份验证后如何将用户重定向到原始请求,Angular-Fullstack Yeoman? - How to redirect users to original request after authentication, Angular-Fullstack Yeoman? 使用Yeoman的全角堆栈生成器时,如何访问前端的环境变量? - How do you access environment variables on the front end when using Yeoman's angular-fullstack generator? Yeoman的全角堆栈新生成后缺少模块 - Missing modules after fresh generation with Yeoman's angular-fullstack 在yeoman angular-fullstack中添加一条新路线会破坏它吗? - Adding a new route to yeoman angular-fullstack breaks it? 403使用Yeoman的Angular-Fullstack在邮递员中发帖 - 403 when posting in postman using Yeoman's Angular-Fullstack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM