From 2bfa65329aae3ca68083692d51cdbc5ff1b43e3c Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 27 Sep 2020 02:17:49 +0100 Subject: [PATCH] Keep root in actual local.conf file --- conf/nginx-alldomains.conf | 2 ++ management/web_update.py | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conf/nginx-alldomains.conf b/conf/nginx-alldomains.conf index 8466efd..95008f1 100644 --- a/conf/nginx-alldomains.conf +++ b/conf/nginx-alldomains.conf @@ -1,3 +1,5 @@ + root $ROOT; + # ADDITIONAL DIRECTIVES HERE location = /robots.txt { diff --git a/management/web_update.py b/management/web_update.py index c400e9b..7e00e42 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -198,11 +198,9 @@ def make_domain_config(domain, templates, ssl_certificates, env): if not os.path.exists(nginx_conf_custom_include): with open(nginx_conf_custom_include, "a+") as f: f.writelines([ - f"# Custom configurations for {domain} go here", - "# To use php: use the \"php-fpm\" alias", - "" - f"root {root};", - "index index.html index.htm;" + f"# Custom configurations for {domain} go here\n", + "# To use php: use the \"php-fpm\" alias\n\n", + "index index.html index.htm;\n" ]) nginx_conf_extra += "\tinclude %s;\n" % (nginx_conf_custom_include) @@ -218,6 +216,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): # Replace substitution strings in the template & return. nginx_conf = nginx_conf.replace("$STORAGE_ROOT", env['STORAGE_ROOT']) nginx_conf = nginx_conf.replace("$HOSTNAME", domain) + nginx_conf = nginx_conf.replace("$ROOT", root) nginx_conf = nginx_conf.replace("$SSL_KEY", tls_cert["private-key"]) nginx_conf = nginx_conf.replace("$SSL_CERTIFICATE", tls_cert["certificate"]) nginx_conf = nginx_conf.replace("$REDIRECT_DOMAIN", re.sub(r"^www\.", "", domain)) # for default www redirects to parent domain