From b6342d34d200c776e2d6567ef2051c822b51b843 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 20 Apr 2020 15:55:05 +0100 Subject: [PATCH] Start web templating work --- conf/nginx-custom.conf | 2 +- management/web_update.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/nginx-custom.conf b/conf/nginx-custom.conf index aad87f16..c9403104 100644 --- a/conf/nginx-custom.conf +++ b/conf/nginx-custom.conf @@ -11,7 +11,7 @@ # we're blocking dotfiles in the static hosted sites but not the FastCGI- # handled locations for Nextcloud (which serves user-uploaded files that might # have this pattern, see #414) or some of the other services. - location ~ /\.(ht|svn|git|hg|bzr) { + location ~ /\.(ht|svn|git|hg|bzr|*.conf) { log_not_found off; access_log off; deny all; diff --git a/management/web_update.py b/management/web_update.py index e2498e77..cb28836a 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -76,9 +76,10 @@ def do_web_update(env): # Load the templates. template0 = open(os.path.join(os.path.dirname(__file__), "../conf/nginx.conf")).read() - template1 = open(os.path.join(os.path.dirname(__file__), "../conf/nginx-alldomains.conf")).read() + template1 = open(os.path.join(os.path.dirname(__file__), "../conf/nginx-default.conf")).read() template2 = open(os.path.join(os.path.dirname(__file__), "../conf/nginx-primaryonly.conf")).read() - template3 = "\trewrite ^(.*) https://$REDIRECT_DOMAIN$1 permanent;\n" + template3 = open(os.path.join(os.path.dirname(__file__), "../conf/nginx-custom.conf")).read() + template4 = "\trewrite ^(.*) https://$REDIRECT_DOMAIN$1 permanent;\n" # Add the PRIMARY_HOST configuration first so it becomes nginx's default server. nginx_conf += make_domain_config(env['PRIMARY_HOSTNAME'], [template0, template1, template2], ssl_certificates, env) @@ -98,7 +99,7 @@ def do_web_update(env): nginx_conf += make_domain_config(domain, [template0], ssl_certificates, env) else: # Add default 'www.' redirect. - nginx_conf += make_domain_config(domain, [template0, template3], ssl_certificates, env) + nginx_conf += make_domain_config(domain, [template0, template4], ssl_certificates, env) # Did the file change? If not, don't bother writing & restarting nginx. nginx_conf_fn = "/etc/nginx/conf.d/local.conf"