1. Install node

1. Download Node and install the latest one

    wget https:/ / cdn.npm.taobao.org/dist/node/v12.13.1/node-v12.13.1-linux-x64.tar.xz(Try not to download it in the root directory)Copy the code

2. Unzip the node

    tar -xf node-v1213.1.-linux-x64.tar.xz (if xf is not installed, install it first)Copy the code

3. Change your name (optional, optional)

    mv node-v1213.1.-linux-x64.tar.xz node
Copy the code

4. Configuration

    1Ln -s /node/bin/node /usr/local/bin/node ln -s /node/bin/npm /usr/local/bin/npm2-s /node-/bin/node-/usr/bin/node-/usr/bin/npm -s /node-/bin/np/usr/bin/npm -s /node-/bin/np/usr/bin/npmCopy the code

Pm2 is a node process management tool that manages NUxT projects.

1. Install the pm2

    npm i pm2 -g
    ln -s /node/bin/pm2 /usr/local/bin/pm2
    pm2 -v
Copy the code

2. Configure the Nginx reverse proxy

    upstream nuxtjliufu {
        server 127.0. 01.:9000;
    }

    server {
        listen       80;
        server_name  www.jliufu.com;
        location / {
            proxy_pass   http://nuxtjliufu;index index.html index.htm; }}Copy the code

3. Package nuXT project locally

    1> Use NPM run build package2> After packaging, upload.nuxt nuxt.config.js package.json to the serverCopy the code

4. Install dependencies in the project directory

    npm install
Copy the code

5. Check whether an error occurs during the local startup

    npm run start
Copy the code

6. Start the PM2 daemon

    pm2 start --name "Project name"-- run start You can run the pm2 list to view processesCopy the code

7. Release a new version and restart the PM2

Pm2 restart Project nameCopy the code

8. Set automatic startup

    pm2 save
    pm2 startup
Copy the code