From 032622a4dc8d84e4bf0d957601a4d939a83d0b72 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Thu, 16 Nov 2017 11:06:09 +0100 Subject: [PATCH] php-fpm: Add config file examples and templates --- .../setup/library/Setup/Webserver/Apache.php | 9 +++ packages/files/apache/icingaweb2.conf | 9 +++ packages/files/apache/icingaweb2.fpm.conf | 56 +++++++++++++++++++ public/error_unavailable.html | 7 +++ 4 files changed, 81 insertions(+) create mode 100644 packages/files/apache/icingaweb2.fpm.conf create mode 100644 public/error_unavailable.html diff --git a/modules/setup/library/Setup/Webserver/Apache.php b/modules/setup/library/Setup/Webserver/Apache.php index e8c7d540c..f6b245520 100644 --- a/modules/setup/library/Setup/Webserver/Apache.php +++ b/modules/setup/library/Setup/Webserver/Apache.php @@ -22,6 +22,8 @@ Alias {urlPath} "{documentRoot}" Options SymLinksIfOwnerMatch AllowOverride None + DirectoryIndex index.php + # Apache 2.4 @@ -53,6 +55,13 @@ Alias {urlPath} "{documentRoot}" DirectoryIndex error_norewrite.html ErrorDocument 404 /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 /icingaweb2/error_unavailable.html + # EOD; } diff --git a/packages/files/apache/icingaweb2.conf b/packages/files/apache/icingaweb2.conf index 6bf0b7a66..8da819084 100644 --- a/packages/files/apache/icingaweb2.conf +++ b/packages/files/apache/icingaweb2.conf @@ -4,6 +4,8 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public" Options SymLinksIfOwnerMatch AllowOverride None + DirectoryIndex index.php + # Apache 2.4 @@ -35,4 +37,11 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public" DirectoryIndex error_norewrite.html ErrorDocument 404 /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 /icingaweb2/error_unavailable.html + # diff --git a/packages/files/apache/icingaweb2.fpm.conf b/packages/files/apache/icingaweb2.fpm.conf new file mode 100644 index 000000000..f8f169a49 --- /dev/null +++ b/packages/files/apache/icingaweb2.fpm.conf @@ -0,0 +1,56 @@ +Alias /icingaweb2 "/usr/share/icingaweb2/public" + +# forwarding PHP requests to FPM + + ProxyPassMatch "fcgi://127.0.0.1:9000/usr/share/icingaweb2/public/$1" + + # Apache 2.4 + ProxyErrorOverride on + ErrorDocument 503 /icingaweb2/error_unavailable.html + + + + + Options SymLinksIfOwnerMatch + AllowOverride None + + DirectoryIndex index.php + + + # Apache 2.4 + + Require all granted + + + + + # Apache 2.2 + Order allow,deny + Allow from all + + + SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2" + + EnableSendfile Off + + + RewriteEngine on + RewriteBase /icingaweb2/ + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ index.php [NC,L] + + + + DirectoryIndex error_norewrite.html + ErrorDocument 404 /error_norewrite.html + + + # forwarding PHP requests to FPM + + SetHandler "proxy:fcgi://127.0.0.1:9000" + ErrorDocument 503 /icingaweb2/error_unavailable.html + + diff --git a/public/error_unavailable.html b/public/error_unavailable.html new file mode 100644 index 000000000..d1ef413df --- /dev/null +++ b/public/error_unavailable.html @@ -0,0 +1,7 @@ +

Backend unavailable

+

+ It seems that the PHP FPM service is not running. Make sure to start PHP FPM service in order to access Icinga Web 2. + If you upgraded Icinga Web 2 recently, make sure to read the + docs regarding PHP FPM, + also locally available under /usr/share/icingaweb2/doc/02-Installation.md. +