Sethandler fcgi 代理在 Ubuntu 14.04/Apache 2.4.7 php7.2-fpm 上不起作用 [英] Sethandler fcgi proxy not working on Ubuntu 14.04/Apache 2.4.7 php7.2-fpm

查看:24
本文介绍了Sethandler fcgi 代理在 Ubuntu 14.04/Apache 2.4.7 php7.2-fpm 上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Ubuntu 14.04 机器上运行带有 mod_php 的 PHP 5.6 和带有 php-fpm/mod-fastcgi 并行的 PHP 7.2.在装有 Ubuntu 16.04、Apache 2.4 和 PHP 7.1/mod_php 和 PHP 7.2/php-fpm 的另一台机器上,一切正常.我的步骤:

I need to run PHP 5.6 with mod_php and PHP 7.2 with php-fpm/mod-fastcgi parallel on a Ubuntu 14.04 machine. On a different machine with Ubuntu 16.04, Apache 2.4 and PHP 7.1/mod_php and PHP 7.2/php-fpm everything works as expected. My steps:

apt install libapache2-mod-fastcgi php7.2-fpm php7.2 php7.2-common
a2enmod actions fastcgi alias proxy_fcgi

我使用不同的池名称、用户名和组、套接字文件/var/run/php/php7.2-fpm-mysite.sock 设置了一个 fpm conf 文件.服务php7.2-fpm启动,socket文件创建.虚拟主机的 Docroot 所有者设置为 fmp conf 文件中给出的用户名和组.我在虚拟主机中添加了以下几行:

I set up an fpm conf file with a different pool name, username and group, socket file /var/run/php/php7.2-fpm-mysite.sock. Service php7.2-fpm is started and the socket file is created. Docroot owner for the virtual host is set to the username and group given in the fmp conf file. I added the follwoing lines to the virtual host:

<FilesMatch \.php$>
 SetHandler "proxy:unix:/var/run/php/php7.2-fpm-mysite.sock|fcgi://localhost/"
</FilesMatch>

在 Ubuntu 16.04 机器上,一切正常.一台虚拟主机使用的是 php-fpm 7.2,其他所有站点仍在使用 php_mod 7.1.

On the Ubuntu 16.04 machine, everything works fine. The one virtual host is using php-fpm 7.2, all other sites are still using the php_mod 7.1.

然后我在 Ubuntu 14.04 机器上重复了所有这些步骤.我没有错误,但是在浏览网页时,PHP 代码以纯文本形式打印.代理显然不起作用,但我不知道为什么.套接字文件已创建,php-fpm 日志中没有错误.带有 mod_php 5.6 的 Ubuntu 14.04 机器上的所有其他页面都按预期工作.在此先感谢您的帮助.如果需要,我可以提供更多配置.

Then I repeated all these steps on the Ubuntu 14.04 machine. I had no errors, but when browsing a web page, the PHP code is printed in plain. The proxy is not working obviously, but I have no idea why. Socket file is created, no errors in php-fpm log. All other pages on the Ubuntu 14.04 machine with mod_php 5.6 are working as expected. Thanks in advance for any help. I can provide more config if needed.

最好的问候马蒂亚斯

推荐答案

我明白了.因为 Apache 2.4.7 不支持 socket 文件,所以我不得不使用 ProxyPassMatch

I got it. Because Apache 2.4.7 does not support socket file, I had to use ProxyPassMatch

这篇关于Sethandler fcgi 代理在 Ubuntu 14.04/Apache 2.4.7 php7.2-fpm 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆