Per site PHP-FPM configuration on Apache

Install needed packages:

apt-get install libapache2-mod-fastcgi php5-fpm

 

Enable needed apache modules:

a2enmod actions alias fastcgi

 

Add fpm configuration for your site (/etc/php5/fpm/pool.d/site.name.conf)

[site.name]

user = site_user
group = site_group

listen = /var/run/php5-fpm_site.name.sock

listen.owner = www-data
listen.group = www-data
;listen.mode = 0660
pm = dynamic

pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
;chroot =
chdir = /

 

Add this to apache-site config:

<IfModule mod_fastcgi.c>
    AddType application/x-httpd-fastphp5 .php
    Action application/x-httpd-fastphp5 /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi_site.name
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi_site.name -socket /var/run/php5-fpm_site.name.sock -pass-header Authorization
</IfModule>

 

Restart both fpm & apache2

Leave a Reply

Your email address will not be published. Required fields are marked *

*