View Single Post
  #2  
Old 15th August 2012, 05:18
tahunasky tahunasky is offline
Member
 
Join Date: Jul 2012
Location: Buenos Aires
Posts: 84
Thanks: 1
Thanked 8 Times in 8 Posts
Default

For CentOS 6.3 what i have done, is when a user types in mail.domain.com (or mail.domain1.com, mail.domain2.com etc) it goes to roundcube, but can be the same for squirrelmail.

Create a DNS mail CNAME record for each domain you want to redirect the subdomain mail to squirrelmail. I think ispconfig automatically makes an A record for mail, but if you are going to the same IP address i prefer the CNAME as if i change the IP address i dont need to change every subdomains records IP address, just the main domain A record..

SO in DNS create the CNAME record.

Code:
    
CNAME 	mail 	domain.com.
then create a file as below:

/etc/httpd/conf/sites-available/_default.vhost
Code:
  
<VirtualHost *:80>
    ServerName mail.domain.com
    ServerAlias mail.*
    DocumentRoot /usr/lib/squirrelmail
    ServerAdmin webmaster@domain.com
# put the below 3 lines if you require SSL connectiom
    RewriteEngine  on
    RewriteCond    %{HTTPS} !=on
    RewriteRule ^mail(.*) https://mail.{HTTP_HOST}
</VirtualHost>

# the below section is only need if you have above 3 lines and want SSL
<VirtualHost *:443>
    ServerName mail.domain.com
    ServerAlias mail.*
    ServerAdmin webmaster@domain.com
    DocumentRoot /usr/lib/squirrelmail
    
    SSLEngine On
    SSLCertificateFile /usr/local/ispconfig/interface/ssl/ispserver.crt
    SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key
 </VirtualHost>
then i create a link to the /etc/httpd/conf/sites-enabled/ directory:

Code:
ln -s /etc/httpd/conf/sites-available/_default.vhost /etc/httpd/conf/sites-enabled/000-default.vhost
this way it doesnt matter what domain is used, if the put in the mail subdomain they will all go to the same place, and any new domains you add with the mail subdomain will also be sent to squirrelmail without any extra configuring.

Last edited by tahunasky; 15th August 2012 at 05:34.
Reply With Quote