From 10cb7467b91a7b988f7ffa77dfa809d381f11a25 Mon Sep 17 00:00:00 2001 From: gauthiier Date: Thu, 29 Nov 2018 21:40:47 +0100 Subject: [PATCH] vhost a2ensite/a2dissite --- vhost-apache2/vhost.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vhost-apache2/vhost.py b/vhost-apache2/vhost.py index fa94b46..90ec10d 100755 --- a/vhost-apache2/vhost.py +++ b/vhost-apache2/vhost.py @@ -97,14 +97,18 @@ def vhost_add(domain): # check is ssl cert exists cert = os.path.join('/etc/letsencrypt/live', domain) if not os.path.exists(cert): - print(" warning: SSL certificates do not exist for domain - " + domain) + print(" warning: SSL certificates do not exist for domain - " + domain + " - this will problaly cause errors...") print(" warning: Please make sure to place them in " + cert + " to allow secure https connection to your site.") - # mv conf file to apache + # mv conf file to apache? if y_n_question("Move " + vhost_file + " to /etc/apache2/sites-available/ ?"): vhost_conf_file = os.path.join('/etc/apache2/sites-available/', domain + '.conf') subprocess.call(['sudo', 'mv', vhost_file, vhost_conf_file]) + # enable site? + if y_n_question("Enable " + domain + "?"): + subprocess.call(['sudo', 'a2ensite', domain + '.conf']) + def vhost_remove(domain): print(" removing domain — " + domain) @@ -112,6 +116,7 @@ def vhost_remove(domain): if os.path.exists(vhost_conf_file): if y_n_question("Delete " + vhost_conf_file + " ?"): subprocess.call(['sudo', 'rm', vhost_conf_file]) + subprocess.call(['sudo', 'a2dissite', vhost_conf_file]) www = os.path.join(html_dir_path, domain) if os.path.exists(www):