One, by listening to TCP port communication
Php-fpm.d/www.conf
; The address onwhichTo accept FastCGI requests.; Valid syntaxes is:; 'Ip.add.re.ss:port'-To listen in a TCP socket to a specific IPv4 address on; a specific port;; '[ip:6:addr:ess]:p ort'-To listen in a TCP socket to a specific IPv6 address on; a specific port;; 'Port'-To listen in a TCP socket to all addresses; (IPv6 and IPv4-mapped) on a specific port;; '/path/to/unix/socket'-To listen on a UNIX socket.; Note:this value is Mandatory.listen=127.0.0.1:9000
Nignx.conf
Location ~ \.php { root /lroot/wwwroot/test; Fastcgi_pass 127.0. 0.1:9000; Fastcgi_index index.php; ^ (. +\.php) (. *) $; Fastcgi_param path_info $fastcgi _path_info; Fastcgi_param script_filename $document _root$fastcgi_script_name; Include fastcgi_params; }
Second, through the UNIX socket interprocess communication
Select a directory to create an empty. Sock file, such as/run/php-fpm.sock ( Note that the/tmp directory should not be selected), and then configure
Php-fpm.d/www.conf
1. Set up a communication mode
; The address onwhichTo accept FastCGI requests.; Valid syntaxes is:; 'Ip.add.re.ss:port'-To listen in a TCP socket to a specific IPv4 address on; a specific port;; '[ip:6:addr:ess]:p ort'-To listen in a TCP socket to a specific IPv6 address on; a specific port;; 'Port'-To listen in a TCP socket to all addresses; (IPv6 and IPv4-mapped) on a specific port;; '/path/to/unix/socket'-To listen on a UNIX socket.; Note:this value is Mandatory.listen=/run/php-fpm.sock
2. Set the access permission to create the. sock file so that the Nginx process can access the PHP-FPM created. Sock
; Unix user/group of processes; Note:the user is mandatory. If The group is not set, the default user " s Group ; would be used.user = Nginxgroup = Nginx
for if one is used. In Linux, read/write on order to allow connections from a Web server. many; BSD-derived systems allow connections regardless of permissions.; Default Values:user and group are set as the running user; 0660 == 0660
Nignx.conf
Location ~ \.php { root /lroot/wwwroot/test; Fastcgi_pass Unix:/run/php-fpm.sock; Fastcgi_index index.php; ^ (. +\.php) (. *) $; Fastcgi_param path_info $fastcgi _path_info; Fastcgi_param script_filename $document _root$fastcgi_script_name; Include fastcgi_params; }
[Linux] Two kinds of communication methods of PHP-FPM and Nginx