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) {
|
||||
$this->fail($this->translate('Unknown type') . ': ' . $type);
|
||||
}
|
||||
$path = $this->params->get('path', $webserver->getWebPath());
|
||||
if (! is_string($path) || strlen(trim($path)) === 0) {
|
||||
$urlPath = $this->params->get('path', $webserver->getUrlPath());
|
||||
if (! is_string($urlPath) || strlen(trim($urlPath)) === 0) {
|
||||
$this->fail($this->translate('The argument --path expects a URL path'));
|
||||
}
|
||||
$documentRoot = $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot()));
|
||||
|
@ -121,7 +121,7 @@ class ConfigCommand extends Command
|
|||
$webserver
|
||||
->setDocumentRoot($documentRoot)
|
||||
->setConfigDir($configDir)
|
||||
->setWebPath($path);
|
||||
->setUrlPath($urlPath);
|
||||
$config = $webserver->generate() . "\n";
|
||||
if (($file = $this->params->get('file')) !== null) {
|
||||
if (file_exists($file) === true) {
|
||||
|
|
|
@ -20,11 +20,11 @@ abstract class Webserver
|
|||
protected $documentRoot;
|
||||
|
||||
/**
|
||||
* Web path
|
||||
* URL path of Icinga Web 2
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $webPath = '/icingaweb';
|
||||
protected $urlPath = '/icingaweb';
|
||||
|
||||
/**
|
||||
* Path to Icinga Web 2's configuration files
|
||||
|
@ -61,12 +61,12 @@ abstract class Webserver
|
|||
$template = $this->getTemplate();
|
||||
|
||||
$searchTokens = array(
|
||||
'{webPath}',
|
||||
'{urlPath}',
|
||||
'{documentRoot}',
|
||||
'{configDir}',
|
||||
);
|
||||
$replaceTokens = array(
|
||||
$this->getWebPath(),
|
||||
$this->getUrlPath(),
|
||||
$this->getDocumentRoot(),
|
||||
$this->getConfigDir()
|
||||
);
|
||||
|
@ -88,9 +88,9 @@ abstract class Webserver
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setWebPath($urlPath)
|
||||
public function setUrlPath($urlPath)
|
||||
{
|
||||
$this->webPath = '/' . ltrim(trim((string) $urlPath), '/');
|
||||
$this->urlPath = '/' . ltrim(trim((string) $urlPath), '/');
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,9 @@ abstract class Webserver
|
|||
*
|
||||
* @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()
|
||||
{
|
||||
return <<<'EOD'
|
||||
Alias {webPath} "{documentRoot}"
|
||||
Alias {urlPath} "{documentRoot}"
|
||||
|
||||
<Directory "{documentRoot}">
|
||||
Options SymLinksIfOwnerMatch
|
||||
|
@ -42,7 +42,7 @@ Alias {webPath} "{documentRoot}"
|
|||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteBase {webPath}/
|
||||
RewriteBase {urlPath}/
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
|
|
|
@ -19,7 +19,7 @@ class Nginx extends Webserver
|
|||
protected function getTemplate()
|
||||
{
|
||||
return <<<'EOD'
|
||||
location ~ ^{webPath}/index\.php(.*)$ {
|
||||
location ~ ^{urlPath}/index\.php(.*)$ {
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
|
@ -28,10 +28,10 @@ location ~ ^{webPath}/index\.php(.*)$ {
|
|||
fastcgi_param ICINGAWEB_CONFIGDIR {configDir};
|
||||
}
|
||||
|
||||
location ~ ^{webPath}(.+)? {
|
||||
location ~ ^{urlPath}(.+)? {
|
||||
alias {documentRoot};
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue