From 6fd155d14e112b6e6582186e43230ca6d2109dcc Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 17 Feb 2021 18:04:15 +0100
Subject: [PATCH] ansible/roles/apache#10 Fix default configuration for FPM and
 Apache

---
 tasks/php.yml | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tasks/php.yml b/tasks/php.yml
index 6f6771e..400a7e3 100644
--- a/tasks/php.yml
+++ b/tasks/php.yml
@@ -159,11 +159,13 @@
 - name: FPM Default Pool Configuration
   template:
     src: php_pool.conf
-    dest: /etc/{{ php_base_dir }}/fpm/pool.d/www.conf
+    dest: /etc/{{ php_base_dir }}/fpm/pool.d/default.conf
     owner: root
     group: root
     mode: 0644
   when: (php_version_main|default(7) == 7) and php_fpm
+  notify:
+    - Restart PHP-FPM
 
 - block:
     - name: Set facts for PHP 7
@@ -186,6 +188,22 @@
         mode: 0644
       notify:
         - Initial Logrotate
+
+    - name: Adjust apache config for default site
+      lineinfile:
+        dest: /etc/apache2/sites-available/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
+        regexp: '{{ item.regexp }}'
+        line: '{{ item.line }}'
+      with_items:
+        - regexp: 'ProxyPassMatch'
+          line: '  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:{{ php_fpm_port|default(9999) }}/var/www{{apache_server_default_root}}/$1'
+        - regexp: '<Proxy fcgi'
+          line: '  <Proxy fcgi://127.0.0.1:{{ php_fpm_port|default(9999) }}>'
+      when: apache_server_default
+      notify:
+        - Restart PHP-FPM
+        - Restart Apache
+
   when: php_fpm
   tags:
     - logrotate
-- 
GitLab