Are FilesMatch and ProxyPassMatch interchangeable when proxying php-fpm, and if so are there any circumstances where one would be used over the other?
Currently I am using ProxyPassMatch via a vhost block as per the many online tutorials.
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm/php-fpm.sock|fcgi://127.0.0.1:9000/"
</FilesMatch>
<Proxy "fcgi://127.0.0.1:9000/" enablereuse=on max=10>
vs
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php-fpm/php-fpm.sock|fcgi://127.0.0.1:9000/
One important difference is ProxyPassMatch ignores deny access of .php files in .htaccess.
FilesMatch is better.
See https://ma.ttias.be/apache-2-4-proxypass-for-php-taking-precedence-over-filesfilesmatch-in-htaccess/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With