This is the fourth day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021

I. Introduction to unified installation and deployment environment and cloud server

For example, if we want to publish an application online to provide external access, we must have a public IP address and the corresponding server. In the past, it was often to rent other people’s servers, and it took a lot of procedures to put an application online, and it could not be expanded in time if there was sudden traffic.

The emergence of cloud server allows us to quickly create the corresponding server and obtain the corresponding public IP.

At present, there are several major cloud server manufacturers in the mainstream of the city

  • Aliyun: www.aliyun.com/\

  • Tencent cloud: cloud.tencent.com/\

  • Amazon Cloud: aws.amazon.com/\

You can choose the cloud server according to your own needs. We recommend aliyun.

Why does Nginx need a cloud server? Win7, Win8, Win10, etc. There are compatibility problems with Nginx.

We must use Centos7 and above version, 64-bit system, do not operate on Windows system, and most enterprises are installed under Linux, so we can better master the use of online server.

1) Ali Cloud server purchase steps (enter the second kill page through the above link), you can buy a 1-core 2G or 2-core 4G server

2) Select the configuration according to your own requirements, remember to select CentOS 7.x, 64-bit system

3) Configure public Ip addresses and develop corresponding ports 80 and 443

4) Configure the corresponding password and payment

5) View the public IP address and reset the connection password

2. Introduction to cloud server remote connection tools

We bought aliyun server, and then we need to use some remote connection tools to connect, we need to remotely transfer files from local later. There are different connection tools for different operating systems.

There are two types of tools, one for remote connections and the other for transferring files remotely. Here I give a few commonly used software names, we can refer to search.

Remote connection tool

  • Windows tools putty, Xshell, and Security CRT
  • References:
    • Jingyan.baidu.com/article/e75…
    • www.jb51.net/softjc/8823…

 

  • MAC: Use a terminal to log in

Linux Graphical manipulation tool (for uploading files on remote connections)

  • Mac: Filezilla
  • sftp://120.24.216.117
  • Windows: winscp
  • Resources: jingyan.baidu.com/article/ed2…

For these tools, you can find the relevant documentation through Baidu, and then try to install mysql JDK nginx Maven Git redis on the Linux cloud server, as an exercise.

Nginx download and Aliyun LInux quick installation

1. Download the Nginx installation package from the official website

Go to the Nginx official website to download

  • Nginx.org/en/download…

2. Install Linux dependency libraries

During the installation package download process, we need to go to our Linux server to install the corresponding dependencies. Many systems, it lacks the corresponding third-party dependency library, then we put this command copy up, execute it.

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
Copy the code

3. Upload the Nginx installation package

We need to connect to our Ali cloud through a remote file transfer tool to create a folder and upload the nginx package provided locally.

4. Unzip and install Nginx

Go to the folder where we uploaded Engines. Run the following command to decompress, compile, and install the software.

// Decompress tar -zxvf nginx-1.18.0.tar.gz // Go to the corresponding directory, CD nginx-1.18.0 // Run./ configureMakemake installCopy the code

This installation process will take a few minutes. Using the default installation path, we can go to the default installation path and start our Nginx.

// Go to the Nginx bin directory CD /usr/local/nginx/sbin// to start Nginx./ NginxCopy the code

Note: firewall open port, Ali cloud network security group configured port 80, and then we can access the corresponding public IP through the browser, our startup Nginx page appears.

5, domain name access process analysis and record

We have installed our Nginx, but we use IP to access our Nginx, users certainly can not remember our IP, so we need to access through the domain name, we also need to supplement the domain name record, how to access our server through a domain name?

Let’s talk about the basic process of an HTTP request. When the client initiates a request for domain name resources, it will obtain the corresponding IP through DNS resolution, and then find our server through THE IP to obtain the corresponding resources.

Like the picture below. When a user initiates a domain name example.com, we request DNS resolution, and DNS recursively resolves the domain name to an IP address that accesses our Web server.

6, let’s clarify the relationship between domain name and IP, DNS function

  • DNS: Domain Name Server Although Domain names are easy to remember, computers on the network can only recognize each other’s IP addresses. The translation between them is called Domain Name resolution. Domain Name resolution is performed by a dedicated Domain Name resolution Server

7. Concept: What are Cnames and A records

  • A record

    • Users can set the domain name in this and point to their target host address, so as to achieve through the domain name to find the server (also called IP domain name configuration) aabbcc.com -> 120.24.216.117
  • cname

    • Alias point, you can set an alias for a host. For example, if you set open1024.com to point to a host xdClass.net, then you can use Open1024.com instead of accessing xdClass.net
    • www.xdclass.net –> xdclass.net

8, buy domain name + record

After understanding some of the concepts above, we need to purchase the domain name and record. Then this step, we go in according to our following two links to buy and record, Ali Cloud there are detailed operation steps, you may also be a little curious, why do you need to buy the domain name? Since we will talk about HTTPS later, we will use a free certificate of Aliyun to deploy HTTPS domain name, so we need the corresponding domain name, which is the correct way to operate online

  • Purchase address: wanwang.aliyun.com/

  • Ali Cloud record address: beian.aliyun.com/

Install Nginx on the CentOS server on the local VM

Last paragraph we talked about through Ali Cloud to buy domain name and to record, but this record process takes a long time, so we can first in the record process according to the local VIRTUAL machine to build Linux to install and deploy our Nginx.

About the virtual machine a detailed build, there are many online blog, we will not talk about this, deviated from the theme. Different system installation operation is not the same, we can search the blog post according to the keywords of your system and virtual machine installation through Baidu.

There are a few points to note:

  • The VM OS version must be: CentOS 7 or later 64-bit image
  • Network access: Ensure that the host and VM networks are accessible, the firewall is disabled, or port 80 is enabled
  • The installation and deployment of ali cloud is consistent

The content of this article is summarized

  • Mainly about the introduction of our cloud server, as well as the use of remote connection tools
  • Nginx installation in Ali cloud the entire operation steps, the middle of the added domain name resolution record this some knowledge.
  • There are also some considerations for local virtual machine installation.