From e5e055d1980031743253abbe2aeb42aad0635a8d Mon Sep 17 00:00:00 2001 From: jknapp Date: Wed, 1 Apr 2026 12:32:52 -0700 Subject: [PATCH] Fix ProxyFCGISetEnvIf syntax for SCRIPT_FILENAME rewrite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous expr= with s|...|...| substitution syntax doesn't exist in Apache expressions — it silently failed, leaving SCRIPT_FILENAME pointing to /mnt/users/ which PHP-FPM can't find. Fixed to use regex match in the conditional with backreferences: reqenv('SCRIPT_FILENAME') =~ m#^/mnt/users/([^/]+)/([^/]+)/public_html(.*)# -> /home/$1/public_html$3 This is also generic (captures user from the path) so the template no longer needs per-user placeholder substitution for this directive. Co-Authored-By: Claude Opus 4.6 (1M context) --- configs/shared-vhost-template.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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