Merge pull request #3172 from Icinga/fix/fpm-apache22-config

FPM Config: Support Apache < 2.4
This commit is contained in:
Markus Frosch 2017-12-04 14:09:46 +01:00 committed by GitHub
commit 208e49a616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 16 deletions

View File

@ -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:
```

View File

@ -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
#<IfVersion < 2.4>
# # Forward PHP requests to FPM
# <LocationMatch "^{urlPath}/(.*\.php)$">
# ProxyPassMatch "fcgi://127.0.0.1:9000/{documentRoot}/$1"
# </LocationMatch>
#</IfVersion>
<Directory "{documentRoot}">
Options SymLinksIfOwnerMatch
AllowOverride None
@ -55,13 +60,15 @@ Alias {urlPath} "{documentRoot}"
DirectoryIndex error_norewrite.html
ErrorDocument 404 {urlPath}/error_norewrite.html
</IfModule>
# forwarding PHP requests to FPM
# remove comments if you want to use FPM
#<FilesMatch "\.php$">
# SetHandler "proxy:fcgi://127.0.0.1:9000"
# ErrorDocument 503 {urlPath}/error_unavailable.html
#</FilesMatch>
# Remove comments if you want to use PHP FPM and your Apache version is greater than or equal to 2.4
# <IfVersion >= 2.4>
# # Forward PHP requests to FPM
# <FilesMatch "\.php$">
# SetHandler "proxy:fcgi://127.0.0.1:9000"
# ErrorDocument 503 {urlPath}/error_unavailable.html
# </FilesMatch>
# </IfVersion>
</Directory>
EOD;
}

View File

@ -1,5 +1,12 @@
Alias /icingaweb2 "/usr/share/icingaweb2/public"
<IfVersion < 2.4>
# Forward PHP requests to FPM
<LocationMatch "^/icingaweb2/(.*\.php)$">
ProxyPassMatch "fcgi://127.0.0.1:9000/usr/share/icingaweb2/public/$1"
</LocationMatch>
</IfVersion>
<Directory "/usr/share/icingaweb2/public">
Options SymLinksIfOwnerMatch
AllowOverride None
@ -38,9 +45,11 @@ Alias /icingaweb2 "/usr/share/icingaweb2/public"
ErrorDocument 404 /icingaweb2/error_norewrite.html
</IfModule>
# Forward PHP requests to FPM
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000"
ErrorDocument 503 /icingaweb2/error_unavailable.html
</FilesMatch>
<IfVersion >= 2.4>
# Forward PHP requests to FPM
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000"
ErrorDocument 503 /icingaweb2/error_unavailable.html
</FilesMatch>
</IfVersion>
</Directory>