diff --git a/configs/shared-vhost-template.tpl b/configs/shared-vhost-template.tpl index 9b9d55f..b3720eb 100644 --- a/configs/shared-vhost-template.tpl +++ b/configs/shared-vhost-template.tpl @@ -33,9 +33,9 @@ # Rewrite SCRIPT_FILENAME for PHP-FPM: the shared httpd serves from # /mnt/users/{user}/{domain}/public_html but the FPM container has - # files at /home/{user}/public_html. Replace the base path so FPM - # can find the PHP files at its local mount point. - ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "expr=%{reqenv:SCRIPT_FILENAME} =~ s|/mnt/users/~~user~~/~~domain~~/public_html|/home/~~user~~/public_html|" + # files at /home/{user}/public_html. Use regex match with backreferences + # to reconstruct the correct path for the FPM container. + ProxyFCGISetEnvIf "reqenv('SCRIPT_FILENAME') =~ m#^/mnt/users/([^/]+)/([^/]+)/public_html(.*)#" SCRIPT_FILENAME "/home/$1/public_html$3" DirectoryIndex index.php index.html index.htm