NGINX Proxy Manager and Email Configuration

SYSTEM INFORMATION
OS type and version Debian 12
Webmin version 2.202
Virtualmin version 7.20.2
Webserver version Apache2 2.4.62-1~deb12u2
Related packages SUGGESTED

I have configured Virtualmin to work with NGINX proxy manager- I have about 8 virtual servers running and everything works great EXCEPT for email. SO in my email client settings the IMAP and SMTP are: mail.mydomainname.com 993 (IMAP) and 587 (SMTP). In NPM I have setup the mydomainname.com forwarding to 443 - not sure what I should do to get the mail to work? Do I need to setup a mail domain on NPM (mail.mydomainname.com) pointing to 993 and 587 respectively? Is there a way to change the client settings from mail.mydomainname.com to imap.mydomainname.com and smtp.mydomainname.com?

Are you talking about Auto config for client? Pretty sure proxy managers only effect web services not mail services as well.

So I can send email out through the Usermin client - not an issue really but when I try to run phpmailer it times out even though I am using the correct username, host and login. Logs don’t show anything is wrong on the php side but I get: 504 Gateway Time-out — openresty when I run the mailer.php. In addition I tryto setup outlook client with my email and it also times out (drops imap connection) The credentials are correct 100% as I can log in through usermin to my email client.

So your running virtualmin from home behind a router?

No I have my own server on Hetzner

Not sure then, imap ports should be open. Maybe ticket Hetzner if there are any restrictions.
Why the need for a proxy server?

Yeah its odd, I also run vservers on ovh bare metal and I have no issues with phpmailer or setting up outlook accounts to virtualmin - but I don’t use NGINX proxy manager on OVH and I wondered if I need to take some extra steps to configure mail. Anyway thanks for trying! I think its probably the Hetzner firewall blocking those ports. Ill check it out.

1 Like

Hi @domjag ,
tried this myself some time ago: using npm/openresty as mail proxy.

The problem is: nginx/openresty is by default missing mail proxy support.
So, it must be compiled like this:

./configure --prefix=/home/openresty/ --with-pcre-jit --with-mail --with-mail_ssl_module
make
make install

and/or build as e.g. Debian deb package and installed. Every time, openresty
is upgraded … So, after some tries I’ve given up on npm at all, using haproxy
in lxc on Proxmox now.

HTH
Falko