Hello,

I am trying to run multiple PHP sites, each in it's own chroot: /var/www/site1, /var/www/site2, etc. Document roots are /var/www/siteX/htdocs.

The issue is that fastcgi DOCUMENT_ROOT and SCRIPT_FILENAME generated by httpd are relative to httpd chroot and include /siteX. php-fpm can't find scripts.

I tried to change DOCUMENT_ROOT and SCRIPT_FILENAME with "fastcgi param". This works for DOCUMENT_ROOT, but for SCRIPT_FILENAME, I need to pass the actual script name.

Conceptually I need:

fastcgi param SCRIPT_FILENAME "/htdocs/<request path>"

Built-in macros like in "block return" and "request rewrite" don't work here.

I can make this work with a single php file like this:

server "site1" {
        listen on * port 80
        root "/site1/htdocs"
        location "*.php" {
                fastcgi param DOCUMENT_ROOT "/htdocs"
                fastcgi param SCRIPT_FILENAME "/htdocs/test.php"
                fastcgi socket "/site1/run/php-fpm.sock"
        }
}

This will serve http://site1/test.php which is located at /var/www/site1/htdocs/test.php

Is there a solution or a workaround? Aside from running all php-fpm pools in /var/www chroot?


Thanks.

--
Nazar

Reply via email to