我想使用 PHP-FPM 池的 chroot 属性将 chroot 设置为 DocumentRoot。使用下面的设置,无论我做什么,我都只会得到一个“找不到文件”。错误:
/etc/php5/fpm/pool.d/example.conf
[example]
user = example
group = example
listen = /var/run/php_fpm_example.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chroot = /opt/jail/example/home/example
php_admin_value[open_basedir]=/opt/jail/example/home/example
/etc/apache2/sites-enabled/example
<VirtualHost *:80>
ServerName example.domain.name
ServerAlias www.example.domain.name
DocumentRoot /opt/jail/example/home/example
<Directory /opt/jail/example/home/example>
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
<IfModule mod_fastcgi.c>
<FilesMatch \.`enter code here`php$>
SetHandler php-script
</FilesMatch>
Action php-script /php5-fpm-handler
Alias /php5-fpm-handler /vhost_example
FastCGIExternalServer /vhost_example -socket /var/run/php_fpm_example.sock
</IfModule>
</VirtualHost>
所以网站本身位于/opt/jail/example/home/example。你可能会觉得奇怪,但没关系,它是由 jailkit 引起的。
谢谢你的帮助。