Mail Autoconfig not working and SSL cert incorrect

I am not exactly new to Virtualmin, but I am now starting to use the email functions for my sites.

In the process I have managed to either screw up or not set up properly the autoconfig.

Here is what I need: 1) An autoconfig that works 2) An autoconfig setup for my Virtual Servers that will point them all to my Virtualmin Server’s hostname. (i.e if company.com is trying to configure their email the script will direct them to myhostserver.tld). 3) Use my virtualmin host servers SSL certificate in Postfix and Dovecot

Here is what I have tried: Regarding the autoconfig, I went to System Settings–>Server Templates–>Mail client autoconfiguration and set Automatically Generated XML for Thunderbird and Outlook in the Default Settings Template. I then went to Email Messages–>Mail Client Configuration and disabled the autoconfig and re-enabled the autoconfig. I was then able to confirm that http://mywebsite.tld/cgi-bin/autoconfig.cgi exists. At this point I thought everything was fine, but I tried to launch Outlook and it could not discover the server settings. I then tried Thunderbird and it too could not autoconfigure, it had to fail back on the use of common server names. I have not tried changing port numbers or server names yet since I just want to get the damned thing kind of working before I try to send the clients to the host server (instead of virtual server).

With regard to the SSL certificate, I did not realize that Dovecot and Postfix hold only one certificate for the server (makes sense now). So I had clicked copy to from one of my virtual servers in an attempt to get a certificate to match. This of course made all of my clients get a certificate error who were not on this virtual server. This is part of the reason I want to direct all mail clients to the host server name (instead of virtual server) and then try to install the SSL certificate for the host server into Dovecot and Postfix. I am not sure how to do this and didn’t want to bork things up any more.

I am running Virtualimin 1.730 on Ubuntu 14.04.1 (32-bit)

It would appear that installing virtualmin on Ubuntu does not involve CGI being enabled. This prevents the autoconfig script from running properly and clients cannot enumerate it and thus ignore it.

This did the trick at the command line
sudo bash
a2enmod cgi
service apache2 restart

Now just have to investigate the best way to have all mail direct to one virtual host with one SSL cert for dovecot/postfix.