Nginx is connected to FastCGI through HTTP. in Linux, another faster method is to use Unix domain socket. The following describes this method:
The following must be modified:
/Usr/local/PHP/etc/php-fpm.conf
Change to: <value name = "listen_address">/dev/SHM/PHP. Socket </value>
Specifically,/dev/SHM/PHP. socket is the socket file used for nginx to communicate with PHP-FPM. The name and path are arbitrary. Put the socket in/dev/SHM, And/dev/SHM is a tmpfs, which is much faster than the disk.
2./usr/local/PHP/sbin/PHP-FPM restart
Restart PHP-FTM to generate the newly specified/dev/SHM/PHP. socket.
3. chown Nobody. Nobody/dev/SHM/PHP. Socket
Here, the nobody user is a UNIX user used by nginx and PHP-FPM. If you are not a nobody, modify it as appropriate.
4. modify the configuration of the server segment in nginx that needs to connect to PHP-FPM, and change the HTTP Method to the socket method.
Location ~ . * \. (PhP | PhP5 )? $
{
# Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_pass Unix:/dev/SHM/PHP. Socket;
Fastcgi_index index. php;
Include FastCGI. conf;
}
5. Restart nginx:./nginx-s reload.