From ae86dd298706b20d58200a49d04d56bd8c1b0419 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 29 Nov 2017 14:31:18 +0100 Subject: [PATCH 1/3] FPM Config: Support Apache < 2.4 --- packages/files/apache/icingaweb2.fpm.conf | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/files/apache/icingaweb2.fpm.conf b/packages/files/apache/icingaweb2.fpm.conf index fce026e45..9f01c214b 100644 --- a/packages/files/apache/icingaweb2.fpm.conf +++ b/packages/files/apache/icingaweb2.fpm.conf @@ -1,5 +1,12 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public" + + # Forward PHP requests to FPM + + ProxyPassMatch "fcgi://127.0.0.1:9000/usr/share/icingaweb2/public/$1" + + + Options SymLinksIfOwnerMatch AllowOverride None @@ -38,9 +45,11 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public" ErrorDocument 404 /icingaweb2/error_norewrite.html - # Forward PHP requests to FPM - - SetHandler "proxy:fcgi://127.0.0.1:9000" - ErrorDocument 503 /icingaweb2/error_unavailable.html - + = 2.4> + # Forward PHP requests to FPM + + SetHandler "proxy:fcgi://127.0.0.1:9000" + ErrorDocument 503 /icingaweb2/error_unavailable.html + + From 754963ac11c47c2213ec25efe58fade96b6994ef Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 29 Nov 2017 14:31:47 +0100 Subject: [PATCH 2/3] Support FPM config for Apache < 2.4 generated via icingacli --- .../setup/library/Setup/Webserver/Apache.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/modules/setup/library/Setup/Webserver/Apache.php b/modules/setup/library/Setup/Webserver/Apache.php index 369b65507..bb401e6ca 100644 --- a/modules/setup/library/Setup/Webserver/Apache.php +++ b/modules/setup/library/Setup/Webserver/Apache.php @@ -10,14 +10,19 @@ use Icinga\Module\Setup\Webserver; */ class Apache extends Webserver { - /** - * @return array - */ protected function getTemplate() { return <<<'EOD' Alias {urlPath} "{documentRoot}" +# Remove comments if you want to use PHP FPM and your Apache version is older than 2.4 +# +# # Forward PHP requests to FPM +# +# ProxyPassMatch "fcgi://127.0.0.1:9000/{documentRoot}/$1" +# +# + Options SymLinksIfOwnerMatch AllowOverride None @@ -55,13 +60,15 @@ Alias {urlPath} "{documentRoot}" DirectoryIndex error_norewrite.html ErrorDocument 404 {urlPath}/error_norewrite.html - - # forwarding PHP requests to FPM - # remove comments if you want to use FPM - # - # SetHandler "proxy:fcgi://127.0.0.1:9000" - # ErrorDocument 503 {urlPath}/error_unavailable.html - # + +# Remove comments if you want to use PHP FPM and your Apache version is greater than or equal to 2.4 +# = 2.4> +# # Forward PHP requests to FPM +# +# SetHandler "proxy:fcgi://127.0.0.1:9000" +# ErrorDocument 503 {urlPath}/error_unavailable.html +# +# EOD; } From 350a3db7bf7740f23739477e75fd016092b0dc53 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 29 Nov 2017 14:32:30 +0100 Subject: [PATCH 3/3] FPM Doc: Distinct instructions for Apache versions --- doc/02-Installation.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/02-Installation.md b/doc/02-Installation.md index 1c9aeb7fe..4b971ded4 100644 --- a/doc/02-Installation.md +++ b/doc/02-Installation.md @@ -282,7 +282,8 @@ updated the config file for icingaweb2 with defaults for FPM. Check `/etc/httpd/conf.d/icingaweb2.conf` or `/etc/apache2/conf.d/icingaweb2.conf`. And `*.rpm*` `*.dpkg*` files there with updates. -Make sure that the `FilesMatch` part is included for Apache. +Make sure that the `FilesMatch` part is included for Apache >= 2.4. For Apache < 2.4 you have to include the +`LocationMatch` block. Also see the example from icingacli: ```