Jump to content

Hi everyone,

 

Has anyone made their own mail server and put it behind an NGINX reverse proxy?  If so, what rules/redirection policies have you put in your config file?  Alternatively if you've made/know a good guide on how to do this from scratch, I would also be interested.

I am familiar with how a reverse proxy works, having set one up for my ESXi hypervisor machine to handle Web, GitLab, Mattermost, Nextcloud and Onlyoffice requests.  I am also using LetsEncrypt to handle SSL, but I'm not sure if applying LetsEncrypt autoconfig to the mail domains will break it, given I have no experience with mail servers behind reverse proxies.

 

I'm probably going to use PostFix for the mail server itself, and I have dedicated SQL server if that's necessary - however I am open to other suggestions if it's easier.

I probably should mention that the mail server VM has 2vCPUs, 2GB RAM and has Ubuntu Server 18.04 on a 32GB thin provisioned disk.

 

Thanks muchly :)

 

Link to post
Share on other sites

What web client are you going to host behind NGINX?

In general for email it is easier to have another program set it up for you. I use iRedmail but their is also mail-in-a-box. Both of those set up everything you need for a mail server automatically.  

Link to post
Share on other sites

I use Zimbra for the company I work for.

It's a tad difficult to setup behind a reverse proxy and you shouldn't actually be setting up a mail server behind a reverse proxy to begin with unless you need huge load balancing and failover, in which case, just pay a hosting provider that has those features.

As for nginx, I think you should look into TCP forwarding for ports used by SMTP, POP3 and IMAP.

Link to post
Share on other sites

It is the same as any other service. You just specify port 25 instead of 80 or whatever. 

One thing tho, Postfix is mainly just a mail transport. For client access (connecting up a client like thunderbird or mutt) you will want something like Dovecot. For webmail, look at Squirrelmail. For spam control, see SpamAssassin + ClamAVPlugin. 

Before you get started, make sure your ISP actually allows smtp traffic. Some have an authenticated relay you can use, some just block it outright. You might need to set up your proxy on a cloud service or vps, and tunnel to local over a different protocol. 

Intel 11700K - Gigabyte 3080 Ti- Gigabyte Z590 Aorus Pro - Sabrent Rocket NVME - Corsair 16GB DDR4

Link to post
Share on other sites

Thanks for the replies, I really do appreciate you sharing your experience :).  I'll get around to investigating this closer in the next few weeks, I'm a bit busy with other projects at the moment/university/final exams.

 

Link to post
Share on other sites

  • 1 year later...

Hi @Tad BittoomuchI am having a similar situation with you (I used mailinabox to set up a mailserver and now needs nginx to reverse proxy and accept email from the main proxy server to transfer it to the mailserver). Can you share your experiences?

Link to post
Share on other sites

  • 2 weeks later...
On 12/30/2020 at 1:36 AM, shinsusenju said:

Hi @Tad BittoomuchI am having a similar situation with you (I used mailinabox to set up a mailserver and now needs nginx to reverse proxy and accept email from the main proxy server to transfer it to the mailserver). Can you share your experiences?

Honestly?  I gave up and paid for the MXroute lifetime 10GB plan. 

 

I did come across a guide to set up a mail server behind a reverse proxy but when it came to setting up the authentication server it essentially handled user auth requests by doing 

return True

which I thought was a bit sketchy.

 

 

If you're just a home user trying to host your own mail server paying for a service like MXroute is way, way, way simpler than having to deal with authentication servers and directing ports and dns and all that rubbish.

 

Sorry I couldn't be any more helpful :/

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×