Foreword: Because many friends private letter to me, about ali Cloud deployment of NUXT application, here is a detailed introduction

My server version is CentOS7 ~

Tools required:
Xftp5 Xshell5 (if you have a remote repository, you don’t need Xftp5 to push it directly to your server)

Steps:
1 Install and configure NVM (Node) 2 mysql 3 Configure nginx (Tengine) 4 PM2 startup

one  NVM install node: Click on the address

Install mysql:Click on the address

Set password source mysql. SQL import your SQL file

Configure nginx

1. Download the tengine package and download the tengine-2.2.0.tar.gz file to the /usr/soft directory.

Unzip tengine package to /usr/src:

        cd /usr/src
Cp/usr/soft/tengine – 2.2.0. Tar. Gz. /
The tar – ZXVF tengine – 2.2.0. Tar. Gz
Rm – rf tengine – 2.2.0. Tar. Gz

3. Install required components

         yum -y install gcc gcc-c++
PCRE:
         cd /usr/src
Wget HTTP: / / ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
The tar ZXVF pcre – 8.39. Tar. Gz
. / configure — prefix = / usr/local/pcre – 8.39
        make && make install
OpenSSL:
        cd /usr/src
Wget www.openssl.org/source/open…
The tar ZXVF openssl – 1.0.2. Tar. Gz
. / config — prefix = / usr/local/openssl – 1.0.2
       make && make install
Zlib:
       cd /usr/src
Wget www.zlib.net/zlib-1.2.11…
The tar ZXVF zlib – 1.2.11. Tar. Gz
. / configure — prefix = / usr/local/zlib – 1.2.11
       make && make install

4. Set the soft link and boot service

      ln -s /etc/init.d/nginx /usr/bin/nginx
     chmod 755 nginx
     chkconfig –add nginx
     chkconfig nginx on  

5. Nginx configuration files

    worker_processes 1;
    error_log logs/error.log;
    error_log logs/error.log notice;
    error_log logs/error.log info;
    pid logs/nginx.pid;
    events {
       use epoll;
       worker_connections 1024;
     }
    http {
       include mime.types;
       default_type application/octet-stream;
      sendfile on;
      keepalive_timeout 65;
     #gzip on;
   
include /usr/local/nginx/conf/conf_site/*.conf; / / alone
include
The conf file
   }


6. Conf configuration of include

    server{
       listen 80;
       location / {
         deny all;
        }
    }
   upstream maven_domain_com {
server localhost:8000; // Own server IP address
    }
   server{
listen 80; // Listen on port 80
server_name maven.domains.com; // Your own secondary domain name
        location / {
           proxy_pass
http://maven_domains_com/nexus/;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       } 
       location /nexus/ {
           proxy_pass
http://maven_domain_com/nexus/;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       }
    }

7. Start the nginx

   cd /usr/local/nginx/  

   ./nginx

Four. Organize the code into the server

Open a new session in the upper left corner of Xftp

 

Then open the



Select the one you just created



After the connection is successful, go to the root directory of the server’s root account.

V. Launch Project

Drag your project directly to the directory you want to place it in,

Switch to the project

NPM install install package dependency (may cause various package compatibility issues)

If package compatibility issues occur, remove the ^ before the package version of the package.json file

Then delete rm -f -r./node_modules

NPM Clear cache

Then install yarn NPM install yarn -g

Install it again using YARN

 yarn install

Install the pm2

yarn add pm2

Run NPM run dev

Then run pm2 start bulid/main.js

Execute pm2 list # to display all process status

If online is displayed, the service is started

If the access fails, check pM2 logs




You can also perform pM2 monit # to monitor all processes



Now enter your domain name to access ~~~~



Successful deployment ~ ~ ~

Open source projects that have been successfully deployed click connect



Another recommended stress test module for Node projects is autocannon