New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Nginx reserve proxy for mail with domain?
Hello there.
I would like to play a little with this scenario:
I want to setup a mail server on a NAT vps that is using nginx reverse proxy on the node to serve http/https. Is it possible to forward mail ports to the NAT vps the way you forward ports for serving content? Can nginx listen all request to port 25 for a certain domain (e.g. example.com or mail.example.com) and forward this to internal NAT address 10.0.0.1 and another domain (e.g. examplenew.com) to another internal NAT address 10.0.0.2?
Or if not, is there another way to achieve this?
Of couse, I have the manage of the virtualized node.
Comments
I've done the same, but nginx reverse proxy will only work for http/https, for smtp, imap and pop you'll have to do DNAT with iptables.
Edit: misunderstood
Iptables will forward mail ports to a certain nat vps. What I am asking, is to forward mail ports to certain NAT ip address for a certain domain, not for all.
Uhm no, I think that won't work with nginx, correct me if I'm wrong.
That for you use postfix, to deliver all incoming mails on another postfix server, e.g. 10.0.0.200, and relay from there to the destinations like 10.0.0.2 or 10.0.0.1 based on the domain.
https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/
Is that not exactly what you want?
what a gem. didn't know nginx could do something like that, thanks for pointing at it!
Theoretically, yes! How didn't I see that? Thanks a lot, I'll play with this!