I just switched from (apache + mpm_prefork) to (apache + php-fpm +mod_fastcgi) using references from
Switching from prefork MPM to worker MPM + php-fpm on ubuntu
http://www.garron.me/en/blog/ubuntu-lamp-apache2-mpm-worker-and-php-fpm.html
Previously main apache configuration was in
/etc/apache2/apache2.conf
and vhost configuration was in
/etc/apache2/sites-available/example1.com
/etc/apache2/sites-available/example2.com
/etc/apache2/sites-available/example3.com
/etc/apache2/sites-available/examplen.com
After switching to php-fpm I need to make configuration profile (pool) like
1. high.conf which should be default with setting like max_execution_time , memory_limit and other are set to high. (It is for drupal commerce websites)
2. light.conf with lower setting value for light weight normal website.
Is it possible to create just two profiles(pools) like this and assign these pools to multiple sites at once.? can I delete above mentioned old vhost configuration file or shall i have to specify pool related settings in it?
Update: This is on VPS with standard user/group like root,www-data etc. and not for configuring shared hosting with multiple user/group.
Update 2: after further reading i tried something which might work pls correct me. copied default www.conf
cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/light.conf
sudo nano /etc/php5/fpm/pool.d/light.conf
replace php5-fpm.sock with php5-fpm-light.sock and made changes to pm.* setting to lower values like
pm.max_children = 20 ;default www.conf value pm.max_children = 50
pm.start_servers = 2 ;default www.conf value pm.start_servers = 3
pm.min_spare_servers = 2;default www.conf value pm.min_spare_servers = 4
pm.max_spare_servers = 4;default www.conf value pm.max_spare_servers = 6
php_admin_value[memory_limit] = 32M ;default www.conf value php_admin_value[memory_limit] = 192M
All light weight vhost files are configured to fastcgi with php5-fpm-light.sock and all other drupal commerce sites are configred to fastcgi with php5-fpm.sock like
#light weight
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-light -socket /var/run/php5-fpm-light.sock -idle-timeout 30 -pass-header Authorization
#drupal commerce -idle-time-out is set to high.
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -idle-timeout 250 -pass-header Authorization
When tried to restart using
service apache2 restart && service php5-fpm restart
error is generating
FastCgiExternalServer: redefinition of previously defined class "/usr/lib/cgi-bin/php5-fcgi-light".
- For the above error is it means seperate pools should be created with same settings but with different socket?
- If yes, shouldn't it increase the memory consumption due to php_admin_value[memory_limit]?
- will -idle-timeout parameter overrides max_execution_time of php.ini or they are both different settings?
The main thing about this apache+php-fpm+fastcgi for me is that there are several config files like following where i couldn't figure out which settings overrides(applied) at the end.
/etc/apache2/conf.d/php5-fpm.conf
/etc/apache2/apache2.conf
/etc/apache2/mods-available/php5.conf
/etc/php5/fpm/php-fpm.conf (might be master process config)
/etc/php5/fpm/php.ini
/etc/php5/fpm/pool.d/www.conf (might be more if multiple pools are present)