I have setup like below working for me, with base httpd and php-7.3
package. I have PHP web app installed into /var/www/webapp directory,
with 'web' subdirectory serving as HTTP root, and I only want to
handle request paths starting with '/api' here.
The /etc/httpd.conf:
server "my.server" {
listen on * port 80
location "/api/*" {
root "/webapp/web"
directory index "index.php"
fastcgi socket "/run/php-webapp.sock"
}
}
And the PHP FastCGI conf snip:
[webapp]
user = $pool
group = $pool
listen = /var/www/run/php-$pool.sock
listen.owner = www
listen.group = www
listen.mode = 0660
chroot = /var/www/$pool
вс, 29 дек. 2019 г. в 02:21, Nazar Zhuk <[email protected]>:
>
> 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
>
--
WBR,
Vadim Zhukov