如何真正使用apache启用php-fpm? [英] How to really enable php-fpm with apache?
本文介绍了如何真正使用apache启用php-fpm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装了apache2.4和php-fpm,但是尽管php-fpm进程正在运行,但我仍然有php5-cgi处理我的请求.
I installed apache2.4 and php-fpm, but I still have php5-cgi processing my requests, althought php-fpm process is running.
这就是我所做的:
apt-get install php5-fpm
apt-get install libapache2-mod-fastcgi
a2enmod actions
像这样编辑/etc/apache2/mods-available/fastcgi.conf:
Edit /etc/apache2/mods-available/fastcgi.conf like that :
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
service apache2 restart
但是现在如果我运行phpinfo(),我会得到:
But now if I run phpinfo() I get :
Server API CGI/FastCGI
代替FPM/FastCGI
instead of FPM/FastCGI
推荐答案
好吧,我终于找到了为什么不使用php fpm的原因: 我需要在我的vhost文件中启用它.
Ok I finally found why php fpm wasn't used : I needed to enable it in my vhost files. Edit :
/etc/apache2/sites-enabled/domain.conf
/etc/apache2/sites-enabled/domain.conf
删除:
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php
添加:
ProxyPassMatch ^/(.*.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi://localhost/home/domain/domains/domain/public_html/$1
这篇关于如何真正使用apache启用php-fpm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文