mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-23 02:27:05 +00:00
Tested and minor bugs fixed. Works like a charm.
This commit is contained in:
parent
b4b993e93e
commit
1cdf1a0d29
@ -111,7 +111,7 @@ def do_web_update(env):
|
|||||||
nginx_conf.append((domain, make_domain_config(domain, [template0, template3], ssl_certificates, env)))
|
nginx_conf.append((domain, make_domain_config(domain, [template0, template3], ssl_certificates, env)))
|
||||||
|
|
||||||
# Load the currently enabled sites for nginx.
|
# Load the currently enabled sites for nginx.
|
||||||
_, sites_enabled = shell('check_output', ["ls", "/etc/nginx/sites-enabled"])
|
sites_enabled = shell('check_output', ["ls", "/etc/nginx/sites-enabled"])
|
||||||
warnings = []
|
warnings = []
|
||||||
|
|
||||||
# Did the files change? If not, don't bother writing & restarting nginx.
|
# Did the files change? If not, don't bother writing & restarting nginx.
|
||||||
@ -120,16 +120,15 @@ def do_web_update(env):
|
|||||||
if "miab_%s" % domain not in sites_enabled:
|
if "miab_%s" % domain not in sites_enabled:
|
||||||
warnings.append("Missing miab_%s in /etc/nginx/sites-enabled/\nCheck your configuration!" % domain)
|
warnings.append("Missing miab_%s in /etc/nginx/sites-enabled/\nCheck your configuration!" % domain)
|
||||||
nginx_conf_fn = "/etc/nginx/sites-available/miab_%s" % domain
|
nginx_conf_fn = "/etc/nginx/sites-available/miab_%s" % domain
|
||||||
if os.path.exists(nginx_conf_fn):
|
with open(nginx_conf_fn, "w+") as f:
|
||||||
with open(nginx_conf_fn) as f:
|
if f.read() == conf:
|
||||||
if f.read() == conf:
|
continue
|
||||||
continue
|
|
||||||
|
|
||||||
# Save the file.
|
# Save the file.
|
||||||
with open(nginx_conf_fn, "w") as f:
|
with open(nginx_conf_fn, "w") as f:
|
||||||
f.write(conf)
|
f.write(conf)
|
||||||
|
|
||||||
kick = True
|
kick = True
|
||||||
if kick:
|
if kick:
|
||||||
# Kick nginx. Since this might be called from the web admin
|
# Kick nginx. Since this might be called from the web admin
|
||||||
# don't do a 'restart'. That would kill the connection before
|
# don't do a 'restart'. That would kill the connection before
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
rm -f /etc/nginx/conf.d/local.conf
|
||||||
curl -s -d POSTDATA --user $(</var/lib/mailinabox/api.key): http://127.0.0.1:10222/web/update
|
curl -s -d POSTDATA --user $(</var/lib/mailinabox/api.key): http://127.0.0.1:10222/web/update
|
||||||
cd /etc/nginx/sites-available
|
cd /etc/nginx/sites-available
|
||||||
for f in miab_*
|
for f in miab_*
|
||||||
do
|
do
|
||||||
echo "Processing $f"
|
if ! [ -f "/etc/nginx/sites-enabled/$f" ]; then
|
||||||
ln -s "/etc/nginx/sites-available/$f" "/etc/nginx/sites-enabled/$f"
|
echo "Processing $f"
|
||||||
|
ln -s "/etc/nginx/sites-available/$f" "/etc/nginx/sites-enabled/$f"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
curl -s -d POSTDATA --user $(</var/lib/mailinabox/api.key): http://127.0.0.1:10222/web/update
|
||||||
|
Loading…
Reference in New Issue
Block a user