fix(templates): no comments for php + ssl config
This commit is contained in:
parent
783952a707
commit
7d944e6fbb
3 changed files with 23 additions and 4 deletions
9
templates/nginx-for-ssl-certificate.php
Normal file
9
templates/nginx-for-ssl-certificate.php
Normal 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)?>;
|
||||
}
|
|
@ -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
|
||||
|
@ -9,4 +9,4 @@ pm.max_children = 75
|
|||
pm.start_servers = 10
|
||||
pm.min_spare_servers = 5
|
||||
pm.max_spare_servers = 20
|
||||
pm.process_idle_timeout = 10
|
||||
pm.process_idle_timeout = 10
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue