This website is deprecated, and remains online only for historic access to old issues and docs for historic versions of Virtualmin. It has been unmaintained for several years, and should not be relied on for up-to-date information. Please visit www.virtualmin.com instead.
I have Vps with unubuntu 16.04 and nginx. How do I setup cloudflare and virtualmin for mail to work. I can setup the ip in cloudflare but I don't know how to setup mx records etc. Please help Thanks
Well, that's not a lot to go on so I am making some assumptions. You've set up Cloudflare to be your DNS server, I assume (by pointing your domain at the dns servers that Cloudflare provide). So -- all your DNS is now managed at Cloudflare. If you had set up the MX records, etc in VIrtualmin before you set up Cloudflare, cloudflare SHOULD have copied all those records into your DNS server at Cloudflare when you set up the domain. So in that case they would already be there and should be correct. If not, you can just enter them over on the Cloudflare DNS servers manually. You can set up any kind of reasonable record on the Cloudflare servers. If your question LITERALLY is that you don't know how to set up MX records in general, then that's not really a VIrtualmin question. Basically you just set up an MX record pointing to the IP of your mail server and set the priority (and if you only have one then the priority is pretty arbitrary).
Another assumption is that there is some confusion about how nameservers and DNS works. And that's ok, I had the same confusion, and sometimes I think I'm still confused.
Here's a simple explanation which someone once helped me with.
The registrar where you registered the domain must be pointed to the Cloudflare nameservers. These will be in the form of xxx.xx.cloudflare.com. More common nameserver names are ns1.xxxx.com, ns2.xxxx.com, ns3.xxxx.com. These need to point to the DNS server you are using and in your case, that's cloudflare.
Once done, then the "internet" knows where to send traffic for all requests for anything for that domain.
Specifically for email traffic, when an email is sent to you@yourdomain.com, the request will first go to the registrar's server. The registrar says, "sorry I don't have that domain's dns records so I don't how to handle this mx request. But if you go here (xxx.xx.cloudflare.com), that guy should know what to do."
And so it reaches the cloudflare server, and asks where to direct the mx traffic to deliver an email. As long as you have an mx record in the cloudflare DNS which points to your mailserver, mail will be routed to your mailserver on virtualmin. As Cruiskeen mentioned, if your confusion is how to setup an mx record in Cloudflare, then just google that issue. "mx record setup on cloudflare" and you'll find loads of results to help you. I found thius article to be most informative. https://support.cloudflare.com/hc/en-us/articles/218069617-How-do-I-add-...
Remember that if you are using Cloudflare, that means you are not using DNS provided by Virtualmin. BIND (Virtualmin DNS server) can therefore be switched off for all domains that are using Cloudflare. To do that, you can go into System Settings -> Features and Plugins, and in there you can disable the BIND DNS Server feature.
Well, that's not a lot to go on so I am making some assumptions. You've set up Cloudflare to be your DNS server, I assume (by pointing your domain at the dns servers that Cloudflare provide). So -- all your DNS is now managed at Cloudflare. If you had set up the MX records, etc in VIrtualmin before you set up Cloudflare, cloudflare SHOULD have copied all those records into your DNS server at Cloudflare when you set up the domain. So in that case they would already be there and should be correct. If not, you can just enter them over on the Cloudflare DNS servers manually. You can set up any kind of reasonable record on the Cloudflare servers. If your question LITERALLY is that you don't know how to set up MX records in general, then that's not really a VIrtualmin question. Basically you just set up an MX record pointing to the IP of your mail server and set the priority (and if you only have one then the priority is pretty arbitrary).
Another assumption is that there is some confusion about how nameservers and DNS works. And that's ok, I had the same confusion, and sometimes I think I'm still confused.
Here's a simple explanation which someone once helped me with.
The registrar where you registered the domain must be pointed to the Cloudflare nameservers. These will be in the form of xxx.xx.cloudflare.com. More common nameserver names are ns1.xxxx.com, ns2.xxxx.com, ns3.xxxx.com. These need to point to the DNS server you are using and in your case, that's cloudflare.
Once done, then the "internet" knows where to send traffic for all requests for anything for that domain.
Specifically for email traffic, when an email is sent to you@yourdomain.com, the request will first go to the registrar's server. The registrar says, "sorry I don't have that domain's dns records so I don't how to handle this mx request. But if you go here (xxx.xx.cloudflare.com), that guy should know what to do."
And so it reaches the cloudflare server, and asks where to direct the mx traffic to deliver an email. As long as you have an mx record in the cloudflare DNS which points to your mailserver, mail will be routed to your mailserver on virtualmin. As Cruiskeen mentioned, if your confusion is how to setup an mx record in Cloudflare, then just google that issue. "mx record setup on cloudflare" and you'll find loads of results to help you. I found thius article to be most informative. https://support.cloudflare.com/hc/en-us/articles/218069617-How-do-I-add-...
Remember that if you are using Cloudflare, that means you are not using DNS provided by Virtualmin. BIND (Virtualmin DNS server) can therefore be switched off for all domains that are using Cloudflare. To do that, you can go into System Settings -> Features and Plugins, and in there you can disable the BIND DNS Server feature.
Signature: Implement powerful CRM solutions using: Agile CRM: Advanced Marketing Automation (Note: This is an affiliate link)