# Vserver pools in Nginx+php-fpm



## Demontager (Mar 20, 2013)

I've got a 512 MB FreeBSD 9.1 VPS with Nginx as web server and php-fpm which handles .php files. Now trying to find a way to configure Process Manager globally for all virtual hosts. How to set PM globally? E.g. I want to create pm* configurations same for all sites. 

Now I use this configuration:
/usr/local/etc/nginx/pools/domain.conf


```
[domain.com]
 user = www
 group = www
 listen = /tmp/php-fpm.sock
 ;Resources
 pm = dynamic
 pm.max_children = 10
 pm.start_servers = 4
 pm.min_spare_servers = 2
 pm.max_spare_servers = 6
pm.status_path = /status
catch_workers_output = yes
php_flag[display_errors]   = off
php_admin_value[error_log] = /var/log/www/tangoresults.com/php-error.log
php_admin_value[open_basedir] = /usr/local/www/domain.conf
php_admin_value[upload_tmp_dir] = /usr/local/www/domain.conf/tmp 
php_admin_value[session.save_path] = /usr/local/www/domain.conf/tmp
```

Second one /usr/local/etc/nginx/pools/2domain.conf:


```
[2domain.com]
user = www
group = www
listen = /tmp/php-fpm.sock2
;Resources
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.status_path = /status
catch_workers_output = yes
php_flag[display_errors]   = off
php_admin_value[error_log] = /var/log/www/2domain.com/php-error.log
php_admin_value[open_basedir] = /usr/local/www/2domain.com.conf
php_admin_value[upload_tmp_dir] = /usr/local/www/2domain.com/tmp 
php_admin_value[session.save_path] = /usr/local/www/2domain.com/tmp
```

and php-fpm.conf

```
[global]

pid = run/php-fpm.pid
syslog.ident = php-fpm
log_level = error

; Pool Definitions ; 

include=/usr/local/etc/nginx/pools/*.conf
```

Approximately counted that such PM will be enough for my needs for all vhosts:

```
pm.max_children = 25
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 500
```


----------

