1. Ali Cloud or Tencent Cloud or any service provider server purchase

After purchasing a server, go to the console to view the server you have purchased.

2. Download the Xshell tool and connect to the cloud host

Enter the port number of your host and click connect

After will prompt input host password, password after you buy cloud host service chamber of commerce to tell you. For example, SMS notifications:

3. After the connection is successful, run commands to install the pagoda panel

Command: yum install wget - y && wget - O the sh http://download.bt.cn/install/install_6.0.sh && sh the shCopy the code

4. After the installation is successful, it will tell you the initial password and access port IP!

Browser input: Access panel

5. On the panel, install the environment required for nodeJS deployment

6. After the dependency is successfully installed, go to the file directory

/www/wwwroot/web
Copy the code

Create directory folder API: interface Web: web page

1. Zip your Express project and upload it to the API folder. Click the command line window in the upper left corner to install the NPM I dependency
2. Run pm2 start app.js to run your own server program

7. Enable port permissions for API interfaces

If the API listens for 3000

Adding an Enabling PortAfter the IP address is successfully added, the IP address can be accessed from the Internet

8. Configure the mysql database

1. Create a database and set the database password and name nodejs to

Module. exports = {host: 'localhost', user: 'nys', password: 'nys', database: 'nys'}Copy the code

2. Upload and import the. SQL file

3. Set the database permission locally4. Click Manage to manage the database, parse the. SQL file and generate tables

9. The extranet can access the interface

Postman test

10. Release the occupied port number

- View all occupied ports. - netstat - TLN - View the process that occupies the port. - lsof -i: port numberCopy the code

11. Start the PM2 process daemon

Start: pm2 start file name // pm2 start. /bin/ WWW Stop: pm2 stop allCopy the code