diff --git a/.gitignore b/.gitignore index 69c24f9e..867de80c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,7 @@ data/conf/sogo/sieve.creds data/conf/dovecot/dovecot-master.passwd mailcow.conf mailcow.conf_backup -data/conf/nginx/listen*active -data/conf/nginx/server_name.active +data/conf/nginx/*.active data/conf/postfix/sql data/conf/dovecot/sql data/conf/nextcloud-*.bak diff --git a/data/conf/nginx/site.conf b/data/conf/nginx/site.conf index 8a896264..6305b918 100644 --- a/data/conf/nginx/site.conf +++ b/data/conf/nginx/site.conf @@ -108,7 +108,7 @@ server { } location ^~ /Microsoft-Server-ActiveSync { - proxy_pass http://sogo:20000/SOGo/Microsoft-Server-ActiveSync; + include /etc/nginx/conf.d/sogo_eas.active; proxy_connect_timeout 1000; proxy_next_upstream timeout error; proxy_send_timeout 1000; @@ -130,7 +130,7 @@ server { } location ^~ /SOGo { - proxy_pass http://sogo:20000; + include /etc/nginx/conf.d/sogo.active; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -290,7 +290,7 @@ server { } location ^~ /Microsoft-Server-ActiveSync { - proxy_pass http://sogo:20000/SOGo/Microsoft-Server-ActiveSync; + include /etc/nginx/conf.d/templates/sogo_proxy.template; proxy_connect_timeout 1000; proxy_next_upstream timeout error; proxy_send_timeout 1000; @@ -312,7 +312,7 @@ server { } location ^~ /SOGo { - proxy_pass http://sogo:20000; + include /etc/nginx/conf.d/sogo.active; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; diff --git a/data/conf/nginx/templates/sogo.template b/data/conf/nginx/templates/sogo.template new file mode 100644 index 00000000..2c084389 --- /dev/null +++ b/data/conf/nginx/templates/sogo.template @@ -0,0 +1 @@ +proxy_pass http://${IPV4_NETWORK}.248:20000; diff --git a/data/conf/nginx/templates/sogo_eas.template b/data/conf/nginx/templates/sogo_eas.template new file mode 100644 index 00000000..3cea9f98 --- /dev/null +++ b/data/conf/nginx/templates/sogo_eas.template @@ -0,0 +1 @@ +proxy_pass http://${IPV4_NETWORK}.248:20000/SOGo/Microsoft-Server-ActiveSync; diff --git a/data/conf/nginx/templates/sogo_proxy.template b/data/conf/nginx/templates/sogo_proxy.template new file mode 100644 index 00000000..e69de29b diff --git a/docker-compose.yml b/docker-compose.yml index 62c07b93..1b0f6a03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -144,6 +144,7 @@ services: - ${IPV4_NETWORK:-172.22.1}.254 networks: mailcow-network: + ipv4_address: ${IPV4_NETWORK:-172.22.1}.248 aliases: - sogo @@ -233,6 +234,8 @@ services: command: /bin/sh -c "envsubst < /etc/nginx/conf.d/templates/listen_plain.template > /etc/nginx/conf.d/listen_plain.active && envsubst < /etc/nginx/conf.d/templates/listen_ssl.template > /etc/nginx/conf.d/listen_ssl.active && envsubst < /etc/nginx/conf.d/templates/server_name.template > /etc/nginx/conf.d/server_name.active && + envsubst < /etc/nginx/conf.d/templates/sogo.template > /etc/nginx/conf.d/sogo.active && + envsubst < /etc/nginx/conf.d/templates/sogo_eas.template > /etc/nginx/conf.d/sogo_eas.active && nginx -qt && until ping phpfpm -c1 > /dev/null; do sleep 1; done && until ping sogo -c1 > /dev/null; do sleep 1; done && @@ -242,6 +245,7 @@ services: - HTTPS_PORT=${HTTPS_PORT:-443} - HTTP_PORT=${HTTP_PORT:-80} - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME} + - IPV4_NETWORK= volumes: - ./data/web:/web:ro - ./data/conf/rspamd/dynmaps:/dynmaps:ro