diff --git a/library/Icinga/Web/Setup/Webserver/Apache2.php b/library/Icinga/Web/Setup/Webserver/Apache2.php
index 49db80e9b..846dc0a96 100644
--- a/library/Icinga/Web/Setup/Webserver/Apache2.php
+++ b/library/Icinga/Web/Setup/Webserver/Apache2.php
@@ -14,15 +14,16 @@ class Apache2 extends Webserver
*/
protected function getTemplate()
{
- return array(
- 'Alias {webPath} {publicPath}',
- '',
- ' Options -Indexes',
- ' AllowOverride All',
- ' Order allow,deny',
- ' Allow from all',
- ' EnableSendfile Off',
- ''
- );
+ return <<<'EOD'
+Alias {webPath} {publicPath}
+
+ Options -Indexes
+ AllowOverride All
+ Order allow,deny
+ Allow from all
+ EnableSendfile Off
+
+EOD;
+
}
}
diff --git a/library/Icinga/Web/Setup/Webserver/Apache24.php b/library/Icinga/Web/Setup/Webserver/Apache24.php
index 29e927770..c9992e794 100644
--- a/library/Icinga/Web/Setup/Webserver/Apache24.php
+++ b/library/Icinga/Web/Setup/Webserver/Apache24.php
@@ -7,7 +7,7 @@ namespace Icinga\Web\Setup\Webserver;
/**
* Generate apache2.4 configuration
*/
-class Apache24 extends Apache2
+class Apache24 extends Webserver
{
/**
* Use default template and change granted syntax for 2.4
@@ -16,11 +16,14 @@ class Apache24 extends Apache2
*/
protected function getTemplate()
{
- $template = parent::getTemplate();
- $replace = array(
- ' Require all granted'
- );
- array_splice($template, count($template)-4, 2, $replace);
- return $template;
+ return <<<'EOD'
+Alias {webPath} {publicPath}
+
+ Options -Indexes
+ AllowOverride All
+ Require all granted
+ EnableSendfile Off
+
+EOD;
}
}
diff --git a/library/Icinga/Web/Setup/Webserver/Nginx.php b/library/Icinga/Web/Setup/Webserver/Nginx.php
index 90996b2a0..decd7dda5 100644
--- a/library/Icinga/Web/Setup/Webserver/Nginx.php
+++ b/library/Icinga/Web/Setup/Webserver/Nginx.php
@@ -16,22 +16,20 @@ class Nginx extends Webserver
*/
protected function getTemplate()
{
- return array(
- 'location ~ ^{webPath}/index\.php(.*)$ {',
- ' # fastcgi_pass 127.0.0.1:9000;',
- ' fastcgi_pass unix:/var/run/php5-fpm.sock;',
- ' fastcgi_index index.php;',
- ' include fastcgi_params;',
- ' fastcgi_param SCRIPT_FILENAME {publicPath}/index.php;',
- '}',
+ return <<<'EOD'
+location ~ ^{webPath}/index\.php(.*)$ {
+ # fastcgi_pass 127.0.0.1:9000;
+ fastcgi_pass unix:/var/run/php5-fpm.sock;
+ fastcgi_index index.php;
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME {publicPath}/index.php;
+}
-
-
- 'location ~ ^{webPath} {',
- ' alias {publicPath};',
- ' index index.php;',
- ' try_files $uri $uri/ {webPath}/index.php$is_args$args;',
- '}',
- );
+location ~ ^{webPath} {
+ alias {publicPath};
+ index index.php;
+ try_files $uri $uri/ {webPath}/index.php$is_args$args;
+}
+EOD;
}
}
diff --git a/library/Icinga/Web/Setup/Webserver/Webserver.php b/library/Icinga/Web/Setup/Webserver/Webserver.php
index b246cffd0..56ade8467 100644
--- a/library/Icinga/Web/Setup/Webserver/Webserver.php
+++ b/library/Icinga/Web/Setup/Webserver/Webserver.php
@@ -66,9 +66,7 @@ abstract class Webserver
public function generate()
{
$template = $this->getTemplate();
- if (is_array($template)) {
- $template = implode(PHP_EOL, $template);
- }
+
$searchTokens = array(
'{webPath}',
'{publicPath}'
@@ -84,7 +82,7 @@ abstract class Webserver
/**
* Specific template
*
- * @return array|string
+ * @return string
*/
abstract protected function getTemplate();