nginx: Allow extending config with overrides

To facilitate this, the default redirect at / can be disabled, even if
the default remains at redirecting to the webmailer.

The extensions are within the host scope and are read from
$ROOT/overrides/nginx/*.conf.
master
Patrick Georgi 6 years ago
parent 5c24390114
commit eac4d553a9

@ -14,6 +14,7 @@ COPY *.py /
EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp
VOLUME ["/certs"] VOLUME ["/certs"]
VOLUME ["/overrides"]
CMD /start.py CMD /start.py

@ -84,14 +84,16 @@ http {
} }
{% else %} {% else %}
include /overrides/*.conf;
# Actual logic # Actual logic
{% if WEBMAIL != 'none' %} {% if WEBROOT_REDIRECT %}
{% if WEB_WEBMAIL != '/' %}
location / { location / {
return 301 {{ WEB_WEBMAIL }}; return 301 {{ WEBROOT_REDIRECT }};
} }
{% endif %} {% endif %}
{% if WEBMAIL != 'none' %}
location {{ WEB_WEBMAIL }} { location {{ WEB_WEBMAIL }} {
{% if WEB_WEBMAIL != '/' %} {% if WEB_WEBMAIL != '/' %}
rewrite ^({{ WEB_WEBMAIL }})$ $1/ permanent; rewrite ^({{ WEB_WEBMAIL }})$ $1/ permanent;

@ -97,6 +97,9 @@ COMPRESSION_LEVEL=
# Web settings # Web settings
################################### ###################################
# Path to redirect / to
WEB_DEFAULT=/webmail
# Path to the admin interface if enabled # Path to the admin interface if enabled
WEB_ADMIN=/admin WEB_ADMIN=/admin

@ -29,6 +29,7 @@ services:
- "$BIND_ADDRESS6:587:587" - "$BIND_ADDRESS6:587:587"
volumes: volumes:
- "$ROOT/certs:/certs" - "$ROOT/certs:/certs"
- "$ROOT/overrides/nginx:/overrides"
redis: redis:
image: redis:alpine image: redis:alpine

Loading…
Cancel
Save