I want to start this by saying, I feel really dumb that I cannot understand how custom Nginx configuration works and I feel like I have searched the whole internet to try and understand them but I am just not able to comprehend what I am doing wrong.
I am aware there is a page dedicated to the configuration of Mailcow behind an Nginx reverse proxy (https://docs.mailcow.email/post_installation/reverse-proxy/r_p-nginx/) but my issue is where do I actually put this configuration?
When I customise this configuration to what I believe is my correct details and add it to the Advanced section on the Nginx proxy host for my mail server it goes instantly offline when I push save. I have added it to a .conf file and added it as an additional volume on my Nginx docker container then specified it as a custom location for Mailcow on Nginx but I get the same issue. restarting both Mailcow and Nginx or removing and recomposing the containers still yields the exact same issues of being offline.
I am using Mailcow in docker using this guide christianlempa/videostree/main/mailcow-tutorial for installing Mailcow.
I changed Mailcow HTTP to 85 and HTTPS to 445 and have 80 and 443 ported forward to my Nginx reverse proxy. I have swapped the listening ports of the config below to both 80 and 85 and 443 and 445 for testing but still cannot get it to work.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mail.mydomain.com autodiscover.mydomain.com autoconfig.mydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mail.mydomain.com autodiscover.mydomain.com autoconfig.mydomain.com;
ssl_certificate docker_volumes/mailcow-dockerized/data/assets/ssl/cert.pem;
ssl_certificate_key docker_volumes/mailcow-dockerized/data/assets/ssl/key.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
An example config is given below
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5:!SHA1:!kRSA;
ssl_prefer_server_ciphers off;
location /Microsoft-Server-ActiveSync {
proxy_pass http://192.168.50.250:85/Microsoft-Server-ActiveSync;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 75;
proxy_send_timeout 3650;
proxy_read_timeout 3650;
proxy_buffers 64 512k; # Needed since the 2022-04 Update for SOGo
client_body_buffer_size 512k;
client_max_body_size 0;
}
location / {
proxy_pass http://192.168.50.250:85/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
The following Proxy Buffers has to be set if you want to use SOGo after the 2022-04 (April 2022) Update
proxy_buffer_size 128k;
proxy_buffers 64 512k;
proxy_busy_buffers_size 512k;
}
}
Thank you in advance and any help in understanding how custom configurations work would be greatly appreciated!