Merge pull request #713 from pgeorgi/extend-nginx

nginx: Allow extending config with overrides
master
Tim Möhlmann 6 years ago committed by GitHub
commit c7dcfee882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,19 @@ http {
} }
{% else %} {% else %}
# Actual logic include /overrides/*.conf;
{% if WEBMAIL != 'none' %}
{% if WEB_WEBMAIL != '/' %}
location / {
return 301 {{ WEB_WEBMAIL }};
}
{% endif %}
# Actual logic
location / {
{% if WEBROOT_REDIRECT and WEB_WEBMAIL != '/' %}
return 301 {{ WEBROOT_REDIRECT }};
{% else %}
return 404;
{% 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;

@ -100,6 +100,9 @@ COMPRESSION_LEVEL=
# Web settings # Web settings
################################### ###################################
# Path to redirect / to
WEBROOT_REDIRECT=/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

@ -32,7 +32,8 @@ services:
{% endfor %} {% endfor %}
volumes: volumes:
- "{{ root }}/certs:/certs" - "{{ root }}/certs:/certs"
- "{{ root }}/overrides/nginx:/overrides"
{% if resolver_enabled %} {% if resolver_enabled %}
resolver: resolver:
image: mailu/unbound:{{ version }} image: mailu/unbound:{{ version }}

@ -111,6 +111,9 @@ COMPRESSION_LEVEL={{ compression_level }}
# Web settings # Web settings
################################### ###################################
# Path to redirect / to
WEBROOT_REDIRECT=/webmail
# Path to the admin interface if enabled # Path to the admin interface if enabled
WEB_ADMIN={{ admin_path }} WEB_ADMIN={{ admin_path }}

@ -27,6 +27,7 @@ services:
{% endfor %} {% endfor %}
volumes: volumes:
- "{{ root }}/certs:/certs" - "{{ root }}/certs:/certs"
- "{{ root }}/overrides/nginx:/overrides"
deploy: deploy:
replicas: {{ front_replicas }} replicas: {{ front_replicas }}

Loading…
Cancel
Save