diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 00000000..a3932ab4 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:edge + +RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && apk add --no-cache nginx nginx-mod-mail py-setuptools jinja2-cli@testing + +COPY conf /conf +COPY start.sh /start.sh + +CMD /start.sh diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 00000000..5e2a0e27 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,61 @@ +# Basic configuration +user nginx; +worker_processes 1; +error_log /dev/stderr info; +pid /var/run/nginx.pid; +load_module "modules/ngx_mail_module.so"; + +events { + worker_connections 1024; +} + +http { + # Standard HTTP configuration with slight hardening + include /etc/nginx/mime.types; + default_type application/octet-stream; + access_log /dev/stdout; + sendfile on; + keepalive_timeout 65; + server_tokens off; + + server { + listen 80; + + # Actual logic + location / { + return 301 $scheme://$host/webmail/; + } + + location /webmail { + proxy_pass http://webmail; + } + + location /admin { + proxy_pass http://admin; + } + + location /webdav { + proxy_pass http://webdav:5232; + } + } +} + +mail { + server_name test.mailu.io; + auth_http http://172.18.0.1:5000/nginx; + proxy_pass_error_message on; + + server { + listen 25; + protocol smtp; + smtp_auth plain; + } + + server { + listen 143; + protocol imap; + imap_auth plain; + } + + +} diff --git a/nginx/start.sh b/nginx/start.sh new file mode 100755 index 00000000..9f09a488 --- /dev/null +++ b/nginx/start.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +jinja2 /conf/nginx.conf > /etc/nginx/nginx.conf + +exec nginx -g 'daemon off;'