fix(templates): no comments for php + ssl config

This commit is contained in:
mrflos 2022-11-22 10:09:27 +03:00
parent 783952a707
commit 7d944e6fbb
3 changed files with 23 additions and 4 deletions

View file

@ -0,0 +1,9 @@
# ----------------------------------------------------------------------
# | Config file for ssl certificate for <?=$this->e($domain)?> host |
# ----------------------------------------------------------------------
server {
listen [::]:80;
listen 80;
server_name www.<?=$this->e($domain)?> <?=$this->e($domain)?>;
}

View file

@ -1,6 +1,6 @@
[<?=$this->e($user)?>]
user = <?=$this->e($user)?> #unix user
group = <?=$this->e($user)?> #unix group
user = <?=$this->e($user)?>
group = <?=$this->e($user)?>
listen = /var/run/php-fpm-<?=$this->e($user)?>.sock
listen.owner = www-data
listen.group = www-data

View file

@ -155,8 +155,19 @@ function createNginxConfig($domain, $user, $herseUser, $hersePass)
$herseUser.':'.password_hash($hersePass, PASSWORD_BCRYPT)
);
}
$templates = new League\Plates\Engine(dirname(__FILE__).'/templates');
$subDomain = preg_match('/.'.$_SERVER['maindomain'].'$/isU', $domain, $matches, PREG_OFFSET_CAPTURE, 0);
if (!$subDomain) {
file_put_contents(
$nginxFile,
$templates->render(
'nginx-for-ssl-certificate',
[
'domain' => $domain,
]
)
);
exec('service nginx force-reload', $output);
exec('/root/.acme.sh/acme.sh --issue -d '.$domain.' -d www.'.$domain.' -k ec-384 --nginx', $output);
exec('mkdir -p /etc/letsencrypt/live/'.$domain, $output);
exec('/root/.acme.sh/acme.sh --install-cert -d '.$domain.' --ecc \
@ -166,7 +177,6 @@ function createNginxConfig($domain, $user, $herseUser, $hersePass)
--ca-file /etc/letsencrypt/live/'.$domain.'/ca.pem \
--reloadcmd "systemctl restart nginx.service"', $output);
}
$templates = new League\Plates\Engine(dirname(__FILE__).'/templates');
file_put_contents(
$nginxFile,
$templates->render(