Redirect webmail to HTTPS in Plesk

TWhosting

New member
Registered
Joined
Nov 10, 2016
Messages
5
Points
0
The webmailer from Plesk runs from home on port 80. This is unfortunately not optimal, but can be changed. A forced redirect to https is set up very quickly.

To avoid overwriting our configuration with a Plesk update, we will create a configuration file of your choice. This file must be created separately for each webmailer and placed in the corresponding configuration directory.

We create a file with the following content for mm_sslformailer.conf

Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This file is always placed under the appropriate webmailer. In the case of Centos, this would depend on each version:

Code:
/etc/apache2/plesk.conf.d/webmails/horde/mm_sslformailer.conf
/etc/apache2/plesk.conf.d/webmails/atmail/mm_sslformailer.conf 
/etc/apache2/plesk.conf.d/webmails/roundcube/mm_sslformailer.conf
For Debian and Ubuntu

Code:
/etc/httpd/conf/plesk.conf.d/webmails/horde/mm_sslformailer.conf
/etc/httpd/conf/plesk.conf.d/webmails/atmail/mm_sslformailer.conf 
/etc/httpd/conf/plesk.conf.d/webmails/roundcube/mm_sslformailer.conf
It must also be ensured that mod_rewrite is active.

Then restart Apache. Now all accesses to the configured webmailer from Plesk are redirected to https via redirect.
 

thehostingexpert

New member
Registered
Joined
Dec 20, 2016
Messages
13
Points
1
There are several solutions:

solution 1:
Create a configuration file with the following content:

# touch /etc/httpd/conf/plesk.conf.d/webmails/roundcube/redirect.conf
# cat /etc/httpd/conf/plesk.conf.d/webmails/roundcube/redirect.conf
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

2. restart apache :
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
It will create a redirect for Roundcube webmail. For Horde, just create the same file in /etc/httpd/conf/plesk.conf.d/webmails/horde/

solution 2: create a template : # mkdir -p /usr/local/psa/admin/conf/templates/custom
# cp -p /usr/local/psa/admin/conf/templates/default/domainWebmail.php /usr/local/psa/admin/conf/templates/custom/
add following to the end of file :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

It needs to look like this :

# cat /usr/local/psa/admin/conf/templates/custom/domainWebmail.php

<?php echo AUTOGENERATED_CONFIGS; ?>

<?php /** @var Template_VariableAccessor $VAR */ ?>
<?php
if (!$VAR->domain->webmailActive) {
echo "# Domain is disabled or suspended\
"; return; } ?> ServerAlias "webmail.<?php echo $VAR->domain->asciiName ?>" <?php foreach ($VAR->domain->mailAliases AS $alias): ?> ServerAlias "webmail.<?php echo $alias->asciiName ?>" <?php endforeach; ?> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

2 reconfigure each one of the domains : # /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
 
Older Threads
Latest Threads
Recommended Threads
Replies
13
Views
12,847
  • Locked
Replies
5
Views
4,462
S
Replies
1
Views
3,359
Replies
0
Views
1,835
Replies
10
Views
4,807
Similar Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top