roles/php-fpm: Only create pools for vhosts that need PHP
Only vhosts running WordPress, etc need PHP. Make sure to set the appopriate variables for each vhost in the host's vars, ie: nginx_vhosts: - domain_name: example.com has_wordpress: True - domain_name: example.net needs_php: True You can set either of them, but not both—needing WordPress implies needing PHP.
This commit is contained in:
parent
740e5195a0
commit
bf7accdade
@ -9,10 +9,11 @@
|
|||||||
- php5-curl
|
- php5-curl
|
||||||
tags: php-fpm, packages
|
tags: php-fpm, packages
|
||||||
|
|
||||||
|
# only copy php-fpm config for vhosts that need WordPress or PHP
|
||||||
- name: Copy php5-fpm pool config
|
- name: Copy php5-fpm pool config
|
||||||
template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: nginx_vhosts is defined
|
when: (item.has_wordpress is defined and item.has_wordpress == True) or (item.needs_php is defined and item.needs_php == True)
|
||||||
notify: restart php5-fpm
|
notify: restart php5-fpm
|
||||||
tags: php-fpm
|
tags: php-fpm
|
||||||
|
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
- php7.0-xml
|
- php7.0-xml
|
||||||
tags: php-fpm, packages
|
tags: php-fpm, packages
|
||||||
|
|
||||||
|
# only copy php-fpm config for vhosts that need WordPress or PHP
|
||||||
- name: Copy php-fpm pool config
|
- name: Copy php-fpm pool config
|
||||||
template: src=php7.0-pool.conf.j2 dest=/etc/php/7.0/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
template: src=php7.0-pool.conf.j2 dest=/etc/php/7.0/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: nginx_vhosts is defined
|
when: (item.has_wordpress is defined and item.has_wordpress == True) or (item.needs_php is defined and item.needs_php == True)
|
||||||
notify: restart php7.0-fpm
|
notify: restart php7.0-fpm
|
||||||
tags: php-fpm
|
tags: php-fpm
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user