update
This commit is contained in:
parent
f909a4b958
commit
c3e6aff2d3
3 changed files with 61 additions and 14 deletions
|
@ -21,6 +21,10 @@ email="admin@phyrepanel.com"
|
|||
# Create the new phyreweb user
|
||||
/usr/sbin/useradd "phyreweb" -c "$email" --no-create-home
|
||||
|
||||
sudo usermod -aG sudo phyreweb
|
||||
sudo usermod -aG sudo www-data
|
||||
|
||||
|
||||
# do not allow login into phyreweb user
|
||||
echo phyreweb:$random_password | sudo chpasswd -e
|
||||
|
||||
|
@ -48,6 +52,7 @@ DEPENDENCIES_LIST=(
|
|||
"git"
|
||||
"apache2"
|
||||
"libapache2-mod-php8.2"
|
||||
"libapache2-mod-ruid2"
|
||||
"apache2-suexec-custom"
|
||||
"nodejs"
|
||||
"npm"
|
||||
|
@ -87,6 +92,7 @@ sudo a2enmod env
|
|||
sudo a2enmod ssl
|
||||
sudo a2enmod headers
|
||||
sudo a2enmod suexec
|
||||
sudo a2enmod ruid2
|
||||
sudo a2enconf ssl-params
|
||||
sudo ufw allow in "Apache Full"
|
||||
|
||||
|
|
|
@ -48,35 +48,57 @@ class ApacheWebsiteCreate
|
|||
$linuxUser = $getLinuxUser->handle();
|
||||
}
|
||||
|
||||
$domainRoot = '/home/'.$this->user.'/domains/'.$this->domain;
|
||||
|
||||
$domainRoot = '/home/' . $this->user . '/domains/' . $this->domain;
|
||||
|
||||
|
||||
//copy php suexe to {'home'}/fcgi-bin
|
||||
|
||||
// $fileManagerApi = new FileManagerApi();
|
||||
|
||||
$settings = [
|
||||
'port'=> 80,
|
||||
'port' => 80,
|
||||
'domain' => $this->domain,
|
||||
'domainPublic' => $domainRoot. '/public_html',
|
||||
'domainPublic' => $domainRoot . '/public_html',
|
||||
'domainRoot' => $domainRoot,
|
||||
'homeRoot' => '/home/'.$this->user,
|
||||
'homeRoot' => '/home/' . $this->user,
|
||||
'user' => $this->user,
|
||||
'group' => 'www-data',
|
||||
'group' => $this->user,
|
||||
// 'group' => 'www-data',
|
||||
'enableRuid2' => true,
|
||||
];
|
||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf',$settings)->render();
|
||||
$apache2Sample = view('actions.samples.ubuntu.apache2-conf', $settings)->render();
|
||||
|
||||
$fileManagerApi = new FileManagerApi();
|
||||
$fileManagerApi->mkdir($settings['domainRoot']);
|
||||
$fileManagerApi->mkdir($settings['domainPublic']);
|
||||
|
||||
$fileManagerApi->filePutContents('/etc/apache2/sites-available/'.$settings['domain'].'.conf', $apache2Sample);
|
||||
ShellApi::exec('chmod -R 775 /etc/apache2/sites-available/');
|
||||
|
||||
ShellApi::exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainRoot']);
|
||||
ShellApi::exec('chown -R '.$settings['user'].':'.$settings['group'].' '.$settings['domainPublic']);
|
||||
|
||||
ShellApi::exec('chmod -R 755 '.$settings['domainRoot']);
|
||||
ShellApi::exec('chmod -R 755 '.$settings['domainPublic']);
|
||||
$fileManagerApi->filePutContents('/etc/apache2/sites-available/' . $settings['domain'] . '.conf', $apache2Sample);
|
||||
|
||||
ShellApi::exec('a2ensite '.$settings['domain'].'.conf');
|
||||
|
||||
$indexContent = '
|
||||
|
||||
<?php print_r($_ENV); ?>
|
||||
<?php echo get_current_user(); ?>
|
||||
<?php echo phpinfo(); ?>
|
||||
|
||||
';
|
||||
|
||||
|
||||
$fileManagerApi->filePutContents($settings['domainPublic'] . '/index.php', $indexContent);
|
||||
|
||||
ShellApi::exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainRoot']);
|
||||
ShellApi::exec('chown -R ' . $settings['user'] . ':' . $settings['group'] . ' ' . $settings['domainPublic']);
|
||||
|
||||
ShellApi::exec('chmod -R 755 ' . $settings['domainRoot']);
|
||||
ShellApi::exec('chmod -R 755 ' . $settings['domainPublic']);
|
||||
|
||||
ShellApi::exec('a2ensite ' . $settings['domain'] . '.conf');
|
||||
ShellApi::exec('systemctl reload apache2');
|
||||
|
||||
$fileManagerApi->filePutContents($settings['domainPublic'].'/index.php', "<?php echo phpinfo(); ?> Domain: " . $settings['domain'] );
|
||||
|
||||
return [
|
||||
'domain' => $this->domain,
|
||||
|
|
|
@ -1,15 +1,34 @@
|
|||
<VirtualHost *:{{$port}}>
|
||||
|
||||
|
||||
ServerName {{$domain}}
|
||||
DocumentRoot {{$domainPublic}}
|
||||
SetEnv APP_DOMAIN {{$domain}}
|
||||
|
||||
@if(isset($enableRuid2) and $enableRuid2)
|
||||
#RDocumentChRoot {{$domainPublic}}
|
||||
SuexecUserGroup {{$user}} {{$group}}
|
||||
RUidGid {{$user}} {{$group}}
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
<Directory {{$domainPublic}}>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
|
||||
@if(isset($enableRuid2) and $enableRuid2)
|
||||
RMode config
|
||||
RUidGid {{$user}} {{$group}}
|
||||
@endif
|
||||
</Directory>
|
||||
|
||||
|
||||
@if(isset($ssl) and $ssl)
|
||||
#SSLEngine on
|
||||
#SSLCertificateFile /etc/ssl/certs/{{$domain}}.crt
|
||||
#SSLCertificateKeyFile /etc/ssl/private/{{$domain}}.key
|
||||
@endif
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
|
|
Loading…
Reference in a new issue