Good that you have decided to separate mail from web. Doing so improves web server performance - particularly for parameters such as TTFB and FCP which have become meaningful signals for SEO. I am using it as a sales & marketing feature for my web hosting services - see Fast web servers - dare to compare TTFB and FCP. This is one way Virtualmin trumps cPanel and others, which force mail + web on the same server.
You do not need to edit the config files directly. Here is how you can configure two servers to work in tandem via the options that Virtualmin offes:
-
In your Virtualmin web optimized server, at the time of creating virtual server for, say, domain.tld, you need just uncheck the box captioned “Accept mail for domain?”. In your Virtualmin mail optimized server, at the time of creating virtual server for domain.tld, you need to uncheck the box captioned “Enable Nginx website?” and “Enable Nginx SSL website?”.
-
On your Virtualmin web optimized server, in Virtualmin → Server Configuration → DNS Records, edit the MX to point to the MX of your Virtualmin mail optimized server.
Point domain.tld to DNS of the Virtualmin web optimized server.
You can now host your website on your Virtualmin web optimized server and create users / mailboxes on Virtualmin mail optimized server. It should all work except for Usermin, which you will have to abandon for Roundcube or similar.
Sending email to smarthost / relay can be done via Webmin → Postfix → SMTP Authentication And Encryption, “Send outgoing mail via host”. Also see Free smarthost / mail relay to work around port 25 block by VPS host