|
|
@ -98,6 +98,27 @@ class NginxVhostHelper |
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private function getRedirect($path, $domain) |
|
|
|
{ |
|
|
|
// getting .conf-file
|
|
|
|
$content = file_get_contents($path); |
|
|
|
|
|
|
|
// result
|
|
|
|
$result = false; |
|
|
|
|
|
|
|
preg_match('/server_name www.'.$domain.'/', $content, $matches); |
|
|
|
|
|
|
|
if (count($matches) > 0) { |
|
|
|
$result = true; |
|
|
|
} |
|
|
|
|
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* get vhost |
|
|
|
* |
|
|
@ -113,10 +134,14 @@ class NginxVhostHelper |
|
|
|
// getting certificates from a configuration
|
|
|
|
$certificate = $this->getCertificate($path); |
|
|
|
|
|
|
|
// domain
|
|
|
|
$domain = str_replace('.conf', '', $filename); |
|
|
|
|
|
|
|
$result = array_merge([ |
|
|
|
'domain' => str_replace('.conf', '', $filename), |
|
|
|
'domain' => $domain, |
|
|
|
'path' => $path, |
|
|
|
'file' => $filename, |
|
|
|
'redirect_www' => $this->getRedirect($path, $domain) |
|
|
|
'enabled' => in_array($filename, $enabled), |
|
|
|
], $certificate); |
|
|
|
|
|
|
|