Add nginx conf when adding domains

This commit is contained in:
kload 2013-10-18 16:33:10 +00:00
parent 2b38900589
commit 35d999c1af

View file

@ -191,6 +191,13 @@ def domain_add(domains, main=False):
os.system('chown -R metronome: /etc/metronome/conf.d/') os.system('chown -R metronome: /etc/metronome/conf.d/')
os.system('service metronome restart') os.system('service metronome restart')
# Nginx
os.system('cp /usr/share/yunohost/yunohost-config/nginx/template.conf /etc/nginx/conf.d/'+ domain +'.conf')
os.system('mkdir /etc/nginx/conf.d/'+ domain +'.d/')
os.system('sed -i s/yunohost.org/'+ domain +'/g /etc/nginx/conf.d/'+ domain +'.conf')
os.system('service nginx reload')
if yldap.add('virtualdomain=' + domain + ',ou=domains', attr_dict): if yldap.add('virtualdomain=' + domain + ',ou=domains', attr_dict):
result.append(domain) result.append(domain)
continue continue
@ -267,7 +274,7 @@ def domain_ssowatconf():
conf_dict = { conf_dict = {
'portal_domain': main_domain, 'portal_domain': main_domain,
'portal_path': '/sso/', 'portal_path': '/ynhsso/',
'portal_port': '443', 'portal_port': '443',
'portal_scheme': 'https', 'portal_scheme': 'https',
'additional_headers': { 'additional_headers': {
@ -277,7 +284,7 @@ def domain_ssowatconf():
'Email': 'mail' 'Email': 'mail'
}, },
'domains': domains, 'domains': domains,
'skipped_urls': [], 'skipped_urls': ['https://'+ main_domain +'/ynhadmin'],
'unprotected_urls': [] 'unprotected_urls': []
} }