http://book.51cto.com/art/201202/314840.htm
1.7.2 Nginx+FastCGI operating principle
Nginx does not support direct calling or parsing of external programs. All external programs ( Including PHP) must be called through the FastCGI interface. The FastCGI interface is a socket under Linux (this socket can be a file socket or an ip socket). In order to call a CGI program, a FastCGI wrapper is also needed (a wrapper can be understood as a program used to start another program). This wrapper is bound to a fixed socket, such as a port or file socket. When Nginx sends a CGI request to this socket, the wrapper receives the request through the FastCGI interface, and then spawns a new thread. This thread calls the interpreter or external program to process the script and read the return data; then, the wrapper The returned data is passed to Nginx along the fixed socket through the FastCGI interface; finally, Nginx sends the returned data to the client. This is the entire operation process of Nginx+FastCGI, as shown in Figure 1-3.
(Click to view larger image) Figure 1-3 Nginx+FastCGI running process |
The above introduces the operating principle of Nginx+FastCGI, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.