Skip to content

Commit a1f9f31

Browse files
refactor custom php_fpm_listen integration
1 parent 95333a2 commit a1f9f31

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

roles/matomo/tasks/setup_nginx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
dest: /etc/nginx/sites-available/matomo.conf
3030
mode: '0644'
3131
vars:
32-
php_fpm_custom_listen: '{{ matomo_php_fpm_listen_name if matomo_php_fpm_listen_name is defined else php_fpm_listen }}'
32+
php_fpm_custom_listen: "{{ php_fpm_base + '-' + matomo_php_fpm_pool + '.sock' if matomo_php_fpm_pool is defined else php_fpm_listen }}"
3333
notify: Reload nginx
3434

3535
- name: Ensure matomo vhost is enabled

roles/php_fpm/defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ php_fpm_pools:
66
- name: www
77
user: '{{ nginx_user }}'
88
group: '{{ nginx_group }}'
9-
listen_name: '{{ php_fpm_listen }}'
9+
# this is default (you can skip pool, if it is www)
10+
pool: www
1011
skip_user_create: true
1112

1213
php_fpm_listen_allowed_clients: 127.0.0.1

roles/php_fpm/tasks/pool.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@
2525
owner: root
2626
group: root
2727
notify: Restart php-fpm
28+
vars:
29+
active_php_fpm_listen: "{{ php_fpm_base + '-' + pool.pool + '.sock' if instance is defined and pool.pool is defined and pool.pool != 'www' else php_fpm_listen }}"

roles/php_fpm/templates/pool.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ group = {{ pool.group | default(pool.user) | default(pool.name) }}
3434
; (IPv6 and IPv4-mapped) on a specific port;
3535
; '/path/to/unix/socket' - to listen on a unix socket.
3636
; Note: This value is mandatory.
37-
listen = {{ pool.listen_name if pool.listen_name is defined else php_fpm_listen }}
37+
listen = {{ active_php_fpm_listen }}
3838

3939
; Set listen(2) backlog.
4040
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

0 commit comments

Comments
 (0)