nginx 和 php 之间通信 unix socket和tcp socket 相关配置教程
介绍
相关优缺点可以移步至https://www.cnblogs.com/djwhome/p/12536222.html
介绍的更全面一点
php-fpm开启 unix socket 和 tcp socket 的教程
https://www.cnblogs.com/qianxiaoPro/p/14897716.html
两者Nginx配置
unix socket
需要在nginx配置文件中填写php-fpm运行的pid文件地址。
location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; }
tcp socket
需要在nginx配置文件中填写php-fpm运行的ip地址和端口号。
location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; }