Reputation: 920
I am experimenting with upgrading my Centos 7 server from PHP5 to PHP7, and it appears that it's also advised to use the fpm approach as well (which I'm new to).
On my test server, I've installed PHP7.3 no problem, and PHP-FPM. And adding the line
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/my_doc_root/$1
Works.... sort of.
The problem is that, for reasons historical and beyond my control, I have various paths aliased onto /, but which are not within the document root. i.e
Alias /myURL /some/different/path
Obviously the problem is that the ProxyPassMatch
command above will redirect "myURL/fish.php" to a non-existent file ("my_doc_root/fish.php") which gives an error.
Is there a simple solution to this problem? e.g. something I can put in the <Directory>
entries for the document root and for some/different/path
. Alternatively, is there a way I can update the /etc/https/conf.d/php.conf
(from PHP5) to run PHP7 in the old-style way? I don't think I can as there was no libphp file in the php73 packages.
Obviously there are solutions (write separate ProxyPassMatch
directives for every URL not in the document root or reorganize the entire filesystem in a more intelligent way), but I'd rather avoid these if I can; indeed, the latter I simply can't do.
Upvotes: 4
Views: 1997
Reputation: 12382
Try putting your aliases before the ProxyPassMatch
directive, since if it finds that first then the alias will be ignored.
Alias /myURL /some/different/path
<Directory "/some/different/path/">
AllowOverride All
require ip 127.0.0.1
</Directory>
UPDATE Possibly this will help you https://serverfault.com/questions/629099/apache-2-4-php-fpm-mod-proxy-fcgi-alias
Upvotes: 2