Nginx Details

Nginx and Apache http server software is the same. The difference between them is Apache's processing speed, memory resources, nginx contrary. In function of all Apache modules supported by dynamic and static compilation, nginx module and all static compiler! Apache support for fastcgi is not good, and nginx for FastCGI support is very good!

 

Nginx advantage

 

As a web server static files, index files, automatic indexing efficiency is very high as a proxy server, can be achieved without caching reverse proxy to improve site speed as a load balancing server, you can directly support the performance of Rails and PHP internally, using epoll model, it can support multiple concurrent and low memory footprint

Stability, to take sub resource allocation technology, CPU and memory usage rate is very low similar to DOS attacks on nginx almost no role in terms of high availability, supports hot deployment, start fast, uninterrupted service may be in the case of a direct upgrade, 7X24 hours uninterrupted operation

 

Nginx modules and works

 

 

N G in X by the kernel and the module . Module structure is divided into the core module, the base module, third-party modules

 

Core Module: http module, event module, mail module

 

The base module: http FastCGI module, http proxy module, http rewrite module

 

Third-party modules: http upstream request hash module, notice modules, http access key module module is divided into the following three categories from the function:

The Handlers (processor module): direct process the request, and outputs the content information and modify headers operation, only one of the Filters (filtering module): the content of the other main processor modules to modify operation of the output, the output of the last fault case summarized by the nginx

Proxies (proxy class module): Some of the services such as main and back-end FastCGI interact to achieve proxy and load balancing on the work:

Single worker process (default): In addition to the main course, there is much work to process a work process: Each process contains multiple threads

Nginx is compiled into between Naginx module, therefore is a static compiler way! Then compiled as a module so file, specify whether to load the configuration file!

 

master process is primarily used to manage the worker processes, specifically including the following four main functions:

 

(1) receives a signal from the outside.

 

(2) transmits a signal to each process worker.

 

(3) monitor the operation woker process.

 

(4) When woker withdraw from the process (exceptional circumstances), it will automatically restart a new woker process.

 

woker mainly used to process the network event processing, is independent and the like, are equivalent to competition from the client's request, a request can only be processed in a woker process, the process is usually set to the number of machines woker CPU processes between the respective woker audit.

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11328174.html