diff --git a/roles/php5-fpm/tasks/main.yml b/roles/php5-fpm/tasks/main.yml index 2b20118..a485143 100644 --- a/roles/php5-fpm/tasks/main.yml +++ b/roles/php5-fpm/tasks/main.yml @@ -10,7 +10,8 @@ tags: php5-fpm - name: Copy php5-fpm pool config - copy: src=www.conf dest=/etc/php5/fpm/pool.d/www.conf owner=root group=root mode=0644 + template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.nginx_domain_name }}.conf owner=root group=root mode=0644 + with_items: nginx_vhosts notify: restart php5-fpm tags: php5-fpm diff --git a/roles/php5-fpm/files/www.conf b/roles/php5-fpm/templates/pool.conf.j2 similarity index 98% rename from roles/php5-fpm/files/www.conf rename to roles/php5-fpm/templates/pool.conf.j2 index 2d1ad23..b3fb5e8 100644 --- a/roles/php5-fpm/files/www.conf +++ b/roles/php5-fpm/templates/pool.conf.j2 @@ -1,7 +1,9 @@ -; Start a new pool named 'www'. +{% set domain_name = item.nginx_domain_name %} + +; Start a new pool named '{{ domain_name }}'. ; the variable $pool can we used in any directive and will be replaced by the -; pool name ('www' here) -[www] +; pool name ('{{ domain_name }}' here) +[{{ domain_name }}] ; Per pool prefix ; It only applies on the following directives: @@ -30,7 +32,7 @@ group = nginx ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm.sock +listen = /var/run/php5-fpm-{{ domain_name }}.sock ; Set listen(2) backlog. ; Default Value: 65535 (-1 on FreeBSD and OpenBSD)