Solved [Solved] Apache 2.4 + PHP-FPM problem


I'm trying to set up an Apache 2.4 with PHP-FPM but I'm having issues getting the configuration to work. Most documents I've read were either written for Linux distros and/or are obsolete somehow.

Anyways, here's the scenario:

Apache 2.4.9 (info) (loaded modules)
PHP 5.5.13 (FPM)

My vhost (configuration) is situated in my home directory (/home/user/www), I'm not using the userdir module.
PHP-FPM pool configuration

When I enable Apache's PHP module and delete that ProxyPassMatch line from the vhost it works normally, but it's not using FastCGI. Otherwise, PHP isn't parsed at all.
Not sure if I'm doing something wrong or I missed some configuration.

Thanks in advance!
Re: Apache 2.4 + PHP-FPM problem


Here is the official guide:

You may check both access and error logs, also you may start with default php-fpm.conf, since I don't see you are using SuExec, your section should look like:

user = www
group = www

listen =

pm = dynamic

pm.max_children = 5

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 3

In global section of php-fpm.conf you may add:
error_log = /path_to_log/php-fpm.log
log_level = notice
or debug log level and check the log for any information.
Re: Apache 2.4 + PHP-FPM problem

Hey man, can I comment the default php-fpm.conf pool so only my custom pool is being used (it's included from another directory)?
Re: Apache 2.4 + PHP-FPM problem

I sorted this issue out by some good old trial and error.

Apache vhost configuration:

        ServerAdmin user@mail.tld
        DocumentRoot /home/user/www

        ProxyPassMatch ^/(.*\.php)$ fcgi://$1

        ErrorLog /home/user/logs/error.log
        CustomLog /home/user/logs/access.log combined

        <Directory /home/user/www>
                AllowOverride All
                Order deny,allow
                Allow from all
                Require all granted
                DirectoryIndex index.html index.php


PHP-FPM Pool config:
listen =
user = user
group = user
pm = dynamic
pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 5
pm.max_requests = 200
catch_workers_output = yes
request_terminate_timeout = 0
request_slowlog_timeout = 0
slowlog = /home/user/logs/php-slowlog.log
access.log = /home/user/logs/php-access.log
php_admin_value[error_log] = /home/user/logs/php-error.log

/etc/login.conf (or ~/.login.conf) changed default 022 to:

Since home directories on my VPS are isolated from other users I set lossy directory/files permissions (770 and 660) to avoid some issues my CMS is having and everything works awesome.

Does anyone have some suggestions regarding security setup perhaps?