【问题标题】:apache2.4, php-fpm, proxypassmatch "No protocol handler was valid for the URL.."apache2.4, php-fpm, proxypassmatch "没有协议处理程序对 URL 有效.."
【发布时间】:2018-06-29 13:09:34
【问题描述】:

我一直试图让 apache2.4 虚拟主机将 php 请求传递给 php5-fpm。

我已将 php5-fpm 配置为侦听套接字,在 /etc/php5/fpm/pool.d/www.conf 中有这一行:

listen = /var/run/php5-fpm.sock

我在这台特定机器上配置的唯一虚拟主机是默认主机。这是我的配置方式:

<VirtualHost *:80>

        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/default-error.log
        CustomLog ${APACHE_LOG_DIR}/default-access.log combined


        ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:///var/run/php5-
        fpm.sock|fcgi://127.0.0.1/var/www/html/

        DirectoryIndex /index.php index.php


</VirtualHost>

配置完成后,我重新启动了 apache。对测试 php 文件的请求会在错误日志中产生此消息。

[client 10.0.2.2:51434] AH01144:没有协议处理程序对 网址 /info.php。如果您使用的是 DSO 版本的 mod_proxy,请确保 代理子模块包含在配置中,使用 加载模块。

我有理由确定我安装了正确的模块。 'apachectl -M' 返回以下内容:

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 fastcgi_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_event_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 proxy_http_module (shared)
 setenvif_module (shared)
 status_module (shared)

我错过了什么?

【问题讨论】:

    标签: php apache


    【解决方案1】:

    这可能是 Debian 中的一个错误。它适用于SetHandler "proxy:fcgi://127.0.0.1:9000/",但不适用于"sock:/var/run/php7.0-fpm.sock"。在你的情况下 php5-fpm.sock。从 socket 切换时要注意端口号 9000。

    所以答案是:更改 php-fpm 以监听 ip:port

    listen = 127.0.0.1:9000
    

    瞧!

    注意:在您的 VirtualHost 定义中尝试LogLevel debug。这是我看到的:

    AH01076: url: unix:/run/php/php7.0-fpm.sock/var/www/test.php proxyname: (null) proxyport: 0
    AH01077: declining URL unix:/run/php/php7.0-fpm.sock/var/www/test.php
    

    【讨论】:

      猜你喜欢
      • 2014-07-18
      • 2021-05-26
      • 1970-01-01
      • 2022-10-13
      • 2014-12-01
      • 2016-11-26
      • 2011-01-15
      • 2013-04-28
      • 2014-06-03
      相关资源
      最近更新 更多