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';
|
||||
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
||||
$domainPublic = $domainRoot . '/public_html';
|
||||
$homeRoot = '/home/'.$this->user;
|
||||
|
||||
$settings = [
|
||||
'port' => 80,
|
||||
'domain' => $this->domain,
|
||||
'domainPublic' => $domainRoot . '/public_html',
|
||||
'domainPublic' => $domainPublic,
|
||||
'domainRoot' => $domainRoot,
|
||||
'homeRoot' => '/home/' . $this->user,
|
||||
'homeRoot' => $homeRoot,
|
||||
'user' => $this->user,
|
||||
'group' => 'www-data',
|
||||
'enableRuid2' => true,
|
||||
];
|
||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
||||
|
||||
mkdir($settings['domainRoot']);
|
||||
mkdir($settings['domainPublic']);
|
||||
|
||||
ShellApi::exec('chmod -R 775 /etc/apache2/sites-available/');
|
||||
if (!is_dir($homeRoot)) {
|
||||
mkdir($homeRoot);
|
||||
}
|
||||
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);
|
||||
|
||||
|
@ -99,7 +109,7 @@ class ApacheWebsiteCreate
|
|||
|
||||
shell_exec('a2ensite ' . $settings['domain'] . '.conf');
|
||||
shell_exec('systemctl reload apache2');
|
||||
|
||||
|
||||
return [
|
||||
'domain' => $this->domain,
|
||||
'domainPublic' => $settings['domainPublic'],
|
||||
|
|
Loading…
Reference in a new issue