1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-02-19 19:10:25 +02:00

Add alternative frontend nginx-no-https

This commit is contained in:
Sebastián Ramírez 2017-03-01 22:02:11 -05:00
parent f421bee148
commit 8543d513a9
5 changed files with 108 additions and 1 deletions

View File

@ -36,7 +36,7 @@ COMPOSE_PROJECT_NAME=mailu
# Optional features
###################################
# Choose which frontend Web server to run if any (value: nginx, none)
# Choose which frontend Web server to run if any (value: nginx, nginx-no-https, none)
FRONTEND=none
# Choose which webmail to run if any (values: roundcube, rainloop, none)

View File

@ -0,0 +1,9 @@
FROM nginx:alpine
RUN apk add --no-cache nginx-lua openssl
COPY nginx.conf.default /etc/nginx/nginx.conf.default
COPY start.sh /start.sh
CMD ["/start.sh"]

14
nginx-no-https/README.md Normal file
View File

@ -0,0 +1,14 @@
Mailu NGINX container
=====================
NGINX is a popular and highly efficient webserver and reverse proxy server
commonly used to power high performance websites. In the Mailu stack it is
used as the HTTP frontend tunneling requests to the public web services
provided by other containers.
Resources
---------
* [Report issues](https://github.com/Mailu/Mailu/issues) and
[send Pull Requests](https://github.com/Mailu/Mailu/pulls)
in the [main Mailu repository](https://github.com/Mailu/Mailu)

View File

@ -0,0 +1,79 @@
# Basic configuration
user nginx;
worker_processes 1;
error_log /dev/stderr info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
# Environment variables used in the configuration
env WEBMAIL;
env WEBDAV;
env EXPOSE_ADMIN;
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;
# Load Lua variables
set_by_lua $webmail 'return os.getenv("WEBMAIL")';
set_by_lua $webdav 'return os.getenv("WEBDAV")';
set_by_lua $expose_admin 'return os.getenv("EXPOSE_ADMIN")';
# Actual logic
location / {
if ($webmail != none) {
return 301 $scheme://$host/webmail/;
}
if ($webmail = none) {
return 403;
}
}
location /webmail {
if ($webmail != none) {
proxy_pass http://webmail;
}
if ($webmail = none) {
return 403;
}
}
location /admin {
if ($expose_admin = yes) {
proxy_pass http://admin;
}
if ($expose_admin != yes) {
return 403;
}
}
location /webdav {
if ($webdav != none) {
proxy_pass http://webdav:5232;
}
if ($webdav = none) {
return 403;
}
}
location /.well-known/acme-challenge {
proxy_pass http://admin:8081;
}
}
}

5
nginx-no-https/start.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
nginx -g 'daemon off;'