Hi there. I am running mailcow on a server that I also use for another application that is served by nodejs. I use simple proxy_pass forwarding in nginx for that and letsencrypt for https.
Now I set up mailcow on the mail.<myserver>.com subdomain. If i got the documentation correctly, then I need to use a custom port. I used 444 instead of 443 for https. I also got myself another certificate from letsencrypt and put the cert and key into the /opt/mailcow-dockerized/data/assets/ssl/
diretory.
Since accessing mail.<mydomain>.com:444 is kind of ugly I would prefer to access the interface directly through mail.<mydomain>.com - without having to add the port. However using a proxy_pass to localhost:444 does not seem to work. If I access mail.mydomain.com I get the following nginx error:
The plain HTTP request was sent to HTTPS port
I’ve been stuck here for two days now. Can anyone help me out?
Here’s my nginx file:
server {
server_name mail.mydomain.com;
location / {
proxy_pass http://localhost:444;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mail.mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = mail.mydomain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name mail.mydomain.com;
listen 80;
return 404; # managed by Certbot
}