php-fpm参数修改
默认php-fpm监听在127.0.0.1接口上,修改listen = 192.168.99.150:9000,可以监听在指定网卡上。
默认php-fpm仅允许127.0.0.1连接,修改listen.allowed_clients = 192.168.99.150,可允许指定主机连接。
第一种方法(SetHandler)
追加到/etc/httpd/conf/httpd.conf最后
<FilesMatch .php$>
setHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
第二种方法(ProxyPassMatch)
虚拟主机内配置
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /var/www/html/
ProxyRequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
</VirtualHost>
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /var/www/html
<IfModule mpm_event_module>
ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://192.168.99.150:9000/var/www/html/$1
</IfModule>
</VirtualHost>
第三种方法(ProxyPass)
虚拟主机内配置
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /var/www/html/
<LocationMatch ^(.*.php)$>
ProxyPass fcgi://127.0.0.1:9000/var/www/html/
ProxyErrorOverride on
</LocationMatch>
</VirtualHost>
本文参考了:http://www.taoluyuan.com/index.php/archives/37/#http://www.taoluyuan.com/index.php/archives/37/