Setup/Webserver: Consolidate apache config
Add configDir to replace tokens. refs #6120
This commit is contained in:
parent
ddf6bb4472
commit
f07cbcc107
|
@ -128,7 +128,7 @@ class SetupCommand extends Command
|
|||
*
|
||||
* USAGE:
|
||||
*
|
||||
* icingacli setup webserver <apache2|apache24|nginx> [options]
|
||||
* icingacli setup webserver <apache2|nginx> [options]
|
||||
*
|
||||
* OPTIONS:
|
||||
*
|
||||
|
@ -141,11 +141,13 @@ class SetupCommand extends Command
|
|||
*
|
||||
* EXAMPLES:
|
||||
*
|
||||
* icingacli setup webserver apache24
|
||||
* icingacli setup webserver apache2
|
||||
*
|
||||
* icingacli setup webserver apache2 --path /icingaweb --publicPath /usr/share/icingaweb/public
|
||||
*
|
||||
* icingacli setup webserver apache2 --file /etc/apache2/conf.d/icingaweb.conf
|
||||
*
|
||||
* icingacli setup webserver nginx
|
||||
*/
|
||||
public function webserverAction()
|
||||
{
|
||||
|
|
|
@ -15,14 +15,37 @@ class Apache2 extends Webserver
|
|||
protected function getTemplate()
|
||||
{
|
||||
return <<<'EOD'
|
||||
Alias {webPath} {publicPath}
|
||||
<directory {publicPath}>
|
||||
Options -Indexes
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
EnableSendfile Off
|
||||
</directory>
|
||||
Alias {webPath} "{publicPath}"
|
||||
|
||||
<Directory "{publicPath}">
|
||||
Options SymLinksIfOwnerMatch
|
||||
AllowOverride None
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
<RequireAll>
|
||||
Require all granted
|
||||
</RequireAll>
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</IfModule>
|
||||
|
||||
SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb/
|
||||
|
||||
EnableSendfile Off
|
||||
|
||||
RewriteEngine on
|
||||
RewriteBase {webPath}/
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</Directory>
|
||||
EOD;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Web\Setup\Webserver;
|
||||
|
||||
/**
|
||||
* Generate apache2.4 configuration
|
||||
*/
|
||||
class Apache24 extends Webserver
|
||||
{
|
||||
/**
|
||||
* Use default template and change granted syntax for 2.4
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getTemplate()
|
||||
{
|
||||
return <<<'EOD'
|
||||
Alias {webPath} {publicPath}
|
||||
<directory {publicPath}>
|
||||
Options -Indexes
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
EnableSendfile Off
|
||||
</directory>
|
||||
EOD;
|
||||
}
|
||||
}
|
|
@ -69,11 +69,13 @@ abstract class Webserver
|
|||
|
||||
$searchTokens = array(
|
||||
'{webPath}',
|
||||
'{publicPath}'
|
||||
'{publicPath}',
|
||||
'{configPath}',
|
||||
);
|
||||
$replaceTokens = array(
|
||||
$this->getWebPath(),
|
||||
$this->getPublicPath()
|
||||
$this->getPublicPath(),
|
||||
$this->getApp()->getConfigDir()
|
||||
);
|
||||
$template = str_replace($searchTokens, $replaceTokens, $template);
|
||||
return $template;
|
||||
|
|
Loading…
Reference in New Issue