Centralised webmail

I trying to figure out the best way to implement a centralised webmail installation. I want to use squirrellmail and customise it with my branding, then i’d like to have webmail.customer.com or customer.com/webmail point to that installation.

I suppose i could add a rewrite rule to existing domains, and in my templates for

/webmail --> webmail.mydomain.com

or i could create webmail.mydomain.com and add webmail.customer.com as an alias, but i can’t figure out if its possible to automate that in virtualmin every time a new server is created.

Any suggestions… ?

Cheers
Chris

Whoops, I seemed to have answered the wrong question.

How do you automate the "webmail.domain.tld" is your real question.

Sorry, I don’t know the answer, yet.

I’ve just come back to this issue after putting it to one side for a while.

I think that using rewrite rules as u posted above and a custom DNS entry, that this should work. In the server template i’ve set the record mode to “Add to automatically generated records” and put this to the DNS record for new domains.

webmail IN A ${IP}

That should be all thats required, apart from setting up the webmail installation and getting the rewrite rules to work :slight_smile:

Chris

This would be added to your httpd.conf file.
The owner:group of your files should be set to the same as the User / Group in the httpd.conf (like apache:apache).

Then put your content in /home/webmail/public_html

<VirtualHost your.virtualhost.ip.addr:80>
ServerName mail
ServerAlias mail.*
UseCanonicalName Off
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mail…* [[NC]]
RewriteRule (.) %{HTTP_HOST}
RewriteRule ^mail.(.
) http://webmail.$1/ [[R=301,L]]
</VirtualHost>

<VirtualHost your.virtualhost.ip.addr:80]
DocumentRoot /home/webmail/public_html
ServerName webmail
ServerAlias webmail.*
UseCanonicalName Off
ErrorLog /home/webmail/logs/error_log
CustomLog /home/webmail/logs/access_log combined
[Directory /home/webmail/public_html>
[IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag magic_quotes_gpc off
php_admin_flag safe_mode off
php_admin_value open_basedir "/home/webmail:/tmp:/usr/share/pear:/usr/sbin"
php_admin_value include_path "/usr/share/pear:."
[/IfModule>
Options IncludesNOEXEC FollowSymLinks
AllowOverride FileInfo AuthConfig Limit
[/Directory>
</VirtualHost>

</pre>