From c8fb79040b61a9829181d6ec66dc259a30f7fbfa Mon Sep 17 00:00:00 2001
From: bax1489 <fabian.gallenkamp@uni-hamburg.de>
Date: Tue, 1 Oct 2019 11:29:17 +0200
Subject: [PATCH] added favicon, changed default behaviour on unavailable otree
 instance

---
 group_vars/otree_servers.yml.example | 1 +
 templates/nginx_default_site.conf.j2 | 2 +-
 templates/nginx_site.conf.j2         | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/group_vars/otree_servers.yml.example b/group_vars/otree_servers.yml.example
index 1c9db4d..5670fca 100755
--- a/group_vars/otree_servers.yml.example
+++ b/group_vars/otree_servers.yml.example
@@ -7,6 +7,7 @@ home_path: "/home"
 nginx_config_path: "/etc/nginx"
 nginx_sites_available: "{{ nginx_config_path }}/sites-available"
 nginx_sites_enabled: "{{ nginx_config_path }}/sites-enabled"
+default_redirection: "https:// mydomain "
 
 otree_domain: "company.org"
 # fqdn of the otree parent domain
diff --git a/templates/nginx_default_site.conf.j2 b/templates/nginx_default_site.conf.j2
index 22eb9a2..02e732d 100755
--- a/templates/nginx_default_site.conf.j2
+++ b/templates/nginx_default_site.conf.j2
@@ -21,7 +21,7 @@ server {
         ssl_certificate_key {{ ssl_certificate_key_path }};
 
         location / {
-                return 403;
+                return 301 {{ default_redirection }};
         }
 }
 
diff --git a/templates/nginx_site.conf.j2 b/templates/nginx_site.conf.j2
index b64b671..81a54e1 100755
--- a/templates/nginx_site.conf.j2
+++ b/templates/nginx_site.conf.j2
@@ -13,6 +13,10 @@ server {
 	ssl_certificate {{ ssl_certificate_path }};
 	ssl_certificate_key {{ ssl_certificate_key_path }};
 
+	location = /favicon.ico {
+                alias /var/www/media/images/favicon.ico;
+        }
+
 	location / {
 		access_log off;
 		proxy_pass http://127.0.0.1:{{ item.value.port }};
-- 
GitLab