Update ApacheWebsiteCreate.php
This commit is contained in:
parent
c14e6e76fa
commit
14c6af004e
1 changed files with 17 additions and 7 deletions
|
@ -51,25 +51,35 @@ class ApacheWebsiteCreate
|
||||||
|
|
||||||
$allDomainsRoot = '/home/'.$this->user.'/domains';
|
$allDomainsRoot = '/home/'.$this->user.'/domains';
|
||||||
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
||||||
|
$domainPublic = $domainRoot . '/public_html';
|
||||||
$homeRoot = '/home/'.$this->user;
|
$homeRoot = '/home/'.$this->user;
|
||||||
|
|
||||||
$settings = [
|
$settings = [
|
||||||
'port' => 80,
|
'port' => 80,
|
||||||
'domain' => $this->domain,
|
'domain' => $this->domain,
|
||||||
'domainPublic' => $domainRoot . '/public_html',
|
'domainPublic' => $domainPublic,
|
||||||
'domainRoot' => $domainRoot,
|
'domainRoot' => $domainRoot,
|
||||||
'homeRoot' => '/home/' . $this->user,
|
'homeRoot' => $homeRoot,
|
||||||
'user' => $this->user,
|
'user' => $this->user,
|
||||||
'group' => 'www-data',
|
'group' => 'www-data',
|
||||||
'enableRuid2' => true,
|
'enableRuid2' => true,
|
||||||
];
|
];
|
||||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
||||||
|
|
||||||
mkdir($settings['domainRoot']);
|
if (!is_dir($homeRoot)) {
|
||||||
mkdir($settings['domainPublic']);
|
mkdir($homeRoot);
|
||||||
|
}
|
||||||
ShellApi::exec('chmod -R 775 /etc/apache2/sites-available/');
|
if (!is_dir($allDomainsRoot)) {
|
||||||
|
mkdir($allDomainsRoot);
|
||||||
|
}
|
||||||
|
if (!is_dir($domainRoot)) {
|
||||||
|
mkdir($domainRoot);
|
||||||
|
}
|
||||||
|
if (!is_dir($domainPublic)) {
|
||||||
|
mkdir($domainPublic);
|
||||||
|
}
|
||||||
|
|
||||||
|
shell_exec('chmod -R 775 /etc/apache2/sites-available/');
|
||||||
|
|
||||||
file_put_contents('/etc/apache2/sites-available/' . $settings['domain'] . '.conf', $apache2Sample);
|
file_put_contents('/etc/apache2/sites-available/' . $settings['domain'] . '.conf', $apache2Sample);
|
||||||
|
|
||||||
|
@ -99,7 +109,7 @@ class ApacheWebsiteCreate
|
||||||
|
|
||||||
shell_exec('a2ensite ' . $settings['domain'] . '.conf');
|
shell_exec('a2ensite ' . $settings['domain'] . '.conf');
|
||||||
shell_exec('systemctl reload apache2');
|
shell_exec('systemctl reload apache2');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'domain' => $this->domain,
|
'domain' => $this->domain,
|
||||||
'domainPublic' => $settings['domainPublic'],
|
'domainPublic' => $settings['domainPublic'],
|
||||||
|
|
Loading…
Reference in a new issue