0

I try to setup a new development-environment in docker, with:

  • Bitnami Apache 2.4 - bitnami/apache:2.4
  • Bitnami PHP 8.0 - bitnami/php-fpm:8.0
  • Bitnami Mysql 5.7 - bitnami/mysql:5.7

The whole thing is up and running fine, except:

In my vhost.conf i redirect php-files to php-fcgi with ProxyPassMatch:

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/app/$1

My problem is, that I need to rewrite *.php-files in a subfolder "dbeS" to "index.php?id=filename". The RewriteRule in .htaccess looks like this:

  RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L]

But it simply does not work. When I open in browser http://localhost/dbeS/mytest.php I should be redirected to http://localhost/dbeS/index.php?id=mytest. But instead he opens the http://localhost/dbeS/mytest.php (which is an empty file).

I read somewhere that the problem is, that ProxyPassMatch is executed before .htaccess so that .htaccess is completely ignored. So I schould have to activate php fcgi with filematch:

<FilesMatch \.php$>
  SetHandler "proxy:fcgi://php:9000/app/"
</FilesMatch>

But this does not work, too. Result is "File not found.". Is there an easy solution for this problem? I hope someone here has an idea how to solve this problem.
Bye, Jörg

I just solved the problem:

I had to change FilesMatch to: <FilesMatch .php$> SetHandler "proxy:fcgi://php:9000"

Then I had to put it inside the Virtualhosts. Additionaly I had wrong Portnumbers in my Virtualhost: I changed <VirtualHost *:80> to <VirtualHost *:8080> and <VirtualHost *:443> to <VirtualHost *:8443>. Now it seems to work as expected.

Mojo78
  • 1
  • 1
  • I just solved the problem: I had to change FilesMatch to: SetHandler "proxy:fcgi://php:9000" Then I had to put it inside the Virtualhosts. Aditionally I had wrong portnumbers in my Virtualhost: I had and had to change it to + to . Now it seems to work as expected. – Mojo78 Nov 22 '22 at 06:22
  • Great that you were able to solve your problem. But please don't edit the solution into your question, instead, post it as an answer and accept it. Otherwise the question will stay in the system as unsolved forever. – Gerald Schneider Nov 22 '22 at 06:31

1 Answers1

0

I just solved the problem:

I had to change FilesMatch to: <FilesMatch .php$> SetHandler "proxy:fcgi://php:9000"

Then I had to put it inside the Virtualhosts. Additionaly I had wrong Portnumbers in my Virtualhost: I changed <VirtualHost *:80> to <VirtualHost *:8080> and <VirtualHost *:443> to <VirtualHost *:8443>. Now it seems to work as expected.

Mojo78
  • 1
  • 1