First acquaintance with Nginx

First we need to understand what is Nginx?

Nginx ("engine x") is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP server. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, the concurrency capabilities of nginx are indeed better among web servers of the same type. Users of nginx websites in mainland China include: Jingdong, Sina, NetEase, Tencent, Taobao, etc.

Reverse Proxy means that the proxy server accepts the connection request on the internet, then forwards the request to the server on the internal network, and returns the result obtained from the server to the client requesting the connection on the internet. At this point, the proxy server acts as a reverse proxy server to the outside world.

Why use Nginx?

1. Hot deployment

I personally think this is pretty good. In the separation design of the master management process and the worker worker process, Nginx has the function of hot deployment, then under the premise of 7 × 24 hours of uninterrupted service, upgrade the executable file of Nginx. You can also modify configuration files, replace log files and other functions without stopping the service.

2. High concurrent connections

This is a very important feature! With the rapid development of the Internet and the increasing number of Internet users, some large companies and websites need to face high concurrent requests. If there is a server that can withstand more than 100,000 concurrent requests at the peak, it will definitely be favored by everyone. In theory, the upper limit of concurrent connections supported by Nginx depends on your memory, and 100,000 is far from the cap.

3. Low memory consumption

Under normal circumstances, 10,000 inactive HTTP Keep-Alive connections consume only 2.5M of memory in Nginx, which is the basis for Nginx to support high concurrent connections.

4. Process response requests quickly

Under normal circumstances, a single request will get a faster response. During peak periods, Nginx can respond to requests faster than other web servers.

5. Has high reliability

Nginx is a highly reliable web server, which is also the basic condition for why we choose Nginx. Now many websites are using Nginx, which is enough to show the reliability of Nginx. High reliability comes from the excellent design of its core framework code, the simplicity of module design; and these modules are very stable.

What is the difference between a proxy and a reverse proxy?

Proxy servers are generally divided into two categories, namely forward proxy servers and reverse proxy servers. The forward proxy server is usually referred to as the proxy server for short, and the proxy server we often refer to refers to the forward proxy server.

Forward proxy server

A normal forward proxy server is an intermediate server between the client and the origin server. To get content from the origin server, the client sends a request to the proxy server, and the proxy server gets the content from the origin server and returns it to the client. The client must specifically configure the forward proxy to access other sites, such as configuring the proxy server address and port number in the browser.

A typical application of a forward proxy server is to provide internal clients behind a firewall to access the external Internet. For example, campus network users access foreign websites through a proxy, and intranet users access external Internet websites through the company's unified proxy. Forward proxy servers can also use caching to ease the load on the origin server and improve responsiveness.

reverse proxy server

A reverse proxy server, on the other hand, looks like a normal web server to the client. The client should not do any special configuration. The client sends a normal request to get the contents of the space to which the reverse proxy belongs. The reverse proxy decides where to send these requests and then returns the request content as if it were the origin server itself.

A typical application of a reverse proxy server is to provide access to external Internet users for servers behind firewalls. A reverse proxy can be used to provide load balancing across multiple backend servers, or to provide caching for slower backend servers. In addition, reverse proxies can simply map multiple servers to the same URL space.

Difference between the two

The similarity between the two is that they are both intermediaries between the user and the server, completing the forwarding of user requests and results. The main differences are:

1. The inside of the forward proxy is the client, and the inside of the reverse proxy is the server. That is, the clients of the intranet access the external network through the forward proxy server, while the external users access the internal server through the reverse proxy.

2. The forward proxy usually accepts any request sent by the client, while the reverse proxy usually only accepts requests from the specified server. For example, internal users of the campus network can access any foreign site (if not restricted) through the forward proxy, and only specific requests are sent to the reverse proxy, and then the reverse proxy is sent to the internal server.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324934116&siteId=291194637