我一直在尝试在运行Apache 2.4和PHP版本7.2的CentOS 8中配置Php-FPM。我需要托管多个域,并通过更改以下参数将默认的/etc/php-fpm.d/www.conf
复制到domainname.conf
来为每个域创建一个单独的池
listen = /var/run/php-fpm/domainname.com.sock
...
listen.allowed_clients = 127.0.0.1
listen.owner = domainusername
listen.group = domainusername
listen.mode = 0660
user = domainsername
group = domainusername
我的用户主目录权限为700。在每个域的Apache virtualhost文件中启用了LoadModule mpm_worker_module modules/mod_mpm_worker.so
uder /etc/httpd/conf.modules.d/00-mpm.conf
和disabled prefork module
条目
<Virtualhost *:80>
ServerName domainname.com
ServerAlias www.domainname.com
DocumentRoot /home/domainusername/public_html
<Directory /home/domainusername/public_html>
Options +FollowSymLinks +Indexes
AllowOverride all
Require all granted
</Directory>
ErrorLog logs/domainname.com-error_log
CustomLog logs/domainname.com-access_log common
SuexecUserGroup domainusername domainusername
# Proxy declaration
<Proxy "unix:/var/run/php-fpm/domainname.com.sock|fcgi://php-fpm">
# we must declare a parameter in here (doesn't matter which) or it'll not register the proxy ahead of time
ProxySet disablereuse=off
# Note: If you configure php-fpm to use the "ondemand" process manager, then use "ProxySet disablereuse=on"
</Proxy>
# Redirect to the proxy
<FilesMatch \.php$>
SetHandler proxy:fcgi://php-fpm
</FilesMatch>
</VirtualHost>
但是面对服务问题:
如果更改
,则无法获得服务listen.owner = domainusername
listen.group = domainusername
由于我是Php-FPM的新手,所以我真的不知道我是否以正确的方式配置了它。如果我能够使用Php-FPM像mod_ruid2所提供的那样获得期望,那就太好了。
我引用了以下链接,但没有发现运气https://www.stephenrlang.com/2018/02/centos-7-apache-2-4-with-php-fpm/
谢谢。