vhost a2ensite/a2dissite

This commit is contained in:
gauthiier 2018-11-29 21:40:47 +01:00
parent deff7c8727
commit 10cb7467b9

View File

@ -97,14 +97,18 @@ def vhost_add(domain):
# check is ssl cert exists # check is ssl cert exists
cert = os.path.join('/etc/letsencrypt/live', domain) cert = os.path.join('/etc/letsencrypt/live', domain)
if not os.path.exists(cert): 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.") 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/ ?"): if y_n_question("Move " + vhost_file + " to /etc/apache2/sites-available/ ?"):
vhost_conf_file = os.path.join('/etc/apache2/sites-available/', domain + '.conf') vhost_conf_file = os.path.join('/etc/apache2/sites-available/', domain + '.conf')
subprocess.call(['sudo', 'mv', vhost_file, vhost_conf_file]) 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): def vhost_remove(domain):
print(" removing domain — " + domain) print(" removing domain — " + domain)
@ -112,6 +116,7 @@ def vhost_remove(domain):
if os.path.exists(vhost_conf_file): if os.path.exists(vhost_conf_file):
if y_n_question("Delete " + vhost_conf_file + " ?"): if y_n_question("Delete " + vhost_conf_file + " ?"):
subprocess.call(['sudo', 'rm', 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) www = os.path.join(html_dir_path, domain)
if os.path.exists(www): if os.path.exists(www):