Abstract: Author Bowen address: https://www.cnblogs.com/liu-shuai/
There are two ways of communication between Nginx and FastCGI, one is TCP, and the other is UNIX socket mode.
The socket does not go to the TCP layer, and the TCP approach goes to the IP layer. Therefore, in theory, the socket connection method is more efficient.
TCP and UNIX domain socket methods comparison
TCP is connected using TCP ports 127.0.0.1:9000
Socket is socket connection using UNIX domain socket/dev/shm/php-fpm.sock
1, modify the php-fpm.conf
1 127.0. 0.1:9000 # Note 2 listen =/dev/shm/php-fpm.sock #/dev/shm/ is a memory file system, Guaranteed to read and write 3 listen.owner = nginx4 listen.group = nginx56 Service PHP-FPM Restart
2, modify the nginx.conf
1 #fastcgi_pass 127.0. 0.1:9000; 2 fastcgi_pass unix:/dev/shm/php-fpm.sock; 3 4 /usr/local/nginx/sbin/nginx-s Reload
PHP Setup Socket connection