CLI/Webserver Setup: Rename webPath to urlPath
This is how the apache docs call it. Nginx speaks of uri. refs #6120
This commit is contained in:
parent
459fc77fc7
commit
7c8e9e6f56
|
@ -102,8 +102,8 @@ class ConfigCommand extends Command
|
||||||
} catch (ProgrammingError $e) {
|
} catch (ProgrammingError $e) {
|
||||||
$this->fail($this->translate('Unknown type') . ': ' . $type);
|
$this->fail($this->translate('Unknown type') . ': ' . $type);
|
||||||
}
|
}
|
||||||
$path = $this->params->get('path', $webserver->getWebPath());
|
$urlPath = $this->params->get('path', $webserver->getUrlPath());
|
||||||
if (! is_string($path) || strlen(trim($path)) === 0) {
|
if (! is_string($urlPath) || strlen(trim($urlPath)) === 0) {
|
||||||
$this->fail($this->translate('The argument --path expects a URL path'));
|
$this->fail($this->translate('The argument --path expects a URL path'));
|
||||||
}
|
}
|
||||||
$documentRoot = $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot()));
|
$documentRoot = $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot()));
|
||||||
|
@ -121,7 +121,7 @@ class ConfigCommand extends Command
|
||||||
$webserver
|
$webserver
|
||||||
->setDocumentRoot($documentRoot)
|
->setDocumentRoot($documentRoot)
|
||||||
->setConfigDir($configDir)
|
->setConfigDir($configDir)
|
||||||
->setWebPath($path);
|
->setUrlPath($urlPath);
|
||||||
$config = $webserver->generate() . "\n";
|
$config = $webserver->generate() . "\n";
|
||||||
if (($file = $this->params->get('file')) !== null) {
|
if (($file = $this->params->get('file')) !== null) {
|
||||||
if (file_exists($file) === true) {
|
if (file_exists($file) === true) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ abstract class Webserver
|
||||||
protected $documentRoot;
|
protected $documentRoot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web path
|
* URL path of Icinga Web 2
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $webPath = '/icingaweb';
|
protected $urlPath = '/icingaweb';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to Icinga Web 2's configuration files
|
* Path to Icinga Web 2's configuration files
|
||||||
|
@ -61,12 +61,12 @@ abstract class Webserver
|
||||||
$template = $this->getTemplate();
|
$template = $this->getTemplate();
|
||||||
|
|
||||||
$searchTokens = array(
|
$searchTokens = array(
|
||||||
'{webPath}',
|
'{urlPath}',
|
||||||
'{documentRoot}',
|
'{documentRoot}',
|
||||||
'{configDir}',
|
'{configDir}',
|
||||||
);
|
);
|
||||||
$replaceTokens = array(
|
$replaceTokens = array(
|
||||||
$this->getWebPath(),
|
$this->getUrlPath(),
|
||||||
$this->getDocumentRoot(),
|
$this->getDocumentRoot(),
|
||||||
$this->getConfigDir()
|
$this->getConfigDir()
|
||||||
);
|
);
|
||||||
|
@ -88,9 +88,9 @@ abstract class Webserver
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setWebPath($urlPath)
|
public function setUrlPath($urlPath)
|
||||||
{
|
{
|
||||||
$this->webPath = '/' . ltrim(trim((string) $urlPath), '/');
|
$this->urlPath = '/' . ltrim(trim((string) $urlPath), '/');
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +99,9 @@ abstract class Webserver
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getWebPath()
|
public function getUrlPath()
|
||||||
{
|
{
|
||||||
return $this->webPath;
|
return $this->urlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Apache extends Webserver
|
||||||
protected function getTemplate()
|
protected function getTemplate()
|
||||||
{
|
{
|
||||||
return <<<'EOD'
|
return <<<'EOD'
|
||||||
Alias {webPath} "{documentRoot}"
|
Alias {urlPath} "{documentRoot}"
|
||||||
|
|
||||||
<Directory "{documentRoot}">
|
<Directory "{documentRoot}">
|
||||||
Options SymLinksIfOwnerMatch
|
Options SymLinksIfOwnerMatch
|
||||||
|
@ -42,7 +42,7 @@ Alias {webPath} "{documentRoot}"
|
||||||
|
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteBase {webPath}/
|
RewriteBase {urlPath}/
|
||||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
RewriteCond %{REQUEST_FILENAME} -d
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Nginx extends Webserver
|
||||||
protected function getTemplate()
|
protected function getTemplate()
|
||||||
{
|
{
|
||||||
return <<<'EOD'
|
return <<<'EOD'
|
||||||
location ~ ^{webPath}/index\.php(.*)$ {
|
location ~ ^{urlPath}/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;
|
||||||
|
@ -28,10 +28,10 @@ location ~ ^{webPath}/index\.php(.*)$ {
|
||||||
fastcgi_param ICINGAWEB_CONFIGDIR {configDir};
|
fastcgi_param ICINGAWEB_CONFIGDIR {configDir};
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^{webPath}(.+)? {
|
location ~ ^{urlPath}(.+)? {
|
||||||
alias {documentRoot};
|
alias {documentRoot};
|
||||||
index index.php;
|
index index.php;
|
||||||
try_files $1 $uri $uri/ {webPath}/index.php$is_args$args;
|
try_files $1 $uri $uri/ {urlPath}/index.php$is_args$args;
|
||||||
}
|
}
|
||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue