improved vhost

This commit is contained in:
2020-03-30 12:37:46 +02:00
parent a6c0ccdd17
commit 3546724fbc
2 changed files with 3 additions and 103 deletions

View File

@@ -56,13 +56,14 @@ if [ "$vh" = "y" ]; then
read _letsencrypt
done
systemctl stop nginx
# lets'encrypt
# https://certbot.eff.org/lets-encrypt/debianstretch-nginx
if [ "$_letsencrypt" = "yes" ]; then
apt-get --yes install certbot
systemctl stop nginx
certbot certonly --standalone -d "$_domain" --cert-name "$_domain"
systemctl start nginx
# TODO stop the whole process if letsencrypt faile
mkdir -p /etc/nginx/ssl/certs/"$_domain"
openssl dhparam -out /etc/nginx/ssl/certs/"$_domain"/dhparam.pem 2048
@@ -146,7 +147,7 @@ if [ "$vh" = "y" ]; then
ln -s /etc/nginx/sites-available/"$_domain".conf /etc/nginx/sites-enabled/"$_domain".conf
# restart nginx
systemctl start nginx
systemctl restart nginx
echo -e "\033[92;1mvhost $_domain configured \033[Om"
else
echo "Vhost installation aborted"