Expect result:
If I go to http://foo.local/index.php
, file /var/www/html/foo/index.php
will be executed.
It will be similar if I go to http://bar.local/index.php
, /var/www/html/bar/index.php
will be executed.
Here are my configurations:
<VirtualHost *:80> ServerAlias *.localhost VirtualDocumentRoot /var/www/html/%1/ <IfModule proxy_module> #ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://localhost:9000/var/www/html/$1 (this line works in normal virtualhost) ProxyRemoteMatch ^([^.]+).*/(.*\.php(/.*)?)$ fcgi://localhost:9000/var/www/html/$1/$2 </IfModule> </VirtualHost>
For now, this is working well for static files like .html. But it will print .php files instead of executing them.
Please advise, thank you.
PS: If I use mod_php instead of php-fpm, it would be easier. But for learning purpose, I really want to go the hard way.