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()
|
protected function getTemplate()
|
||||||
{
|
{
|
||||||
return array(
|
return <<<'EOD'
|
||||||
'Alias {webPath} {publicPath}',
|
Alias {webPath} {publicPath}
|
||||||
'<directory {publicPath}>',
|
<directory {publicPath}>
|
||||||
' Options -Indexes',
|
Options -Indexes
|
||||||
' AllowOverride All',
|
AllowOverride All
|
||||||
' Order allow,deny',
|
Order allow,deny
|
||||||
' Allow from all',
|
Allow from all
|
||||||
' EnableSendfile Off',
|
EnableSendfile Off
|
||||||
'</directory>'
|
</directory>
|
||||||
);
|
EOD;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace Icinga\Web\Setup\Webserver;
|
|||||||
/**
|
/**
|
||||||
* Generate apache2.4 configuration
|
* Generate apache2.4 configuration
|
||||||
*/
|
*/
|
||||||
class Apache24 extends Apache2
|
class Apache24 extends Webserver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Use default template and change granted syntax for 2.4
|
* Use default template and change granted syntax for 2.4
|
||||||
@ -16,11 +16,14 @@ class Apache24 extends Apache2
|
|||||||
*/
|
*/
|
||||||
protected function getTemplate()
|
protected function getTemplate()
|
||||||
{
|
{
|
||||||
$template = parent::getTemplate();
|
return <<<'EOD'
|
||||||
$replace = array(
|
Alias {webPath} {publicPath}
|
||||||
' Require all granted'
|
<directory {publicPath}>
|
||||||
);
|
Options -Indexes
|
||||||
array_splice($template, count($template)-4, 2, $replace);
|
AllowOverride All
|
||||||
return $template;
|
Require all granted
|
||||||
|
EnableSendfile Off
|
||||||
|
</directory>
|
||||||
|
EOD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,20 @@ class Nginx extends Webserver
|
|||||||
*/
|
*/
|
||||||
protected function getTemplate()
|
protected function getTemplate()
|
||||||
{
|
{
|
||||||
return array(
|
return <<<'EOD'
|
||||||
'location ~ ^{webPath}/index\.php(.*)$ {',
|
location ~ ^{webPath}/index\.php(.*)$ {
|
||||||
' # fastcgi_pass 127.0.0.1:9000;',
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
' fastcgi_pass unix:/var/run/php5-fpm.sock;',
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
' fastcgi_index index.php;',
|
fastcgi_index index.php;
|
||||||
' include fastcgi_params;',
|
include fastcgi_params;
|
||||||
' fastcgi_param SCRIPT_FILENAME {publicPath}/index.php;',
|
fastcgi_param SCRIPT_FILENAME {publicPath}/index.php;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
|
location ~ ^{webPath} {
|
||||||
|
alias {publicPath};
|
||||||
'location ~ ^{webPath} {',
|
index index.php;
|
||||||
' alias {publicPath};',
|
try_files $uri $uri/ {webPath}/index.php$is_args$args;
|
||||||
' index index.php;',
|
}
|
||||||
' try_files $uri $uri/ {webPath}/index.php$is_args$args;',
|
EOD;
|
||||||
'}',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,7 @@ abstract class Webserver
|
|||||||
public function generate()
|
public function generate()
|
||||||
{
|
{
|
||||||
$template = $this->getTemplate();
|
$template = $this->getTemplate();
|
||||||
if (is_array($template)) {
|
|
||||||
$template = implode(PHP_EOL, $template);
|
|
||||||
}
|
|
||||||
$searchTokens = array(
|
$searchTokens = array(
|
||||||
'{webPath}',
|
'{webPath}',
|
||||||
'{publicPath}'
|
'{publicPath}'
|
||||||
@ -84,7 +82,7 @@ abstract class Webserver
|
|||||||
/**
|
/**
|
||||||
* Specific template
|
* Specific template
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract protected function getTemplate();
|
abstract protected function getTemplate();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user