Php fpm on apache
Setup of fastcgi (php/apache)
Make sure to have following flags in make.conf:
USE="fpm threads"
APACHE2_MODULES="proxy_fcgi"
APACHE2_MPMS="event"Emerge apache / php to activate flags. In case of using redis
emerge -v1 dev-php/pecl-redisSet user and group to apache for php-fpm in /etc/php/fpm-php7.4/fpm.d/www.conf
user = apache
group = apacheAdd and start php-fpm
rc-update add php-fpm default
/etc/init.d/php-fpm startDisable standard PHP module in apache by editing /etc/conf.d/apache2 and removing '-D PHP'
Activate php-fpm in apache via the fcgi proxy:
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/localhost/htdocs/$1
        DirectoryIndex index.phpMake sure to use the same path in the fcgi url to reference the path on your server (documentroot). Also put the ProxyPassMatch directive after other ProxyPass directives or otherwise the reverse proxies will no longer work for *.php links as they would be intercepted by this one.
Restart apache
Verify things are working
To verify the apache mpm, run
apache2ctl -M | grep mpmIn this case it should return: mpm_event_module (static)
To verify the php fcgi, create a .php file containing:
<?php
        phpinfo();
?>The output should contain: Server API FPM/FastCGI
3 ways to pass HTTP authentication
Modify .htaccess:
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.+)
RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]Alternative .htaccess:
SetEnvIf Authorization (.+) HTTP_AUTHORIZATION=$1Or in FastCGI configuration:
FastCGIConfig -pass-header HTTP_AUTHORIZATION