Nginx is and what role? Proxy and reverse proxy resolution

One: Introduction

nginx is a high-performance HTTP and reverse proxy server , which features a small memory footprint, high concurrency.

II: Introduction nouns

Proxy:

Proxy server English name is Proxy Server, whose function is to proxy network users to obtain network information. The image of that: it is a transit point for network information, to obtain information.

The main features are:
1. break their own IP access restrictions, access to foreign sites. Education Network , 169 network and other network users have access to foreign Web sites through a proxy.
2. units or groups access to some internal resources, such as a university FTP (provided that the proxy address is within the range of resources to allow access), using the education network within the free proxy server addresses, can be used to open education network all kinds of FTP download upload, and share all kinds of information inquiries and other services.
3. breakthrough China Telecom IP blocked: China Telecom users have access to many sites is the limit, this restriction is artificial, different Serve blockade address is different. So you can try a foreign proxy server can not be accessed.
4. To improve access speed: Proxy servers are usually set up a large hard disk buffer, when outside information through, but also save it to the buffer, when other users access the same information directly from the remove the buffer information passed to the user, in order to improve the access speed.
5. hide the real IP: Internet users can also hide your IP in this way, from attack.

 

Reverse Proxy

            The client (user A) to a reverse proxy namespace ( name-Space content) of transmitting normal request, then the reverse proxy determines where to (origin server) to transmit the request , and returns the obtained content to the client . The client always believed that it is accessible to server B instead of the original server Z. As the role of the firewall, allowing only server Z out, firewalls and reverse proxy role of protecting the common courtyard resource server B.

 Purpose: The server behind the firewall available to Internet users. The reverse proxy can also provide back-end load balancing multiple servers or provide a buffer for the back-end service slow servers.

 

 

Forward Proxy

         Forward proxy is located on a client server and the original A between the server (Server B) (the Z proxy server ), in order to obtain the content from the origin server, the Z user A sends a request to the proxy server and the target (server B), Z is then transmitted to the proxy server and the request to the server B returns the obtained content to the client. The client must make some special settings to use the forward proxy.

           Uses: access inside the firewall LAN clients to provide Internet pathway . Buffering properties may also be used to reduce network usage.

In terms of security:

        Forward proxy allows clients to access any site by hiding it and the client itself , so you have to take security measures to ensure that only authorized to service clients.

        Foreign reverse proxy is transparent, accessible to visitors do not know they are a proxy.

 

 

Load Balancing

That is, the server receives the request in accordance with the rules of the distribution process.

Nginx supports load balancing scheduling algorithm is as follows:

1.weight polling (default): received request in order to individually assign different back-end servers, even during use, a back-end server is down, Nginx automatically removed out of the server queue, the request accept the situation will not be affected. In this manner, a different set of back-end servers to a weight value (weight), the distribution ratio for the different adjustment request server; the greater the weight data, the greater the chance is assigned to the request; the weighting value, mainly configured for the actual working environment in different back-end server hardware adjustments.

2.ip_hash: Each request for matching in accordance with the hash result originating ip client, this algorithm a client is always fixed ip address access to the same back-end server, which has to a certain extent, solve the cluster deployment environment next session sharing problem.

3.fair: intelligently scheduling algorithms, dynamic back-end server at the request of the processing in response to time distribution of equalizing, in response to short time high processing efficiency of the server assigned to the high probability of a request, response time is long low efficiency distribution server to request less; combines the advantages of a scheduling algorithm of the first two. However, note that the default does not support fair Nginx algorithm, if you want to use this scheduling algorithm, install upstream_fair module.

4.url_hash: According to hash url to access the results of the allocation request, each request url will point to a server back-end fixed, can improve cache efficiency as in the case of a static Nginx server. Also note that Nginx default scheduling algorithm does not support this, you want to use, then you need to install Nginx of hash packages.

 

 

Three: Nginx advantage

1, as a Web server, Nginx static files, index files, automatic indexing efficiency is very high

2, as a proxy server, Nginx can be achieved without caching reverse proxy to accelerate and improve site speed

3, as a load balancing server, Nginx either directly support Rails and PHP internally, can also support HTTP proxy server in foreign service, and also supports the use of a simple fault tolerance and load balancing algorithms

4, in terms of performance, Nginx is designed for performance optimization and development, attaches great importance to the efficiency of the implementation. It uses the kernel Poll model that can support more concurrent connections can support up to respond to 50,000 concurrent connections, and only takes a very low memory resources

5, in terms of stability, Nginx has taken a phased resource allocation technology , making the CPU and memory occupancy rate is very low. Nginx official said, Nginx does not keep the 10 000 active connections, but these connections occupies only 2.5MB of memory, therefore, such an attack similar to DOS for Nginx is essentially no effect of

6, high availability, Nginx supports hot deployment, especially startup speed quickly, so you can, or configure the software version upgrade without interruption of service, even if the run for months without restarting too, can be done almost 7x24 hours run uninterrupted

Guess you like

Origin www.cnblogs.com/AbnerLc/p/11898244.html