Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP-FPM FilesMatch and ProxyPassMatch Interchangeability?

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/
like image 403
Ryan Prentiss Avatar asked Oct 30 '22 13:10

Ryan Prentiss


1 Answers

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/

like image 136
Jasonz Avatar answered Nov 15 '22 07:11

Jasonz