Ryan Prentiss
Ryan Prentiss

Reputation: 1642

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/

Upvotes: 8

Views: 3916

Answers (1)

Jasonz
Jasonz

Reputation: 116

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/

Upvotes: 4

Related Questions