From c68b555a5f704c7d882e5521c1dcca9d81483aaf Mon Sep 17 00:00:00 2001 From: jknapp Date: Wed, 1 Apr 2026 12:22:53 -0700 Subject: [PATCH] Fix PHP-FPM path mismatch in shared httpd vhost template The shared httpd serves files from /mnt/users/{user}/{domain}/public_html but PHP-FPM containers have them at /home/{user}/public_html. When Apache proxied PHP requests via fcgi, SCRIPT_FILENAME pointed to the Apache path which doesn't exist inside the FPM container, causing "File not found". Added ProxyFCGISetEnvIf to rewrite SCRIPT_FILENAME from the shared httpd path to the FPM container path before proxying the request. Co-Authored-By: Claude Opus 4.6 (1M context) --- configs/shared-vhost-template.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/shared-vhost-template.tpl b/configs/shared-vhost-template.tpl index 3ca0c57..9b9d55f 100644 --- a/configs/shared-vhost-template.tpl +++ b/configs/shared-vhost-template.tpl @@ -31,6 +31,12 @@ SetHandler "proxy:fcgi://~~fpm_host~~:~~fpm_port~~" + # 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|" + DirectoryIndex index.php index.html index.htm ErrorLog "/var/log/httpd/~~domain~~-error.log"