Replicating mod_fastcgi with ProxyPassMatch (PHP-FPM setup)

apache-2.2apache-2.4php-fpm

I want to move from Apache 2.2 to Apache 2.4, but there is no mod_fastcgi, and the recommended upgrade path is mod_proxy_fcgi

However I can't figure out how to accomplish the following:

<IfModule mod_fastcgi.c>
    Alias /php5.fcgi /usr/local/www/fastcgi/php5.fcgi
    FastCGIExternalServer /usr/local/www/fastcgi/php5.fcgi -flush -host 127.0.0.1:9000
    AddType application/x-httpd-fastphp5 .php
    Action application/x-httpd-fastphp5 /php5.fcgi

    <Directory "/usr/local/www/fastcgi/">
        Order deny,allow
        Deny from all
        <Files "php5.fcgi">
            Order allow,deny
            Allow from all
        </Files>
    </Directory>
</IfModule>

This allows all the virtual hosts and everything that requires PHP to use a single PHP-FPM process, the new ProxyPassMatch requires that I set up an individual entry for each vhost, which is time consuming and error prone…

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/vhost/$1

For now I've reverted back to Apache 2.2, but I would love to find a solution to this problem.

Best Answer

You could use server variables to achieve what you want: The answer from this question might help you:

0-is-not-replaced-by-server-name-when-used-with-apaches-proxypassmatch