Giter VIP home page Giter VIP logo

Comments (1)

Molunerfinn avatar Molunerfinn commented on May 14, 2024

生产环境下应该要先build,然后再用pm2启动。命令是npm run start:pm2,代码如下:
https://github.com/Molunerfinn/vue-koa-demo/blob/master/package.json#L15

nginx方面的配置大概是这样(只给关键部分):

http {
  upstream nodeServer {
    server 127.0.0.1:8888;
  }
  server {
    listen: 80;
    server_name: nodeServer;
    location / {
      proxy_pass http://nodeServer;
      proxy_redirect off;
    }
  }
}

你可以选择在服务端构建也可以选择在本地构建完把dist目录上传。

代码的话,如果是生产环境,主要就是这几个文件/目录:

  • server-entry.js
  • app.js
  • env.js
  • .env
  • dist/
  • server/

当然不推荐单独把关键文件目录拿出来。推荐是可以把代码放服务端然后在服务端构建。

from vue-koa-demo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.