I’m using php7.0-fpm along with mod_fcgid, mod_proxy, and mod_rewrite to get Apache to send the right information to PHP to serve the pages via FPM.
My relevant <VirtualHost> entry has this to do the forwarding:
AcceptPathInfo On
DocumentRoot /var/www/nextcloud
SetEnv proxy-fcgi-pathinfo last-dot
SetEnv front_controller_active true
<Proxy fcgi://unique-domain-name-string>
ProxySet connectiontimeout=5 timeout=240
</Proxy>
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://unique-domain-name-string/"
</FilesMatch>
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
RewriteRule (.*) - [H=text/html]
It works well enough, but one thing doesn’t work from the web (although it works fine using occ: I cannot enable/disable applications. It seems that when you click the Enable button on the web page, it does a POST to /index.php/settings/ajax/enableapp.php.
This bit (two .php files on the path) seems to throw my config into a bit of a tizzy, returning the source code of the index.php file. If I edit the request and send it instead without the /index.php and leave the rest, the command executes successfully. I’ve tried changing proxy-fcgi-pathinfo last-dot to proxy-fcgi-pathinfo first-dot, but it made no difference.