Keep root in actual local.conf file

This commit is contained in:
David Duque 2020-09-27 02:17:49 +01:00
parent 81c64f0a8f
commit 2bfa65329a
No known key found for this signature in database
GPG key ID: 2F327738A3C0AE3A
2 changed files with 6 additions and 5 deletions

View file

@ -1,3 +1,5 @@
root $ROOT;
# ADDITIONAL DIRECTIVES HERE # ADDITIONAL DIRECTIVES HERE
location = /robots.txt { location = /robots.txt {

View file

@ -198,11 +198,9 @@ def make_domain_config(domain, templates, ssl_certificates, env):
if not os.path.exists(nginx_conf_custom_include): if not os.path.exists(nginx_conf_custom_include):
with open(nginx_conf_custom_include, "a+") as f: with open(nginx_conf_custom_include, "a+") as f:
f.writelines([ f.writelines([
f"# Custom configurations for {domain} go here", f"# Custom configurations for {domain} go here\n",
"# To use php: use the \"php-fpm\" alias", "# To use php: use the \"php-fpm\" alias\n\n",
"" "index index.html index.htm;\n"
f"root {root};",
"index index.html index.htm;"
]) ])
nginx_conf_extra += "\tinclude %s;\n" % (nginx_conf_custom_include) 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. # Replace substitution strings in the template & return.
nginx_conf = nginx_conf.replace("$STORAGE_ROOT", env['STORAGE_ROOT']) nginx_conf = nginx_conf.replace("$STORAGE_ROOT", env['STORAGE_ROOT'])
nginx_conf = nginx_conf.replace("$HOSTNAME", domain) 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_KEY", tls_cert["private-key"])
nginx_conf = nginx_conf.replace("$SSL_CERTIFICATE", tls_cert["certificate"]) 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 nginx_conf = nginx_conf.replace("$REDIRECT_DOMAIN", re.sub(r"^www\.", "", domain)) # for default www redirects to parent domain