preface

Again, I configured an Ali cloud server before and now I start to try Tencent cloud, a new server here I choose centos system

Address of previous related articles

  • Nginx deploys multiple projects
  • Taste CI/CD, it smells good
  • Jenkins+ GitLab automated build deployment

Some basic configurations are installed

Yum install git

Verify that the installation is successful

Install the NVM

Command:

  1. (the curl – o – raw.githubusercontent.com/creationix/… | bash)
  2. (wget – qO – raw.githubusercontent.com/creationix/… | bash)
  3. (git clone git://github.com/creationix/nvm.git ~/nvm)

Install the successful configuration automatically run (this two sentence is also Baidu, run your NVM command can be used)

echo "source ~/nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc
Copy the code

Verify the hand, indicating that the installation is successful and configured

Install the node

NVM install 12.16.1 NVM install 12.16.1 NVM install 12.16.1 NVM install 12.16.1 NVM install 12.16.1 NVM install 12.16.1 NVM install 12.16.1

Success!!!!! The next step

PS: WHEN I get a server or a new computer, I always use Git and Node first. With these two and an editor, you can start front-end development. In practice, there is no precise priority

Nginx installation download configuration

Let’s go back to nginx, some nginx related operations.

Centos install nginx

Nginx tutorial: How to get started with nginx!!

(yum install -y nginx)

Install nginx directly run, directly browser access server address, as shown below, milk! Direct success

The default static resource directory on the server without modifying the configuration/usr/share/nginx/html

Nginx configuration file in /etc/nginx,

The basic configuration is the same. The default port is 80. I just configured a new port 1111 for testing

     server {
        listen       1111 default_server;
        listen       [::]:1111 default_server;
        server_name  baimengling.cn;
        root         /usr/share/nginx/www/;

        index  index.html;
    }   
Copy the code

Create a new folder WWW and put a project in it. Then check to see if nginx configuration fails

nginx -t
nginx -s reload
Copy the code

Last browser access URL :1111 server address + port (1111),

Found that the new project can be accessed, this step also succeeded

Configure the Nginx reverse proxy

The client is not aware of the proxy server and does not need to do any configuration on the client. The user only requests the reverse proxy server. The reverse proxy server selects the target server and returns data to the client. Learn about agency

Install Jenkins

  1. Install the Java

yum install -y java

  1. Install Jenkins
CD/data wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.277.2-1.1.noarch.rpm sudo yum install Jenkins - 2.277.2-1.1. Noarch. RPMCopy the code

Recommended article is a comprehensive tool installation and configuration

run

Then access the server address + port (8080)

You can see the successful access, and then some Jenkins again some use and configuration that I skipped over here

Install the PM2

PM2 is a node process management tool. It can be used to simplify many node application management tasks, such as performance monitoring, automatic restart, load balancing, and so on.

Installation:

npm install -g pm2

Deploy express or KOA back-end applications. We usually start the application with NPM start, which is called node./bin/ WWW. Pm2 start./bin/ WWW — watch

Note that the — watch parameter is used here, which means that pM2 will restart the service for you when your Express application code changes.

Common commands:

$NPM install pm2 -g # install pm2 $pm2 start app.js -i 4 # install pm2 $pm2 start app.js --name my-api # Name process $pm2 list # Display all process status $ $pm2 restart all $pm2 restart all $pm2 reload all $pm2 restart all $pm2 restart all $pm2 reload all (For NETWORKED processes) $pm2 stop 0 # Stop the specified process $pm2 restart 0 # Restart the specified process $pm2 startup # Generate init script to keep the process alive $pm2 Web # Run robust Computer API endpoint (http://localhost:9615) $pm2 delete 0 # Kill specified processes $pm2 delete all # Kill all processesCopy the code

conclusion

This article is just some tools I just got under the server software, really nothing dry

Keep a quick note and maybe you can go back and look at some of the blog posts you’ve written over the years.