From 8b9575233fb6e36c8444b7dec86c444455ef28c1 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Mon, 22 Feb 2016 18:34:00 +0100
Subject: [PATCH] Make apache, fastcgi and jailkit work together

---
 tasks/php.yml        | 27 +++++++++++++++++++++++----
 templates/fcgid.conf | 14 ++++++++++++++
 2 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 templates/fcgid.conf

diff --git a/tasks/php.yml b/tasks/php.yml
index abfa7da..b6aadec 100644
--- a/tasks/php.yml
+++ b/tasks/php.yml
@@ -9,6 +9,7 @@
     - php5
     - php-apc
     - php-soap
+    - php5-cgi
     - php5-mysql
     - php5-xmlrpc
     - php5-gd
@@ -23,10 +24,13 @@
   notify:
     - "PHP | Restart Apache"
 
-# TODO: Upgrade APCu on Ubuntu 14.04
-# @see https://github.com/owncloud/core/issues/14175#issuecomment-74573088
-# wget https://launchpad.net/~ondrej/+archive/ubuntu/php5/+build/6149263/+files/php5-apcu_4.0.6-1%2Bdeb.sury.org~utopic%2B1_amd64.deb
-# sudo dpkg -i php5-apcu_4.0.6-1+deb.sury.org~utopic+1_amd64.deb
+- name: "PHP | Enable Apache modules"
+  apache2_module:
+    name={{ item }}
+    state=present
+  with_items:
+    - fcgid
+  notify: "Apache | Restart Apache"
 
 - name: "PHP | Configuration file, php.ini"
   template:
@@ -38,6 +42,21 @@
   notify:
     - "PHP | Restart Apache"
 
+- name: "PHP | Configuration file, fcgid.conf"
+  template:
+    src=fcgid.conf
+    dest=/etc/apache2/mods-available/fcgid.conf
+    owner=root
+    group=root
+    mode=0644
+  notify:
+    - "PHP | Restart Apache"
+
+# TODO: Upgrade APCu on Ubuntu 14.04
+# @see https://github.com/owncloud/core/issues/14175#issuecomment-74573088
+# wget https://launchpad.net/~ondrej/+archive/ubuntu/php5/+build/6149263/+files/php5-apcu_4.0.6-1%2Bdeb.sury.org~utopic%2B1_amd64.deb
+# sudo dpkg -i php5-apcu_4.0.6-1+deb.sury.org~utopic+1_amd64.deb
+
 - name: "PHP | Cache configuration file, apc.ini"
   template:
     src=etc-php5-conf-d-apc.ini
diff --git a/templates/fcgid.conf b/templates/fcgid.conf
new file mode 100644
index 0000000..2e9008a
--- /dev/null
+++ b/templates/fcgid.conf
@@ -0,0 +1,14 @@
+<IfModule mod_fcgid.c>
+  FcgidConnectTimeout 20
+
+  DefaultMinClassProcessCount 0
+  IdleTimeout 300
+  IdleScanInterval 30
+  MaxProcessCount 15
+  MaxRequestsPerProcess 500
+  PHP_Fix_Pathinfo_Enable 1
+
+  <IfModule mod_mime.c>
+    AddHandler fcgid-script .fcgi
+  </IfModule>
+</IfModule>
-- 
GitLab