This is the 20th day of my participation in the August Text Challenge.More challenges in August

preface

Eat enough to write code

Today, I found out two bugs in the code written by my master. I am very proud of it. But I still can’t do anything…… Now learn good miscellaneous, next record Nginx knowledge point! Reference zhuanlan.zhihu.com/p/349433 this article, a great help, thank you ~

The basic concept

It is a high-performance HTTP and reverse proxy Web server that also provides IMAP/POP3/SMTP services. Developed by Igor Sessoyev for the second most visited rambler.ru site in Russia (р а блер).

The source code is distributed under a BSD-like license, known for its stability, rich feature set, simple configuration files, and low system resource consumption.

In fact, nginx’s concurrent ability is better in the same type of web server. In Mainland China, nginx website users include: Baidu, JINGdong, Sina, netease, Tencent, Taobao, etc.

Here are the pictures from the answer:zhuanlan.zhihu.com/p/349433

The following diagram illustrates the current popular technology architecture, where Nginx acts like an entry gateway;

Forward agent

Because of the firewall, we can not directly access Google, this time to use VPN to achieve, this feeling is forward proxy; The logic here is like, agent and intermediary, the client is the client, the client through the intermediary and target communication!

The reverse proxy

Reverse proxy means that the agent is the server side, and the process is transparent to the client, like a rental agent connecting the landlord with the tenant, right? !

Nginx 的 Master-Worker

After Nginx is started, the Socket service is actually started on port 80 for listening. As shown in the figure, Nginx involves Master process and Worker process.

MasterThe role of a process:

Read and verify the configuration file nginx.conf; To manage the worker process;

WorkerFunctions of processes: Each Worker process maintains a thread to handle connections and requests in order to avoid thread switching; The number of Worker processes is determined by the nginx.conf configuration file.

Hot deployment of Nginx

It has an nginx.conf configuration file that can be modified without stopping Nginx or interrupting requests. To contact a process, after modifying the configuration file, the new configuration will be used to process requests, which will enter the new worker process. The old worker process will be killed after the previous processing requests are completed.

Although the above seems very basic or trivial, because my teacher has told me about it before, I feel that it seems to be connected with the docker and service I learned yesterday. I will study in detail again! Come on ~