Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Nginx reserve proxy for mail with domain?
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.

Nginx reserve proxy for mail with domain?

jvnadrjvnadr Member
edited July 2018 in Help

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

  • lemonlemon Member
    edited July 2018

    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

  • jvnadrjvnadr Member

    lemon said: 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.

    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.

  • lemonlemon Member
    edited July 2018

    @jvnadr said:

    lemon said: 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.

    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.

  • Tr33nTr33n Member
    edited July 2018
  • FalzoFalzo Member

    what a gem. didn't know nginx could do something like that, thanks for pointing at it!

  • jvnadrjvnadr Member

    Tr33n said: Is that not exactly what you want?

    Theoretically, yes! How didn't I see that? Thanks a lot, I'll play with this!

Sign In or Register to comment.