fix(yeswiki-installer) : no www. for subdomain certs
This commit is contained in:
parent
8d381200ca
commit
2dbc525925
1 changed files with 6 additions and 1 deletions
|
@ -195,6 +195,7 @@ function createNginxConfig($domain, $user, $herseUser, $hersePass, $nossl)
|
|||
}
|
||||
$templates = new League\Plates\Engine(dirname(__FILE__).'/templates');
|
||||
$subDomain = preg_match('/.'.$_SERVER['maindomain'].'$/isU', $domain, $matches, PREG_OFFSET_CAPTURE, 0);
|
||||
$isFullDomain = !preg_match('/^([a-zA-Z0-9]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])\.)([a-zA-Z0-9]{1,2}([-a-zA-Z0-9]{0,252}[a-zA-Z0-9])?)\.([a-zA-Z]{2,63})$/isU', $domain, $matches, PREG_OFFSET_CAPTURE, 0);
|
||||
if (!$nossl) {
|
||||
if (!$subDomain) {
|
||||
file_put_contents(
|
||||
|
@ -208,7 +209,11 @@ function createNginxConfig($domain, $user, $herseUser, $hersePass, $nossl)
|
|||
)
|
||||
);
|
||||
exec('service nginx force-reload', $output);
|
||||
if ($isFullDomain) {
|
||||
exec('/root/.acme.sh/acme.sh --issue -d '.$domain.' -d www.'.$domain.' -k ec-384 -w /home/'.$user.'/'.$domain.'/', $output);
|
||||
} else {
|
||||
exec('/root/.acme.sh/acme.sh --issue -d '.$domain.' -k ec-384 -w /home/'.$user.'/'.$domain.'/', $output);
|
||||
}
|
||||
exec('mkdir -p /etc/letsencrypt/live/'.$domain, $output);
|
||||
exec('/root/.acme.sh/acme.sh --install-cert -d '.$domain.' --ecc \
|
||||
--cert-file /etc/letsencrypt/live/'.$domain.'/cert.pem \
|
||||
|
|
Loading…
Add table
Reference in a new issue