mirror of
https://github.com/optim-enterprises-bv/Mailu.git
synced 2025-11-02 02:57:56 +00:00
Proxify to webmail only if enabled, related to #40
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
FROM nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
RUN apk add --update nginx-lua && rm -rf /var/cache/apk/*
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
user www-data;
|
||||
# Basic configuration
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /dev/stderr info;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
@@ -8,7 +8,11 @@ events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
# Environment variables used in the configuration
|
||||
env WEBMAIL;
|
||||
|
||||
http {
|
||||
# Standard HTTP configuration with slight hardening
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout;
|
||||
@@ -36,8 +40,17 @@ http {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
# Load Lua variables
|
||||
set_by_lua $webmail 'return os.getenv("WEBMAIL")';
|
||||
|
||||
# Actual logic
|
||||
|
||||
location / {
|
||||
proxy_pass http://webmail;
|
||||
if ($webmail != none) {
|
||||
proxy_pass http://webmail;
|
||||
}
|
||||
|
||||
return 403;
|
||||
}
|
||||
|
||||
location /admin {
|
||||
|
||||
Reference in New Issue
Block a user