mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 00:04:04 +02:00
parent
162b35566c
commit
ddf6bb4472
@ -14,15 +14,16 @@ class Apache2 extends Webserver
|
||||
*/
|
||||
protected function getTemplate()
|
||||
{
|
||||
return array(
|
||||
'Alias {webPath} {publicPath}',
|
||||
'<directory {publicPath}>',
|
||||
' Options -Indexes',
|
||||
' AllowOverride All',
|
||||
' Order allow,deny',
|
||||
' Allow from all',
|
||||
' EnableSendfile Off',
|
||||
'</directory>'
|
||||
);
|
||||
return <<<'EOD'
|
||||
Alias {webPath} {publicPath}
|
||||
<directory {publicPath}>
|
||||
Options -Indexes
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
EnableSendfile Off
|
||||
</directory>
|
||||
EOD;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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}
|
||||
<directory {publicPath}>
|
||||
Options -Indexes
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
EnableSendfile Off
|
||||
</directory>
|
||||
EOD;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user