Nginx (a): acquaintance Nginx

First, what is Nginx?

  Nginx  is asynchronous framework of Web servers, it can also be used as a reverse proxy , load balancers and HTTP caching . Select Nginx some of the advantages: can high concurrent connections , less memory consumption , low cost , configuration files is simple , to save bandwidth , high stability , supports hot deployment , built-health checks , support Rewrite rewrite rules and so on.

  What is a reverse proxy ?

  Reverse proxy in a computer network is a proxy server kind. Server based on the client's request, from the relationship of one or more sets of back-end servers (such as Web server access to resources on), and then return those resources to the client, the client will only know the IP address of the reverse proxy server without knowing in the presence of a cluster of servers behind a proxy server.

 

  Then the reverse proxy What is the use?

    the client to hide IP address of the server (cluster) of;

   on security as application-layer firewall , provides Web-based attacks (eg website DoS / DDoS ) protection, easier troubleshooting malware and so on;

    for the backend server (cluster) to provide unified encryption and SSL acceleration (e.g., SSL termination agent);

   load balancing , if a higher load by the server cluster, through reverse proxy URL rewriting The connection request from the lower load by obtaining necessary resources or the same backup;

   For static content and dynamic content within a short time a large number of access requests to provide caching services ;

    some content compression to save bandwidth or provide services to the poor network bandwidth networks;

    deceleration upload;

    is in the private network (such as local area network providing server clusters) of the NAT external network penetration and distribution services ;

  ⑨  provide HTTP access authentication ;

  

  Load balancing (Load balancing) for a plurality of computers ( clusters ), network connections, CPU, disk drive or other resource allocation load to optimize resource utilization, maximize throughput, minimize response time, while avoiding overloading the goal of. Is typically done by specialized hardware and software, the main role is to be assessed reasonably large number of jobs to a plurality of operation execution units, for solving the Internet architecture high concurrency and availability issues.

  In Nginx the load balancing of several strategies:

   polling ( Round Robin, default ): turn the client's Web request as configured in turn distributed to different back-end servers.

   least connections ( Least the Connections ): load balancing, when a request comes in, will select the least number of currently connected to a server processing the request based on the current connection server.

   IP address hash ( ip_hash ): According to a client's request for IP Hash algorithm to locate through the same back-end server, can solve the problem of session, for example, to access the other site URL, is assigned to the other site, but no session is not stored on other sites.

   weighted round robin strategy ( weight ): Consider each of the back-end server node accepts the request of the right basic weight based on the polling strategy, the probability of each of the specified backend server node is polled, the performance is mainly applied to back-end server node is not both cases.

 

  HTTP caching :

 

 

   Web content cache is located between the source Web server and client, when the user accesses a URL, Web cache server to retrieve the Web content you want to back-end output, and then when the next request comes, if access is the same URL , Web cache server directly output to the client, instead of sending another request to the backend server. Web content caching reduces the load on the source Web server, database, reducing network latency, improve the response speed of user access, enhance the user experience. Instruction set can be associated with the opening of proxy_cache.

Guess you like

Origin www.cnblogs.com/magic-sea/p/12513146.html