mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 23:12:35 +00:00
Add site redirects (#552)
* feat(redirects): add redirects to sites * chore(style): fixed coding style issues * style: fix php-stan docblocks * style: pint cleanup * tests: fixed redirect test suite * feat: vhosts include additional configs * fix: use exact location matching * - add enums - use queues - use vhost rather than separate conf files - vhost formatter - cleanup * generate docs --------- Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
@ -80,18 +80,14 @@ public function createVHost(Site $site): void
|
||||
|
||||
$this->service->server->ssh()->write(
|
||||
'/etc/nginx/sites-available/'.$site->domain,
|
||||
view('ssh.services.webserver.nginx.vhost', [
|
||||
'site' => $site,
|
||||
]),
|
||||
$this->generateVhost($site),
|
||||
'root'
|
||||
);
|
||||
|
||||
$this->service->server->ssh()->exec(
|
||||
view('ssh.services.webserver.nginx.create-vhost', [
|
||||
'domain' => $site->domain,
|
||||
'vhost' => view('ssh.services.webserver.nginx.vhost', [
|
||||
'site' => $site,
|
||||
]),
|
||||
'vhost' => $this->generateVhost($site),
|
||||
]),
|
||||
'create-vhost',
|
||||
$site->id
|
||||
@ -105,9 +101,7 @@ public function updateVHost(Site $site, ?string $vhost = null): void
|
||||
{
|
||||
$this->service->server->ssh()->write(
|
||||
'/etc/nginx/sites-available/'.$site->domain,
|
||||
$vhost ?? view('ssh.services.webserver.nginx.vhost', [
|
||||
'site' => $site,
|
||||
]),
|
||||
$vhost ?? $this->generateVhost($site),
|
||||
'root'
|
||||
);
|
||||
|
||||
@ -209,4 +203,13 @@ public function removeSSL(Ssl $ssl): void
|
||||
|
||||
$this->updateVHost($ssl->site);
|
||||
}
|
||||
|
||||
private function generateVhost(Site $site): string
|
||||
{
|
||||
$vhost = view('ssh.services.webserver.nginx.vhost', [
|
||||
'site' => $site,
|
||||
]);
|
||||
|
||||
return format_nginx_config($vhost);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user