diff --git a/templates/vhost.conf b/templates/vhost.conf
index 7e36de29492b587988936df9488b179cb27bcd04..18b8ebeaabf14db3b12c3475fa70a568bc9af5e5 100644
--- a/templates/vhost.conf
+++ b/templates/vhost.conf
@@ -70,7 +70,13 @@
   </Location>
 {% else %}
 {% if php_fpm and drupal.jail is defined and not php_fpm_socket|default(false) %}
-  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:{{ drupal.jail.port }}{{ drupalRoot }}/$1
+  <LocationMatch "/fpm-status">
+    Include /etc/apache2/{{ apache_conf_dir }}/global-deny.conf
+    ProxyPass fcgi://127.0.0.1:{{ drupal.jail.port }}
+  </LocationMatch>
+  <FilesMatch \.php$>
+    SetHandler "proxy:fcgi://127.0.0.1:{{ drupal.jail.port }}"
+  </FilesMatch>
 {% endif %}
 {% endif %}
 {% if drupal_domain.bigpipe|default(false) %}