With the function Setting up webmail.domain.com as default for new domains. it is possible to create a subdomain for direct access to the webmail.
But there is no SSL on this domain, and with Let's encrypt there is no excuse to not encrypt your webmail.
Please run this tutorial first if you haven't it already done
1. Add the webmail subdomain to the let's encrypt selection list:
Add the following item to the /usr/local/directadmin/conf/directadmin.conf
If you want to apply it by default, add the following line to the directadmin.conf to:
If the Lines doensn't exists you need to add this lines otherwise add the blue text
2. Setup a Virtual Host for HTTPS for the webmail
Open the file and append to the bottom of the file:
This is for Apache to listen on webmail subdomain at port 443
3. Rewrite the httpd.conf files.
If you create now a SSL certificate for a domain, you can select ( or it is autoselected with the option above ) the webmail subdomain.
Thats all !
Extra option:
If you want to Redirect all HTTP traffic to HTTPS for the webmail subdomain change the folowing line:
Caution: If the Domain hasn't the correct SSL certificate it will give a SSL warning
Open /usr/local/directadmin/data/templates/custom/virtual_host2.conf
Scroll to the bottom and remove the Red text and add the Blue text:
I hope this will help some people out, Lets encrypt the world !
But there is no SSL on this domain, and with Let's encrypt there is no excuse to not encrypt your webmail.
Please run this tutorial first if you haven't it already done
1. Add the webmail subdomain to the let's encrypt selection list:
Add the following item to the /usr/local/directadmin/conf/directadmin.conf
Code:
letsencrypt_list=www:mail:ftp:pop:smtp:webmail
If you want to apply it by default, add the following line to the directadmin.conf to:
Code:
letsencrypt_list_selected=www:webmail
If the Lines doensn't exists you need to add this lines otherwise add the blue text
2. Setup a Virtual Host for HTTPS for the webmail
Code:
cd /usr/local/directadmin/data/templates
cp virtual_host2_secure.conf custom
cd custom
Open the file and append to the bottom of the file:
Code:
...
...
</VirtualHost>
<VirtualHost |IP|:|PORT_443| |MULTI_IP|>
SSLEngine on
SSLCertificateFile |CERT|
SSLCertificateKeyFile |KEY|
|CAROOT|
ServerName webmail.|DOMAIN|
ServerAdmin |ADMIN|
DocumentRoot /var/www/html/roundcube
CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
ErrorLog /var/log/httpd/domains/|DOMAIN|.error.log
</VirtualHost>
3. Rewrite the httpd.conf files.
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d
If you create now a SSL certificate for a domain, you can select ( or it is autoselected with the option above ) the webmail subdomain.
Thats all !
Extra option:
If you want to Redirect all HTTP traffic to HTTPS for the webmail subdomain change the folowing line:
Caution: If the Domain hasn't the correct SSL certificate it will give a SSL warning
Open /usr/local/directadmin/data/templates/custom/virtual_host2.conf
Scroll to the bottom and remove the Red text and add the Blue text:
Code:
<VirtualHost |IP|:|PORT_80| |MULTI_IP|>
ServerName webmail.|DOMAIN|
ServerAdmin |ADMIN|
DocumentRoot /var/www/html/roundcube
CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
ErrorLog /var/log/httpd/domains/|DOMAIN|.error.log
Redirect 301 / https://webmail.|DOMAIN|
</VirtualHost>
I hope this will help some people out, Lets encrypt the world !