From 4521fa9e29ddc1ceface270bfde253dcf120cff4 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 24 Sep 2017 18:16:36 +0200 Subject: [PATCH] Make path to admin and webmail configurable, related to #236 --- .env.dist | 10 ++++++++++ nginx/conf/nginx.conf | 14 +++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.env.dist b/.env.dist index 17bfaaad..b1fba622 100644 --- a/.env.dist +++ b/.env.dist @@ -74,6 +74,16 @@ RECIPIENT_DELIMITER=+ DMARC_RUA=admin DMARC_RUF=admin +################################### +# Web settings +################################### + +# Path to the admin interface if enabled +WEB_ADMIN = /admin + +# Path to the webmail if enabled +WEB_WEBMAIL = /webmail + ################################### # Advanced settings ################################### diff --git a/nginx/conf/nginx.conf b/nginx/conf/nginx.conf index 8b4266d6..a7e07a13 100644 --- a/nginx/conf/nginx.conf +++ b/nginx/conf/nginx.conf @@ -57,19 +57,19 @@ http { return 301 $scheme://$host/webmail/; } - location /webmail { - rewrite ^/webmail/(.*) /$1 break; + location {{ WEB_WEBMAIL }} { + rewrite ^{{ WEB_WEBMAIL }}/(.*) /$1 break; proxy_pass http://webmail; } {% endif %} {% if ADMIN == 'true' %} - location /admin { - return 301 $scheme://$host/admin/ui; + location {{ WEB_ADMIN }} { + return 301 $scheme://$host{{ WEB_ADMIN }}/ui; } - location ~ /admin/(ui|static) { - rewrite ^/admin/(.*) /$1 break; - proxy_set_header X-Forwarded-Prefix /admin; + location ~ {{ WEB_ADMIN }}/(ui|static) { + rewrite ^{{ WEB_ADMIN }}/(.*) /$1 break; + proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }}; proxy_pass http://admin; } {% endif %}